Skip to content

Commit

Permalink
VoxelSize reading in MetaMorph
Browse files Browse the repository at this point in the history
To fix the physical Z size, the difference between the absolute Z
positions will need to be used.
MetaMorph handler already parses the z positions. The physical z size is
then calculated by subtracting the top and bottom values and dividing by
the number of steps.

Ticket details below:
https://trac.openmicroscopy.org/ome/ticket/12977
  • Loading branch information
dgault committed Sep 7, 2015
1 parent dbcc430 commit 880da66
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions components/formats-gpl/src/loci/formats/in/MetamorphReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,32 @@ else if (differentZs) {
if (zDistances != null) {
stepSize = zDistances[0];
}
else {
Vector<Double> zPositions = new Vector<Double>();
Vector<Double> uniqueZ = new Vector<Double>();

for (IFD ifd : ifds) {
String xml = XMLTools.sanitizeXML(ifd.getComment());
XMLTools.parseXML(xml, handler);

zPositions = handler.getZPositions();
for (Double z : zPositions) {
if (!uniqueZ.contains(z)) uniqueZ.add(z);
}
}

if (uniqueZ.size() > 0) {
CoreMetadata ms0 = core.get(0);
if (getSizeZ() == 0) ms0.sizeZ = 1;

Double zRange = zPositions.get(zPositions.size() - 1) - zPositions.get(0);
stepSize = Math.abs(zRange);
if (ms0.sizeZ > 1) {
stepSize /= (ms0.sizeZ - 1);
}
}
}

Length physicalSizeZ = FormatTools.getPhysicalSizeZ(stepSize);
if (physicalSizeZ != null) {
store.setPixelsPhysicalSizeZ(physicalSizeZ, i);
Expand Down

0 comments on commit 880da66

Please sign in to comment.