Repository navigation
Conversation
Add a separate Multicolor Beads mode with objective-dependent specimen scale and deterministic DAPI, FITC, Rhodamine, and Cy5 populations. Support the standard demo filter and multiband LED presets, RGB pseudocolors, and read-only simulation diagnostics. Preserve legacy Fluorescent Beads rendering, retaining the RGB buffer-clear safety fix and defined unsigned tile hashing. Validation: Linux build; specimen geometry, ROI, binning, stage movement, channel populations and RGB tests; 45 legacy image cases match a separately compiled official baseline pixel-for-pixel.
|
This was done using Codex GPT6.1 for a Smart Microscopy Hackathon and helps implement the canonical Overview>Detect Objects>Analyse>Change Objective>Revisit objects. workflow |
marktsuchida
left a comment
There was a problem hiding this comment.
Cool stuff! However, I'm a little worried about adding more and more to the already-bloated DemoCamera, without making sure at each step that everything works consistently and predictably.
The position label–based wavelength selection and pixel size are going to be fragile, and probably a little confusing, if not just using the demo config unmodified. At the very least, we need to have simple rules that can easily be documented. (In theory I'd favor adjusting the demo config to work with the demo devices, rather than the other way around. However, we'd need to check how the demo config is currently used in tests, e.g. by pymmcore-plus. Another reason why DemoCamera is no longer easy to change.)
You might also be interested in the in-development SimulatedMicroscope adapter (not in nightly builds yet but the GitHub release has binaries), which we started as a new adapter so that every device could be purpose-built for simulation without unrelated baggage. It doesn't yet have any wavelength-based behavior, though, and some details are subject to change.
I'm not opposed to adding this to DemoCamera for now, if the following points can more or less be addressed.
| bead.worldY = tileWorldY + (double)std::rand() / RAND_MAX * tileSize; | ||
| bead.intensityFactor = 0.8 + 0.4 * (double)std::rand() / RAND_MAX; // 80-120% | ||
| bead.sizeFactor = 0.8 + 0.4 * (double)std::rand() / RAND_MAX; // 80-120% | ||
| beads.push_back(bead); |
There was a problem hiding this comment.
bead.channelMask left uninitialized?
| } | ||
|
|
||
|
|
||
| // Original Fluorescent Beads mode from the checked-out official repository. |
There was a problem hiding this comment.
Comment won't make sense once merged.
| // Use tile hash as seed for deterministic random generation | ||
| unsigned int seed = HashTileCoords(tileX, tileY); | ||
| std::srand(seed); | ||
| // Separate RNG keeps the existing specimen positions unchanged. |
There was a problem hiding this comment.
"existing" won't make sense once merged.
|
|
||
| // Generate beads for a specific tile using procedural generation | ||
| void CDemoCamera::GenerateBeadsForTile(int tileX, int tileY, std::vector<Bead>& beads) | ||
| void CDemoCamera::GenerateMulticolorBeadsForTile(int tileX, int tileY, std::vector<Bead>& beads) |
There was a problem hiding this comment.
Is there any chance of combining the multicolor implementation with the existing non-multicolor version instead of duplicating much of the code? Same for the other multicolor functions (generate positions, render to image, and generate image).
| double magnification = LabelMagnification(DeviceLabel(objective)); | ||
| if (!(magnification > 0)) magnification = 10.0; | ||
| return binSize_ * 10.0 / magnification; | ||
| } |
There was a problem hiding this comment.
In addition to being fragile (makes assumptions about objective position labels), this ignores the Magnifier (DOptovar) setting. And I don't think it make sense to have fixed 1 µm/px for fluorescent beads and variable for the multi-color beads (assuming I'm reading that right).
Closing for now. Created marktsuchida/mmdev-SimulatedMicroscope#19. |
Add a separate Multicolor Beads mode with objective-dependent specimen scale and deterministic DAPI, FITC, Rhodamine, and Cy5 populations. Support the standard demo filter and multiband LED presets, RGB pseudocolors, and read-only simulation diagnostics.
Preserve legacy Fluorescent Beads rendering, retaining the RGB buffer-clear safety fix and defined unsigned tile hashing.
Validation: Linux build; specimen geometry, ROI, binning, stage movement, channel populations and RGB tests; 45 legacy image cases match a separately compiled official baseline pixel-for-pixel.