@@ -135,6 +135,7 @@ public class FlexReader extends FormatReader {
135
135
private ArrayList <Double > planeExposureTime = new ArrayList <Double >();
136
136
private ArrayList <Double > planeDeltaT = new ArrayList <Double >();
137
137
138
+ private ArrayList <Location > runDirs ;
138
139
private ArrayList <FlexFile > flexFiles ;
139
140
140
141
private int nFiles = 0 ;
@@ -376,7 +377,7 @@ public void close(boolean fileOnly) throws IOException {
376
377
reverseFileMapping .clear ();
377
378
dichroicMap .clear ();
378
379
filterMap .clear ();
379
-
380
+ runDirs = null ;
380
381
}
381
382
}
382
383
@@ -390,6 +391,28 @@ protected void initFile(String id) throws FormatException, IOException {
390
391
measurementFiles = new ArrayList <String >();
391
392
acquisitionDates = new HashMap <Integer , Timestamp >();
392
393
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
+
393
416
if (checkSuffix (id , FLEX_SUFFIX )) {
394
417
initFlexFile (id );
395
418
}
0 commit comments