Refactor camera wizards and fix probe positioning functionality#59
Refactor camera wizards and fix probe positioning functionality#59mmouchous-ledger wants to merge 20 commits intodev/devfrom
Conversation
- Updated the camera wizards to include a new probe positioning wizard, allowing users to specify the location of probes or laser spots in the camera image. - Added new pages for camera distortion correction and probe positioning, enhancing the user interface for better interaction. - Removed the obsolete camerawizards.py file and organized the code into separate modules for clarity and maintainability. - Improved documentation and user guidance within the wizard pages to assist users in positioning probes accurately. - Fixes #58 with correct positioning of the marker when the objective lens selection changes
|
Not fixed when in config.yaml, the objective is set to something different from 1.0 |
- Added logging to CameraDockWidget, CameraNITDockWidget, and CameraRaptorDockWidget to track parameter changes and objective selections. - Refactored the marker position update logic in ProbeMarker to simplify the handling of camera magnification.
- Adjusted width calculations in CameraRaptorInstrument to correct the ratio for v4l to cv2 conversion. - Removed redundant width and height calculations in CameraUSBInstrument. - Enhanced CameraInstrument to log objective changes and dimensions in micrometers, considering the objective. - Updated StageSight to log camera dimensions when updating size, with an option to display in pixels. - Modified CameraPicker to initialize with pixel dimensions for better user interaction.
- Updated the CameraPicker class docstring to clarify the image presentation and pixel handling. - Adjusted the size of the clicked point marker to be 5% of the image width for improved visibility. - Changed logging level from info to debug in CameraDockWidget and CameraNITDockWidget to reduce log verbosity during objective changes.
…Permitting to get less risk of misuse of the class during development (type checking)
…n ProbeInstrument to reduce log verbosity.
|
Verified with "Dummy stage" + USB Camera configuration + Probe Instrument. To be validated on other subclasses of Camera (Raptor and NIT) to make sure that refactoring are well applied for those subclasses. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the camera wizard functionality by splitting a monolithic camerawizards.py file into a modular package structure with separate files for probe positioning (probeposition.py), distortion correction (distortion.py), and common wizard components (camerapages.py). The refactoring also includes significant changes to how probe positions are stored and displayed, modifications to the camera's objective handling (converting width_um and height_um to computed properties), and improvements to the Vector class for stage instruments.
Changes:
- Refactored camera wizards into a module with separate files for different wizard types
- Changed probe offset positions from micrometers to pixels in the configuration schema
- Converted camera width_um/height_um to computed properties based on objective magnification
- Added a custom Vector class wrapper with typed accessors for stage coordinates
- Improved type annotations throughout using modern Python 3.10+ union syntax
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| laserstudio/widgets/camerawizards.py | Deleted monolithic wizard file |
| laserstudio/widgets/camerawizards/init.py | New module init exposing wizard classes |
| laserstudio/widgets/camerawizards/camerapages.py | Common wizard page base classes and camera picker |
| laserstudio/widgets/camerawizards/probeposition.py | Probe positioning wizard implementation |
| laserstudio/widgets/camerawizards/distortion.py | Camera distortion correction wizard |
| laserstudio/widgets/marker.py | Updated ProbeMarker with magnification-based position scaling |
| laserstudio/widgets/stagesight.py | Added pixel-based size mode and new_image signal connection |
| laserstudio/instruments/camera.py | Converted width_um/height_um to properties, improved type hints |
| laserstudio/instruments/camera_usb.py | Removed redundant width_um/height_um initialization |
| laserstudio/instruments/camera_raptor.py | Fixed width adjustment without breaking width_um property |
| laserstudio/instruments/stage.py | Added Vector wrapper class with typed accessors |
| laserstudio/instruments/stage_dummy.py | Updated to use local Vector class |
| laserstudio/instruments/stage_rest.py | Updated to use local Vector class |
| laserstudio/instruments/probe.py | Added logging for offset position changes |
| laserstudio/widgets/toolbars/cameradockwidget.py | Added objective selector combobox to base class |
| laserstudio/widgets/toolbars/cameranitdockwidget.py | Renamed mag_combobox to obj_combobox, added parameter_changed handler |
| laserstudio/widgets/toolbars/cameraraptordockwidget.py | Removed duplicate objective selector, uses parent's combobox |
| laserstudio/laserstudio.py | Improved type safety with explicit float conversions |
| laserstudio/restserver/server.py | Minor import reordering and type annotation improvements |
| laserstudio/config_schema/probe.schema.json | Changed offset_pos from micrometers to pixels |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…e color of the path from red to grellow.
…d, right-button release event is trigered
…es in PDM and StageSight fix: objective selection and application in initialization
Uh oh!
There was an error while loading. Please reload this page.