Skip to content

Commit

Permalink
Flex: Re-introduce runDirs
Browse files Browse the repository at this point in the history
  • Loading branch information
dgault committed May 8, 2024
1 parent daf0916 commit e6e5495
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion components/formats-gpl/src/loci/formats/in/FlexReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public class FlexReader extends FormatReader {
private ArrayList<Double> planeExposureTime = new ArrayList<Double>();
private ArrayList<Double> planeDeltaT = new ArrayList<Double>();

private ArrayList<Location> runDirs;
private ArrayList<FlexFile> flexFiles;

private int nFiles = 0;
Expand Down Expand Up @@ -376,7 +377,7 @@ public void close(boolean fileOnly) throws IOException {
reverseFileMapping.clear();
dichroicMap.clear();
filterMap.clear();

runDirs = null;
}
}

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

Location currentFile = new Location(id).getAbsoluteFile();
Location dir = currentFile.getParentFile();
runDirs = new ArrayList<Location>();
if (!dir.getName().startsWith("Meas_") || !groupPlates()) {
runDirs.add(dir);
}
else {
// look for other acquisitions of the same plate
dir = dir.getParentFile();
String[] parentDirs = dir.list(true);
Arrays.sort(parentDirs);
for (String d : parentDirs) {
Location f = new Location(dir.getAbsoluteFile(), d);
if (f.isDirectory() && d.startsWith("Meas_")) {
runDirs.add(f);
}
}
}

runCount = runDirs.size();
if (runCount == 0) runCount = 1;

if (checkSuffix(id, FLEX_SUFFIX)) {
initFlexFile(id);
}
Expand Down

0 comments on commit e6e5495

Please sign in to comment.