-
Notifications
You must be signed in to change notification settings - Fork 128
Evident IX85 - DeviceAdapters for the XY stage (COM) and Hub (both through COM and SDK) #780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nicost
wants to merge
69
commits into
micro-manager:main
Choose a base branch
from
nicost:EvidentIX85
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
95427b1
Add EvidentIX85 device adapter for Evident IX85 microscope
nicost 462e3c3
Fix build errors in EvidentIX85
nicost 2725601
EvidentIX85: Build with C++14, add dependency on MMDevice
nicost a03dde8
EvidentIX85: Fix compile problems related to MMTime.
nicost b343184
EvidentI85: Devices are now correctly registered.
nicost 746fe17
Clear Busy state when Focus/Nosepiece reach target position
nicost a4e1997
Fix race condition between command and monitoring threads
nicost 4c22a3c
Fix notification filtering to not skip acknowledgment responses
nicost cf3bc91
Refactor to single-threaded serial port reading architecture
nicost 4217748
Make parameter parsing functions robust to prevent crashes
nicost d83ab49
Fix notification detection to distinguish acknowledgments from data
nicost 34b28d0
Fix Focus Busy state with tolerance-based position comparison
nicost 49e959e
Set target position and busy state before sending command
nicost 28fbe7e
Convert EvidentMagnification to use CMagnifierBase
nicost d5e2a7d
Fix build errors and runtime issues in Magnification device
nicost fb67c43
Add OnMagnifierChanged callback for magnification changes
nicost c1bb0a6
Fix shutdown timeout by stopping monitoring thread last
nicost 2636fe0
EvidentIX85: Add SafeNosepieceChange feature
nicost aa85806
EvidentIX85: Implement all remaining device classes
nicost 41c71f8
EvidentIX85: Fix MirrorUnit1 to use query-based position tracking
nicost b64f44f
EvidentIX85: Fix missing SetNumPositions calls in Query functions
nicost d47c9cb
EvidentIX85: Remove incorrect EnableNotifications calls
nicost 52f15de
EvidentIX85: Restore EnableNotifications with correct CondenserTurret…
nicost 16b9b34
EvidentIX85: Fix CondenserTurret timeout by clearing busy after TR+ ack
nicost e2d70d6
EvidentIX85: Fixes bug in DiaShutter detection.
nicost c7d1c44
EvidentIX85: Fix multiple device bugs found during hardware testing
nicost 100465d
EvidentIX85: Use V command for device detection and add firmware vers…
nicost 4d49d15
EvidentIX85: Add MirrorUnit2, EPIShutter2, and Manual Control Unit in…
nicost 380ac7e
EvidentIX85: Add encoder support, MCU indicators I4/I5, and stage cal…
nicost 5692211
EvidentIX85: Add focus jog controls and fix DIA brightness display
nicost d24ba18
EvidentIX85: Convert CorrectionCollar to Stage device with linking su…
nicost 3a9a890
EvidentIX85: add orphaned addition of DeviceType_DIABrightness
nicost 0cde5ba
EvidentIX85: Add initialization robustness and serial port auto-detec…
nicost d3a413b
EvidentIX85: Fix CorrectionCollar linking failure due to double termi…
nicost d5e956e
EvidentIX85: bug fixes.
nicost 2d4eca5
EvidentIX5SSA - XYStage - first version.
nicost 9636eb6
IX85XYSTage: fixed limits, renamed device.
nicost ebda167
EvidentIX85: rename IX5SSA to IX85XYStage
nicost ff15b3b
EvidentIX85: Fixed bug: MIRROR_UNIT_MAX_POS equals 8 rather than 6.
nicost a7093f9
EvidentIX85Win: start.
nicost 8a50c07
EvidentIX85Win: Progress.
nicost e589f05
EvidentIX85Win: more progress
nicost 129ae10
EvidenIX85Win: ZDC somewhat working, several fixes to other devices.
nicost a443222
EvidentIX85Win: Add Tracking Mode property for ZDC autofocus
nicost fc3851a
EvidentIX85Win: Add Focus Near Limit properties to Nosepiece
nicost 90eb428
EvidentIX85Win: Add parfocal settings and escape distance, switch to …
nicost 75ca5ab
EvidentIX85Win: Implement ZDC autofocus workflow modes
nicost 45c14b7
EvidentIX85Win: Add ObjectiveSetup device for microscope configuration
nicost e990379
EvidenIX85Win-ObjectiveSetup - remove rednundant FinalSpecs property.
nicost 28f884c
EvidentIX85Win: Refactor ObjectiveSetup handlers to use CPropertyActi…
nicost 18271aa
EvidentIX85Win AF: FinFocusWithOffset no longer needs the offset to b…
nicost d84bd6d
EvidentIX85Win: Add PropertyChanged callbacks for AF Status updates
nicost 99d6cab
EvidentIX85Win: Adds Serial port detection so that available
nicost 67a26d5
EvidentIX85: removed files that should not have been included.
nicost 293c574
EvidentIX85Win: ZDCVirtualOffset. WIP.
nicost 6edd6fe
EvidentIX85Win: Added ZDCVirtualOffset. Needs testing with hardware.
nicost c8fd768
VS SOlution cleanup.
nicost 6d58efd
EvidentIX85Win: changed default path to SDK dll to be relative to the…
nicost 5455595
EvidentIX85Win: fix not waiting for focus drive to move into the corr…
nicost c647311
EvidentIX85Win: make sure that ZDC is busy whenever the focus drive i…
nicost 2459485
EvidentIX85Win: adds neede header from secret repo.
nicost 152542f
EvidentIX85Win: Change autofocus mode default to Find-Focus-With-Offset.
nicost aab3f86
EvidentIX85Win: made debug mode compile correcyly.
nicost 4d04d9f
EvidentIX85Win: handles busy error message from SDK by trying the com…
nicost f88e213
EvidentIX85WIN: Provide a mechanism to Execute Commands
nicost a855616
EvidentIX85Win: formatting only.
nicost 336dfb8
EvidentIX85Win: Made parfocal settings work.
nicost f08c4df
EvidentIX85Win: Ensure default serial oirt tiomeout is correct.
nicost b30cb96
EvidentIX85: Hardcoded path to the default micro-manager installation…
nicost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Repository Overview | ||
|
|
||
| Micro-Manager is Open Source software for microscope control. This repository contains the C++ core components: | ||
|
|
||
| - **MMCore**: Device abstraction layer providing the top-level API for applications to control microscope hardware (see `MMCore/MMCore.h`) | ||
| - **MMDevice**: Device API defining the interface that device adapters must implement (see `MMDevice/MMDevice.h` and `MMDevice/DeviceBase.h`) | ||
| - **MMCoreJ_wrap**: SWIG-generated Java wrapper for MMCore | ||
| - **DeviceAdapters/**: Publicly accessible device adapter source code | ||
| - **SecretDeviceAdapters/**: Non-public device adapters (separate private repository referenced via git submodule) | ||
|
|
||
| ### Architecture | ||
|
|
||
| MMCore implements two APIs: | ||
| - **Top API** (`MMCore/MMCore.h`): Used by applications to control abstracted microscope hardware. Public methods use lowercase naming (e.g., `getConfiguration()`) to be language-agnostic for SWIG wrapping. | ||
| - **Bottom API** (`MMDevice/MMDevice.h`): Implemented by device adapters to communicate with physical devices. | ||
|
|
||
| Both APIs maintain a pure C-interface for cross-platform compatibility and dynamic loading. | ||
|
|
||
| Device adapters are compiled into dynamically loadable libraries (`.dll`/`.so`/`.dylib`) that MMCore loads at runtime. | ||
|
|
||
| ## Build Commands | ||
|
|
||
| ### Windows (Visual Studio) | ||
|
|
||
| Primary solution file: `micromanager.sln` | ||
|
|
||
| Build using MSBuild or Visual Studio. MSBuild properties can be overridden via `/property:name=value`: | ||
| - `MM_3RDPARTYPUBLIC`: Path to public 3rd party dependencies (default: `../../3rdpartypublic`) | ||
| - `MM_3RDPARTYPRIVATE`: Path to private 3rd party dependencies (default: `../../3rdparty`) | ||
| - `MM_BOOST_INCLUDEDIR`: Boost include directory | ||
| - `MM_BOOST_LIBDIR`: Boost lib directory | ||
| - `MM_BUILDDIR`: Build artifacts directory | ||
|
|
||
| See `buildscripts/VisualStudio/MMCommon.props` for default values. | ||
|
|
||
| ### macOS and Linux (Autotools) | ||
|
|
||
| Standard GNU Autotools workflow: | ||
|
|
||
| ```bash | ||
| # From repository root | ||
| ./configure # Configure build (detects available SDKs) | ||
| make # Build all components | ||
| make install # Install (may require sudo) | ||
| ``` | ||
|
|
||
| Build only MMCore and device adapters (skip Java components): | ||
| ```bash | ||
| ./configure --without-java | ||
| make | ||
| ``` | ||
|
|
||
| The build system auto-detects which device adapters can be built based on available vendor SDKs and headers. | ||
|
|
||
| ### Experimental Meson Build (justfile) | ||
|
|
||
| Requires: `just`, `meson`, `ninja` | ||
|
|
||
| ```bash | ||
| just # List available commands | ||
| just build-mmdevice # Build MMDevice | ||
| just build-mmcore # Build MMCore (depends on MMDevice) | ||
| just test-mmdevice # Test MMDevice | ||
| just test-mmcore # Test MMCore | ||
| just test # Run all tests | ||
| just clean # Clean build artifacts | ||
| ``` | ||
|
|
||
| Quick one-liner with uv: | ||
| ```bash | ||
| uvx --from rust-just --with meson --with ninja just test | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| Tests use Catch2 framework and are located in `unittest/` subdirectories: | ||
| - `MMCore/unittest/` - Core tests | ||
| - `MMDevice/unittest/` - Device API tests | ||
| - Some device adapters have their own tests (e.g., `DeviceAdapters/HamiltonMVP/unittest/`) | ||
|
|
||
| Run tests via meson (see justfile commands above) or through IDE test runners. | ||
|
|
||
| ## Device Adapter Development | ||
|
|
||
| ### Base Classes | ||
|
|
||
| Device adapters inherit from specialized base classes in `MMDevice/DeviceBase.h`: | ||
| - `CCameraBase<T>` - Cameras | ||
| - `CShutterBase<T>` - Shutters | ||
| - `CStageBase<T>` - Z-stages | ||
| - `CXYStageBase<T>` - XY stages | ||
| - `CStateDeviceBase<T>` - Filter wheels, turrets | ||
| - `CGenericBase<T>` - Generic devices | ||
| - `CAutoFocusBase<T>` - Autofocus devices | ||
| - `CImageProcessorBase<T>` - Image processors | ||
| - `CHubBase<T>` - Device hubs (multi-device controllers) | ||
|
|
||
| All base classes use the CRTP pattern: `class MyDevice : public CCameraBase<MyDevice>` | ||
|
|
||
| ### Property System | ||
|
|
||
| Device configuration uses a property-based system. Properties are created in `Initialize()`: | ||
| ```cpp | ||
| // Create action handler | ||
| CPropertyAction* pAct = new CPropertyAction(this, &MyDevice::OnProperty); | ||
| // Create property with allowed values | ||
| CreateProperty("PropertyName", "DefaultValue", MM::String, false, pAct); | ||
| AddAllowedValue("PropertyName", "Value1"); | ||
| AddAllowedValue("PropertyName", "Value2"); | ||
| ``` | ||
|
|
||
| ### Vendor SDK Integration | ||
|
|
||
| Many device adapters depend on proprietary vendor SDKs: | ||
| - SDK headers/libraries are in `../../3rdpartypublic/` (public) or `../../3rdparty/` (private) | ||
| - Build system automatically disables adapters when SDKs are unavailable | ||
| - Each adapter's `configure.ac` or `.vcxproj` specifies SDK requirements | ||
|
|
||
| Example adapters to study: | ||
| - `DemoCamera` - Full-featured reference implementation without hardware dependencies | ||
| - `Arduino` - Simple serial communication pattern | ||
| - `PVCAM` - Camera with vendor SDK integration | ||
| - `ASITiger` - Multi-device hub pattern | ||
|
|
||
| ### Threading Considerations | ||
|
|
||
| Camera adapters typically use separate threads for image acquisition: | ||
| - Implement proper locking around shared state | ||
| - Use MMDevice threading primitives (`MMThreadLock` in `DeviceThreads.h`) | ||
| - Circular buffers handle asynchronous image streaming (see `MMCore/CircularBuffer.h`) | ||
|
|
||
| ### Error Handling | ||
|
|
||
| Use standard error codes from `MMDevice/MMDeviceConstants.h`: | ||
| - `DEVICE_OK` - Success | ||
| - `DEVICE_ERR` - Generic error | ||
| - Define adapter-specific error codes starting at 100+ | ||
|
|
||
| Common error message constants are defined in `MMDevice/DeviceBase.h` (e.g., `g_Msg_SERIAL_TIMEOUT`). | ||
|
|
||
| ## Key Files for Understanding the System | ||
|
|
||
| - `MMCore/MMCore.h` - Main public API | ||
| - `MMDevice/MMDevice.h` - Device interface definitions | ||
| - `MMDevice/DeviceBase.h` - Base classes and utility templates | ||
| - `DeviceAdapters/DemoCamera/DemoCamera.cpp` - Reference implementation | ||
| - `buildscripts/VisualStudio/MMCommon.props` - Windows build configuration defaults | ||
|
|
||
| ## Coding style | ||
| - All indents are 3 spaces (no tab characters). | ||
| - Curly braces open in the same line in Java and in a new line in C++ (see examples). | ||
| - Class names begin with uppercase, and with each word capitalized, e.g. MyFirstClass. | ||
| - Function names use the same convention except that in Java they begin with lowercase and in C++ with uppercase, e.g. MyFunc() in C++ and myFunc() in Java. | ||
| - All variables begin with lower case, e.g. myVar. | ||
| - Class member variables begin with lowercase and end with underscore, e.g. memberVar_. | ||
| - Do not use this->memberVar_ idiom unless it is absolutely necessary to avoid confusion. | ||
| - Static constants in C++: const char* const g_Keyword_Description. | ||
| - Static constants in Java: static final String METADATA_FILE_NAME. | ||
| - if/else, for, and while statements should include curly braces, even if they are only followed by a single line. | ||
|
|
||
| ## CRITICAL: File Editing on Windows | ||
| MANDATORY: Always use Backslashes on Windows for File Paths | ||
| When using Edit or MultiEdit on WIndows, you MUST use backslashes (\) in the file paths, NOT forward slashes (/). | ||
| WRONG: | ||
| Edit(file_path: "D:/repos/project/file.tsx", ...) | ||
| MultiEdit(file_path: "D:/repos/project/file.tsx", ...) | ||
| CORRECT: | ||
| Edit(file_path: "D:\repos\project\file.tsx", ...) | ||
| MultiEdit(file_path: "D:\repos\project\file.tsx", ...) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having looked at this -- could we (discuss whether to) add CLAUDE.md in a separate PR?
I'm not sure I agree with everything that's in here (there are some outright mistakes), or whether or not to tell certain things to Claude. I, for one, would not be able to use Claude Code comfortably without first deleting this file each time. There might be a version of a CLAUDE.md that I would be comfortable including in the repo, but it looks like it would take at least a bit of work to produce such a thing (and even then, I'm not sure how confident I'd be about imposing it on others). So I think it would be better to decouple it from merging the IX85 adapter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd concur with @marktsuchida here. Beyond the issues already described, it's unfortunate to push a document pertaining specifically to Claude Code. All of the major AI user interfaces seem to have their own document - if we add one, is it okay to add others? (🤮)
Most AI tools (except, ironically, Claude Code 😅) now support an
AGENTS.mdif it's available in addition to their own proprietary documents, so I'd vote for one of those to be pushed to the repository, if we decide that we want an agent guidance document in the repo.