saalfeldlab / n5-ij

ImageJ convenience layer for N5
BSD 2-Clause "Simplified" License
14 stars 8 forks source link

Invalid path in Import > HDF5/N5/Zarr/OME-NGFF ... crop dialog #78

Closed minnerbe closed 3 months ago

minnerbe commented 4 months ago

Problem

When opening an N5 dataset with the Import > HDF5/N5/Zarr/OME-NGFF ... dialog, it is possible to specify a subfolder of an N5 container rather than the base path. E.g., in the following N5 container, specifying base.n5/grp instead of base.n5 to detect the dataset data.

base.n5/
├── attributes.json
└── grp
    └── data

This is convenient, since dataset detection from the root can take some time if the container contains a large hierarchy.

However, if the crop checkbox is checked, the string which is automatically inserted into the N5 path field of the crop dialog duplicates parts of the paths within the N5 container: instead of base.n5/grp/data it is base.n5/grp/grp/data when base.n5/grp is used in the import dialog. This leads to the following error:

not a dataset : base.n5/grp/grp/data

Workaround

Since the string in the crop dialog can be edited, one can simply fix it manually (which is a bit inconvenient since the field is too small to do this efficiently).

Suggested fix

It seems to me that getN5RootPath() in ui/DatasetSelectorDialog.java does not return the N5 root path but simply the string in the text field of the import dialog. Returning the actual N5 root there would probably fix the problem.

bogovicj commented 4 months ago

Thanks for reporting this @minnerbe ,

There's a chance this is fixed in the current snapshot version (there's quite a bit of refactoring having to do with input parsing / root path handling), but I'll check and address this if not.

bogovicj commented 3 months ago

When I test this with the current code, macros are recorded correctly, I expect this issue was fixed by https://github.com/saalfeldlab/n5-ij/commit/b4db01286d0a5c17ad5743297546ced2e41ddb68 Thanks again!