Open
Conversation
Introduces BatchedRescaleYX(d) transforms that resize the YX spatial dimensions of 5D tensors using bilinear interpolation with anti-aliasing. Adds reference_pixel_size parameter to TripletDataModule: when set, the module reads the pixel size from the inference dataset's OME-Zarr metadata and automatically computes the initial patch size so that the same physical area is captured as during training, then rescales to final_yx_patch_size. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a two-step CLI for cross-platform embedding batch correction using Linear Optimal Transport (POT LinearTransport): viscy-dynaclr fit-lot-correction -c config.yaml viscy-dynaclr apply-lot-correction -c config.yaml Core logic in viscy/representation/evaluation/lot_correction.py: - fit_lot_correction: fits shared StandardScaler + PCA + LOT on uninfected reference cells from source (e.g. light-sheet) and target (e.g. confocal) embedding zarrs. Cell selection is driven by flexible obs-column filters (startswith / equals). - apply_lot_correction: transforms all cells in a source zarr through the fitted pipeline (scaler → PCA → LOT) and writes a corrected AnnData zarr preserving all obs metadata. - save/load_lot_pipeline: joblib serialisation of the fitted pipeline. Pydantic config models (LotFitConfig, LotApplyConfig, UninfFilter) validate all inputs before running. Example YAML configs are provided under applications/DynaCLR/evaluation/lot_correction/configs/. Tested end-to-end on organelle channel zarrs: fit on LS1 + confocal 223-patch, apply to LS1 → output shape (39170, 50), all obs metadata preserved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a general-purpose `viscy-dynaclr compute-mmd` command that computes MMD² between any two groups of cell embeddings from AnnData zarrs. Supports within-zarr (biological signal) and cross-zarr (batch effect) comparisons, optional per-group breakdowns, shared PCA preprocessing, and permutation tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
edyoshikun
commented
Mar 27, 2026
| from typing_extensions import Literal | ||
|
|
||
|
|
||
| class BatchedRescaleYX(Transform): |
Member
Author
There was a problem hiding this comment.
- This is great, but we can use MONAI's version, which is more flexible and we tested already in AugmentedVSUNet() on cytoland https://monai.readthedocs.io/en/1.4.0/transforms.html#zoomd
- Also lets change the default to be linear or nearest.
edyoshikun
commented
Mar 27, 2026
| return resized.view(b, c, z, *self.target_yx_size) | ||
|
|
||
|
|
||
| class BatchedRescaleYXd(MapTransform): |
Member
Author
There was a problem hiding this comment.
wont need this since we have the zoom and batchedzoom
| self.return_negative = return_negative | ||
| self.augment_validation = augment_validation | ||
| self._cache_pool_bytes = cache_pool_bytes | ||
| if reference_pixel_size is not None: |
| return BatchedRescaleYXd( | ||
| keys=self.source_channel, | ||
| target_yx_size=self.yx_patch_size, | ||
| mode="bilinear", |
Member
Author
There was a problem hiding this comment.
lets change this to use the ZoomTransform in viscy-transforms. also this is a
Member
Author
|
we are missing test that evaluate the algorithm |
edyoshikun
commented
Mar 27, 2026
| from viscy.transforms._zoom import ( | ||
| BatchedRescaleYX, | ||
| BatchedRescaleYXd, | ||
| BatchedZoom, |
Member
Author
There was a problem hiding this comment.
use this one @Soorya19Pradeep it's the same thing.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.