Skip to content

Open current image in bdv#22

Merged
stefanhahmann merged 54 commits intomainfrom
open-current-image-in-bdv
Mar 4, 2026
Merged

Open current image in bdv#22
stefanhahmann merged 54 commits intomainfrom
open-current-image-in-bdv

Conversation

@stefanhahmann
Copy link
Copy Markdown
Collaborator

@stefanhahmann stefanhahmann commented Feb 20, 2026

This pull request contains refactorings the way OME-Zarr datasets are opened and managed. It updates method names cleans up test and demo code.

Refactoring and Code Cleanup:

  • Moved MultiscaleImage.java, Multiscales.java and OMEZarrData.java to the test directory for a now, as these classes are currently not used anymore for production.

  • It remains only:

    • Pyramidal5DImageData - the interface
    • DefaultPyramidal5DImageData - the default implementation of the interface using N5Utils.open() for the ImgPlus and N5Viewer.buildN5Sources for the SourceAndConverter
    • PyramidalDataset - the extension of Dataset
    • For the scale / axes handling, there are now inner classes in DefaultPyramidal5DImageData: ResolutionLevel and MetadataAdapter that partially serve similar purposes as the old Multiscales
  • Refactored dataset opening logic in ZarrOpenActions to first attempt opening as a multiscale image, then fall back to single-scale, improving the user experience

Error Handling and Robustness:

  • Added custom exceptions NotAMultiscaleImageException and NotASingleScaleImageException to clearly signal when a dataset is not a valid multiscale or single-scale OME-Zarr image, and refactored code to throw and handle these exceptions appropriately.

  • Improved error reporting to users and logging by showing more informative error dialogs and log messages when dataset opening fails (ZarrOpenActions.java).

API and Naming Consistency:

  • Renamed numResolutions() to numResolutionLevels() in Pyramidal5DImageData and updated all usages

User Interface Improvements:

  • Added a menu path to the OpenInBDVCommand plugin

New Demo and Documentation:

  • Added N5ReaderDemo.java to demonstrate metadata discovery and inspection for OME-Zarr datasets (N5ReaderDemo.java).

@stefanhahmann stefanhahmann self-assigned this Feb 20, 2026
@stefanhahmann stefanhahmann force-pushed the open-current-image-in-bdv branch 7 times, most recently from 950d25c to 9e0c441 Compare February 26, 2026 13:18
@stefanhahmann stefanhahmann requested a review from xulman February 26, 2026 13:23
…e datasets

* update tests
* add custom exception handling.
…mageData` constructor with improved exception handling
…tion source to test directory

Reasoning
* Class Multiscales can be replaced by using N5 OMENgffMeta classes, which read the same information and make it accessible through their APIs
* Purpose of class OMEZarrData was a bit unclear
* MultiscaleImage does not seem to be needed for now, since access to Img / SourceAndConverters is possible via N5 function calls
…es inside one level.

New hierarchy:

Multiscale
 ├── name
 ├── resolutionLevels
       ├── level 0
       ├── level 1
       └── level N

Remove conceptual leakage that an individual resolution level knows how many resolution levels there are
Copy link
Copy Markdown
Collaborator Author

@stefanhahmann stefanhahmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the valuable comments. I tried to address them as appropriate.

Comment thread src/main/java/sc/fiji/ome/zarr/pyramid/DefaultPyramidal5DImageData.java Outdated
Comment thread src/main/java/sc/fiji/ome/zarr/pyramid/DefaultPyramidal5DImageData.java Outdated
Comment thread src/main/java/sc/fiji/ome/zarr/pyramid/DefaultPyramidal5DImageData.java Outdated
Comment thread src/main/java/sc/fiji/ome/zarr/pyramid/OpenInBDVCommand.java Outdated
Comment thread src/main/java/sc/fiji/ome/zarr/util/ZarrOpenActions.java Outdated
Comment thread src/main/java/sc/fiji/ome/zarr/util/ZarrOpenActions.java Outdated
Comment thread src/main/java/sc/fiji/ome/zarr/util/ZarrOpenActions.java
Comment thread src/main/java/sc/fiji/ome/zarr/util/ZarrOpenActions.java Outdated
Comment thread src/main/java/sc/fiji/ome/zarr/pyramid/DefaultPyramidal5DImageData.java Outdated
@xulman
Copy link
Copy Markdown
Contributor

xulman commented Mar 3, 2026

Many thanks for the fixes and/or additional explanations of the code.

I would like to kindly ask for one last minor update/addition of a comment, and it's good to go for me then.

@xulman
Copy link
Copy Markdown
Contributor

xulman commented Mar 3, 2026

On the side, and as a result of the discussion in this PR, I have created two issues, #28 and #29, to keep track of the respective topics (after this PR is merged).

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 4, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
73.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@stefanhahmann stefanhahmann merged commit 1ac21ca into main Mar 4, 2026
2 of 3 checks passed
@stefanhahmann stefanhahmann deleted the open-current-image-in-bdv branch March 4, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants