diff --git a/src/main/java/de/mpg/biochem/mars/n5/commands/MarsOpenN5asImagePlusCommand.java b/src/main/java/de/mpg/biochem/mars/n5/commands/MarsOpenN5asImagePlusCommand.java index c822a45..46a17b3 100644 --- a/src/main/java/de/mpg/biochem/mars/n5/commands/MarsOpenN5asImagePlusCommand.java +++ b/src/main/java/de/mpg/biochem/mars/n5/commands/MarsOpenN5asImagePlusCommand.java @@ -170,8 +170,8 @@ public void run() { parser.populateMetadata(jsonData, source, source, false); source.populateImageMetadata(); - Dataset dataset = getImage(n5, datasetMeta, source, selectionDialog.isVirtual()); - dataset.setSource(rootPath + datasetPath); + Dataset dataset = getImage(n5, datasetMeta, source, datasetPath, selectionDialog.isVirtual()); + dataset.setSource(rootPath + (datasetPath.startsWith("/") ? datasetPath.substring(1) : datasetPath)); uiService.show(dataset); } catch (final IOException e) { IJ.error("failed to read n5"); @@ -184,7 +184,7 @@ public void run() { } @SuppressWarnings({"rawtypes", "unchecked"}) - private & NativeType> Dataset getImage(final N5Reader n5, final N5DatasetMetadata datasetMeta, final Metadata metadata, final boolean asVirtual) { + private & NativeType> Dataset getImage(final N5Reader n5, final N5DatasetMetadata datasetMeta, final Metadata metadata, final String datasetPath, final boolean asVirtual) { ExecutorService exec = Executors.newFixedThreadPool(8); final CachedCellImg imgRaw = N5Utils.open(n5, datasetMeta.getPath()); @@ -208,7 +208,7 @@ private & NativeType> Dataset getImage(final N5Read img = planarImg; } - final SCIFIOImgPlus imgPlus = new SCIFIOImgPlus(img, datasetMeta.getName(), axes); + final SCIFIOImgPlus imgPlus = new SCIFIOImgPlus(img, datasetPath.startsWith("/") ? datasetPath.substring(1) : datasetPath, axes); imgPlus.setMetadata(metadata); imgPlus.setImageMetadata(metadata.get(0));