Skip to content

Commit

Permalink
improve exception message for missing h5 dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
trautmane committed Oct 14, 2024
1 parent bf6b372 commit 33b3aa3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ public ImageProcessor load(final String urlString)

final N5Reader reader = buildReader(basePath);
final DatasetAttributes datasetAttributes = reader.getDatasetAttributes(dataSet);

if (datasetAttributes == null) {
throw new IllegalArgumentException("attributes not found for dataset '" + dataSet + "' in '" + urlString + "'");
}

final DataType dataType = datasetAttributes.getDataType();
final long[] dimensions = datasetAttributes.getDimensions();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@ public void testLoad() {

public static void main(final String[] args) {
final HDF5SliceLoader loader = new HDF5SliceLoader();
final ImageProcessor ip = loader.load("file:///nrs/cellmap/data/aic_desmosome-2/raw/Gemini450-0113/2021/01/27/02/Gemini450-0113_21-01-27_025406.raw-archive.h5?dataSet=/0-0-0/c0");
System.out.println(ip);

final String basePath = "/nrs/cellmap/data/jrc_mus-cerebellum-3/align";
final String[] relPaths = {
"/Merlin-6262/2024/08/14/12/Merlin-6262_24-08-14_120147.uint8.h5",
"/Merlin-6262/2024/08/14/15/Merlin-6262_24-08-14_155536.uint8.h5"
};
final String dataSet = "?dataSet=/0-1-3/mipmap.0&z=0";

for (final String relPath : relPaths) {
System.out.println("testing " + relPath);
final String urlString = "file://" + basePath + relPath + dataSet;
final ImageProcessor ip = loader.load(urlString);
System.out.println(ip);
}
}
}

0 comments on commit 33b3aa3

Please sign in to comment.