From 264ff1ecec79ce19067fe43c7db9ded0ff94de1d Mon Sep 17 00:00:00 2001 From: David Gault Date: Thu, 2 May 2024 19:04:02 +0100 Subject: [PATCH] Flex: Remove runDirs --- .../src/loci/formats/in/FlexReader.java | 48 ++----------------- 1 file changed, 5 insertions(+), 43 deletions(-) diff --git a/components/formats-gpl/src/loci/formats/in/FlexReader.java b/components/formats-gpl/src/loci/formats/in/FlexReader.java index 3f5f985161d..a967991b24b 100644 --- a/components/formats-gpl/src/loci/formats/in/FlexReader.java +++ b/components/formats-gpl/src/loci/formats/in/FlexReader.java @@ -135,7 +135,6 @@ public class FlexReader extends FormatReader { private ArrayList planeExposureTime = new ArrayList(); private ArrayList planeDeltaT = new ArrayList(); - private ArrayList runDirs; private ArrayList flexFiles; private int nFiles = 0; @@ -377,7 +376,7 @@ public void close(boolean fileOnly) throws IOException { reverseFileMapping.clear(); dichroicMap.clear(); filterMap.clear(); - runDirs = null; + } } @@ -391,28 +390,6 @@ protected void initFile(String id) throws FormatException, IOException { measurementFiles = new ArrayList(); acquisitionDates = new HashMap(); - Location currentFile = new Location(id).getAbsoluteFile(); - Location dir = currentFile.getParentFile(); - runDirs = new ArrayList(); - 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); } @@ -558,17 +535,16 @@ private void initFlexFile(String id) throws FormatException, IOException { if (doGrouping) { // group together .flex files that are in the same directory - for (Location runDir : runDirs) { - String[] files = runDir.list(true); + Location dir = currentFile.getParentFile(); + String[] files = dir.list(true); for (String file : files) { // file names should be nnnnnnnnn.flex, where 'n' is 0-9 LOGGER.debug("Checking if {} belongs in the same dataset.", file); if (file.endsWith(".flex") && file.length() == 14) { - flex.add(new Location(runDir, file).getAbsolutePath()); + flex.add(new Location(dir, file).getAbsolutePath()); LOGGER.debug("Added {} to dataset.", flex.get(flex.size() - 1)); } - } } } @@ -605,18 +581,6 @@ private void populateMetadataStore(MetadataStore store) throws FormatException String plateAcqID = MetadataTools.createLSID("PlateAcquisition", 0, run); store.setPlateAcquisitionID(plateAcqID, 0, run); - String acqName = runDirs.get(run).getName(); - store.setPlateAcquisitionName(acqName, 0, run); - - int timeStart = acqName.indexOf("("); - if (timeStart > 0) { - String time = acqName.substring(timeStart); - time = DateTools.formatDate(time, "(yyyy-MM-dd_HH-mm-ss)"); - - store.setPlateAcquisitionStartTime(new Timestamp(time), 0, run); - plateAcqStartTime = null; - } - PositiveInteger maxFieldCount = FormatTools.getMaxFieldCount(fieldCount); if (maxFieldCount != null) { store.setPlateAcquisitionMaximumFieldCount(maxFieldCount, 0, run); @@ -1419,9 +1383,7 @@ private void groupFiles(String[] fileList, MetadataStore store) file.column = col; file.field = field % (nFiles / runCount); file.file = files.get(field); - file.acquisition = (runDirs == null || runDirs.size() == 0) ? 0: - runDirs.indexOf(new Location(file.file).getParentFile()); - + if (file.file == null) { continue; }