Skip to content

Commit

Permalink
Fix time step units, and ignore 0 values
Browse files Browse the repository at this point in the history
  • Loading branch information
melissalinkert committed Dec 11, 2024
1 parent 68b8e17 commit a0b60c9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions components/formats-gpl/src/loci/formats/in/OIRReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}
}
Expand Down Expand Up @@ -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")) {
Expand Down

0 comments on commit a0b60c9

Please sign in to comment.