From 5de98043113904470edef1b97884040d386928a9 Mon Sep 17 00:00:00 2001 From: karlduderstadt Date: Thu, 2 Nov 2023 15:16:17 +0100 Subject: [PATCH] MarsMicromanagerFormat: add hasPlane position method This changes translation so the local file locations are not used. Instead, planes are determined by what is in the metadata.txt file. --- .../mars/scifio/MarsMicromanagerFormat.java | 9 +++++++++ .../mars/scifio/MarsMicromanagerTranslator.java | 16 ++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/mpg/biochem/mars/scifio/MarsMicromanagerFormat.java b/src/main/java/de/mpg/biochem/mars/scifio/MarsMicromanagerFormat.java index 5083e9b..aa717fe 100644 --- a/src/main/java/de/mpg/biochem/mars/scifio/MarsMicromanagerFormat.java +++ b/src/main/java/de/mpg/biochem/mars/scifio/MarsMicromanagerFormat.java @@ -1490,6 +1490,15 @@ public Location getLocation(final Metadata meta, final int imageIndex, } //DROP-IN + public boolean hasPlane(final Metadata meta, final int imageIndex, + final long planeIndex) + { + final long[] zct = FormatTools.rasterToPosition(imageIndex, planeIndex, + meta, Index.expectedAxes); + + return planeToMetaTable.containsKey("MPlane-" + imageIndex + "-" + zct[0] + "-" + zct[1] + "-" + zct[2]); + } + public Map getPlaneMap(final Metadata meta, final int imageIndex, final long planeIndex) { diff --git a/src/main/java/de/mpg/biochem/mars/scifio/MarsMicromanagerTranslator.java b/src/main/java/de/mpg/biochem/mars/scifio/MarsMicromanagerTranslator.java index c17668e..9f2bf68 100644 --- a/src/main/java/de/mpg/biochem/mars/scifio/MarsMicromanagerTranslator.java +++ b/src/main/java/de/mpg/biochem/mars/scifio/MarsMicromanagerTranslator.java @@ -183,19 +183,11 @@ private void populateMetadata(final Metadata meta, store.setPlaneExposureTime(new Time(p.exposureTime, UNITS.SECOND), i, q); - boolean fullPlane = true; - if (positions.get(i).tiffs != null) { - //Check if the tiff file exists. If a sparse collection was performed some planes - //may not have been collected. In that case, add empty placeholder plane data - final Location tiff = positions.get(i).getLocation(meta, i, q); - if (tiff != null && dataHandleService.exists(tiff)) fullPlane = true; - else fullPlane = false; - } - //If tiffs is null, there was no access to the original files when processing the metadata.txt - //In this case, full plane information is included for all possible planes. - ArrayList planeParameterList = new ArrayList(); - if (fullPlane) { + + //Check if the plane exists. If a sparse collection was performed some planes + //may not have been collected. + if (positions.get(i).hasPlane(meta, i, q)) { if (nextStamp < p.timestamps.length) store.setPlaneDeltaT(new Time(p.timestamps[nextStamp++], UNITS.SECOND), i, q);