Commit 57fcba2d authored by Declara Denis's avatar Declara Denis Committed by Christian Schulte zu Berge
Browse files

Small OpenIgtlink fixes

* OpenIGTLink processor now is robust against missing voxel size in image
  packet.
parent 543f0a26
......@@ -3,7 +3,7 @@
# Set module status (valid values are STABLE, TESTING and EXPERIMENTAL)
SET(ThisModStatus EXPERIMENTAL)
# Set whether this module has external dependencies that are not shipped this CAMPVis.
# Set whether this module has external dependencies that are not shipped with CAMPVis.
SET(ThisModExternalDependencies TRUE)
# The files and assignments need only to be parsed if the module is enabled
......
......@@ -154,9 +154,15 @@ namespace campvis {
imageMessage->GetSpacing(voxelSize.elem);
imageMessage->GetDimensions(size_i.elem);
cgt::svec3 size(size_i);
cgt::svec3 size(size_i);
imageMessage->GetOrigin(imageOffset.elem);
// If the voxel size boundled with the packet is practically 0.0f, make it 1.0f
// this makes sure we don't get invalid mapping informations (non invertable matrix)
if (minElem(voxelSize) <= 1e-10f) {
voxelSize = 1.0f;
}
size_t dimensionality = (size_i[2] == 1) ? ((size_i[1] == 1) ? 1 : 2) : 3;
ImageData* image = new ImageData(dimensionality, size, wtp._numChannels);
ImageRepresentationLocal::create(image, wtp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment