Skip to content

Commit e6e5495

Browse files
committed
Flex: Re-introduce runDirs
1 parent daf0916 commit e6e5495

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

components/formats-gpl/src/loci/formats/in/FlexReader.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public class FlexReader extends FormatReader {
135135
private ArrayList<Double> planeExposureTime = new ArrayList<Double>();
136136
private ArrayList<Double> planeDeltaT = new ArrayList<Double>();
137137

138+
private ArrayList<Location> runDirs;
138139
private ArrayList<FlexFile> flexFiles;
139140

140141
private int nFiles = 0;
@@ -376,7 +377,7 @@ public void close(boolean fileOnly) throws IOException {
376377
reverseFileMapping.clear();
377378
dichroicMap.clear();
378379
filterMap.clear();
379-
380+
runDirs = null;
380381
}
381382
}
382383

@@ -390,6 +391,28 @@ protected void initFile(String id) throws FormatException, IOException {
390391
measurementFiles = new ArrayList<String>();
391392
acquisitionDates = new HashMap<Integer, Timestamp>();
392393

394+
Location currentFile = new Location(id).getAbsoluteFile();
395+
Location dir = currentFile.getParentFile();
396+
runDirs = new ArrayList<Location>();
397+
if (!dir.getName().startsWith("Meas_") || !groupPlates()) {
398+
runDirs.add(dir);
399+
}
400+
else {
401+
// look for other acquisitions of the same plate
402+
dir = dir.getParentFile();
403+
String[] parentDirs = dir.list(true);
404+
Arrays.sort(parentDirs);
405+
for (String d : parentDirs) {
406+
Location f = new Location(dir.getAbsoluteFile(), d);
407+
if (f.isDirectory() && d.startsWith("Meas_")) {
408+
runDirs.add(f);
409+
}
410+
}
411+
}
412+
413+
runCount = runDirs.size();
414+
if (runCount == 0) runCount = 1;
415+
393416
if (checkSuffix(id, FLEX_SUFFIX)) {
394417
initFlexFile(id);
395418
}

0 commit comments

Comments
 (0)