Skip to content

Commit a0b60c9

Browse files
Fix time step units, and ignore 0 values
1 parent 68b8e17 commit a0b60c9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import java.util.Objects;
3737
import javax.xml.parsers.ParserConfigurationException;
3838

39+
import loci.common.Constants;
3940
import loci.common.DataTools;
4041
import loci.common.DateTools;
4142
import loci.common.Location;
@@ -1198,8 +1199,8 @@ private void parseImageProperties(Element root) throws FormatException {
11981199
// prefer setting tStep from the TIMELAPSE axis,
11991200
// but fall back to this if needed
12001201
if (seriesInterval != null && tStep == null) {
1201-
// units are seconds, so multiply to get milliseconds
1202-
tStep = DataTools.parseDouble(seriesInterval.getTextContent()) * 1000;
1202+
// units are expected to be milliseconds
1203+
tStep = DataTools.parseDouble(seriesInterval.getTextContent());
12031204
}
12041205
}
12051206
}
@@ -1367,8 +1368,12 @@ private void parseAxis(Element dimensionAxis) {
13671368
else if (name.equals("TIMELAPSE")) {
13681369
if (m.sizeT <= 1) {
13691370
m.sizeT = Integer.parseInt(size.getTextContent());
1370-
tStart = DataTools.parseDouble(start.getTextContent());
1371-
tStep = DataTools.parseDouble(step.getTextContent());
1371+
// units are expected to be seconds, multiply to get milliseconds
1372+
tStart = DataTools.parseDouble(start.getTextContent()) * 1000;
1373+
double stepValue = DataTools.parseDouble(step.getTextContent());
1374+
if (stepValue > Constants.EPSILON) {
1375+
tStep = stepValue * 1000;
1376+
}
13721377
}
13731378
}
13741379
else if (name.equals("LAMBDA")) {

0 commit comments

Comments
 (0)