From a0b60c99672bf67b85cb1bfa718166b54e07149d Mon Sep 17 00:00:00 2001 From: Melissa Linkert Date: Wed, 11 Dec 2024 14:15:20 -0600 Subject: [PATCH] Fix time step units, and ignore 0 values --- .../formats-gpl/src/loci/formats/in/OIRReader.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/formats-gpl/src/loci/formats/in/OIRReader.java b/components/formats-gpl/src/loci/formats/in/OIRReader.java index cf175479402..cda84e60ab0 100644 --- a/components/formats-gpl/src/loci/formats/in/OIRReader.java +++ b/components/formats-gpl/src/loci/formats/in/OIRReader.java @@ -36,6 +36,7 @@ import java.util.Objects; import javax.xml.parsers.ParserConfigurationException; +import loci.common.Constants; import loci.common.DataTools; import loci.common.DateTools; import loci.common.Location; @@ -1198,8 +1199,8 @@ private void parseImageProperties(Element root) throws FormatException { // prefer setting tStep from the TIMELAPSE axis, // but fall back to this if needed if (seriesInterval != null && tStep == null) { - // units are seconds, so multiply to get milliseconds - tStep = DataTools.parseDouble(seriesInterval.getTextContent()) * 1000; + // units are expected to be milliseconds + tStep = DataTools.parseDouble(seriesInterval.getTextContent()); } } } @@ -1367,8 +1368,12 @@ private void parseAxis(Element dimensionAxis) { else if (name.equals("TIMELAPSE")) { if (m.sizeT <= 1) { m.sizeT = Integer.parseInt(size.getTextContent()); - tStart = DataTools.parseDouble(start.getTextContent()); - tStep = DataTools.parseDouble(step.getTextContent()); + // units are expected to be seconds, multiply to get milliseconds + tStart = DataTools.parseDouble(start.getTextContent()) * 1000; + double stepValue = DataTools.parseDouble(step.getTextContent()); + if (stepValue > Constants.EPSILON) { + tStep = stepValue * 1000; + } } } else if (name.equals("LAMBDA")) {