Commit
vtkImageInterpolator explicitly disallows reslicing of data types that cannot be represented by a double, so Slicer would crash when a volume of this type was loaded. Thie change prevents the crash and generates an error message. I'm not sure there's a better solution at this level of the code, but it would probably make sense for the application to generate a warning when long types of volumes are added to the scene. From: Steve Pieper <pieper@isomics.com> git-svn-id: http://svn.slicer.org/Slicer4/trunk@28563 3bd1e089-480b-0410-8dfb-8563597acbee
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -645,6 +645,18 @@ void vtkMRMLSliceLayerLogic::UpdateImageDisplay() | |
return; | ||
} | ||
|
||
vtkImageData *imageData = this->VolumeNode->GetImageData(); | ||
if (imageData != nullptr && | ||
(imageData->GetScalarType() == VTK_LONG || | ||
imageData->GetScalarType() == VTK_UNSIGNED_LONG || | ||
imageData->GetScalarType() == VTK_LONG_LONG || | ||
imageData->GetScalarType() == VTK_UNSIGNED_LONG_LONG)) | ||
{ | ||
vtkErrorMacro("Reslicing can only be done on types representable as double. Node " << | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pieper
Author
Member
|
||
this->VolumeNode->GetName() << " has image data of type " << imageData->GetScalarTypeAsString()); | ||
return; | ||
} | ||
|
||
vtkMTimeType oldReSliceMTime = this->Reslice->GetMTime(); | ||
vtkMTimeType oldReSliceUVWMTime = this->ResliceUVW->GetMTime(); | ||
vtkMTimeType oldAssign = this->AssignAttributeTensorsToScalars->GetMTime(); | ||
|
3 comments
on commit d596340
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue added here to track: https://issues.slicer.org/view.php?id=4714
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These kind of images are so rare that I think this solution should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An application level notification about why this data isn't rendered and suggestion about how to workaround would be helpful. But it's not in my critical path.
This message is good as a source-code comment but as an error message shown to users something like this could work better:
"Image reslicing is not implemented for 'long' voxel types. Node..."
Users would then understand that it could be doable just currently not implemented. Also, it is less confusing if we don't bring up the possibility to convert to double (it is an internal implementation limitation of the image reslice filter).