Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect VoxelSize in MetaMorph Reader #1966

Merged
merged 4 commits into from
Sep 30, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An ArrayList would suffice unless you need thread synchronization.


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