[ITK-dev] image and deformation field physical space check

brian avants stnava at gmail.com
Mon Nov 3 11:40:19 EST 2014


This email is motivated by this issue:

https://github.com/stnava/ANTs/issues/74

but it is not isolated to ants.   Worth a read for additional context.

ITK currently enforces a relatively strict check that image and
displacement fields "occupy the same physical space."  However, for some
unclear (to me) reasons, the direction matrices or origins of images can
lose precision when passing through ITK pipelines ( especially through
resampling or resolution-changing filters ).  This results in filters
aborting and this can occur at various different places in a complex series
of ITK-based operations.

My concern with this is that it can lead to a very severe loss of
productivity when this somewhat unpredictable error occurs.   For instance,
a user downloads a toolkit based on ITK ( itk-snap, ants, elastic,
brainsfit, joint label fusion, etc).   The user expects registration or
segmentation filters to "work well" especially when the data is of a
standard sort.   Then, after some oft-substantial execution time, this
mysterious error appears:

itk::ERROR: ImageToImageFilter(0x7fb3b2307ac0): Inputs do not occupy the
same physical space! <https://github.com/stnava/ANTs/issues/31>

While I am all for correctness, when the impact on productivity exceeds a
certain threshold, I think it is useful to bend the rules a bit.   Perhaps
one of these would improve the situation:

1)    change:

ITKv4/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx

and

ITKv4/Modules/Core/Common/include/itkImageToImageFilter.hxx

changing direction tolerance and coordinate tolerance to 1.e-4

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx#L454-L457

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageToImageFilter.hxx#L40-L41

and change the documentation too:

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageToImageFilter.h#L76-L87
2)  Change the exception to a warning.  This would at least allow complex
pipelines to execute while notifying the user of a possible issue.

3)  Document all of the places that the user/developer should call:

Set/GetCoordinateTolerance  Set/GetDirectionTolerance  .

This last solution would require adding Set/GetCoordinate and Direction
tolerance to:

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.h

as well, for consistency.

Anyway, I raise this issue b/c of the many man and computer hours lost by
this check.

Not once has this check actually helped us, in any measurable way, avoid
errors.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20141103/2428d7bc/attachment.html>


More information about the Insight-developers mailing list