<div dir="ltr"><div><div class="gmail_signature"><div>This email is motivated by this issue:</div><div><br></div><div><a href="https://github.com/stnava/ANTs/issues/74">https://github.com/stnava/ANTs/issues/74</a><br></div><div><br></div><div>but it is not isolated to ants.   Worth a read for additional context.</div><div><br></div><div>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.   </div><div><br></div><div>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:</div><div><br></div><div><h3 class="" style="margin-top:0px;margin-bottom:0px;line-height:1.2;font-size:16px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol'"><a href="https://github.com/stnava/ANTs/issues/31" class="" style="color:rgb(51,51,51);text-decoration:none;background:transparent">itk::ERROR: ImageToImageFilter(0x7fb3b2307ac0): Inputs do not occupy the same physical space!</a></h3></div><div><br></div><div>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:</div><div><br></div><div>1)   <span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;font-size:13.63636302948px;line-height:20.3636360168457px"> </span><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;font-size:13.63636302948px;line-height:20.3636360168457px">change:</span></div><div><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;font-size:13.63636302948px;line-height:20.3636360168457px"><br></span></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;font-size:13.63636302948px;line-height:20.3636360168457px">ITKv4/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;font-size:13.63636302948px;line-height:20.3636360168457px">and</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;font-size:13.63636302948px;line-height:20.3636360168457px">ITKv4/Modules/Core/Common/include/itkImageToImageFilter.hxx</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;font-size:13.63636302948px;line-height:20.3636360168457px">changing direction tolerance and coordinate tolerance to 1.e-4</p><p style="margin-top:0px;margin-bottom:16px"><font color="#333333" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif"><span style="line-height:20.3636360168457px"><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx#L454-L457">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx#L454-L457</a></span></font><br></p><p style="margin-top:0px;margin-bottom:16px"><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageToImageFilter.hxx#L40-L41">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageToImageFilter.hxx#L40-L41</a><br></p><p style="margin-top:0px;margin-bottom:16px">and change the documentation too:</p><p style="margin-top:0px;margin-bottom:16px"><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageToImageFilter.h#L76-L87">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageToImageFilter.h#L76-L87</a><br></p><div>2)  Change the exception to a warning.  This would at least allow complex pipelines to execute while notifying the user of a possible issue.</div><div><br></div><div>3)  Document all of the places that the user/developer should call:</div><div><br></div><div><span style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:11.8181819915771px;font-style:italic;line-height:15.27272605896px;white-space:pre;background-color:rgb(248,238,199)">Set/GetCoordinateTolerance</span>  <span style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:11.8181819915771px;font-style:italic;line-height:15.27272605896px;white-space:pre;background-color:rgb(248,238,199)">Set/GetDirectionTolerance</span>  .</div><div><br></div><div>This last solution would require adding Set/GetCoordinate and Direction tolerance to:</div><div><br></div><div><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.h">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.h</a><br></div><div><br></div><div>as well, for consistency. </div><div><br></div><div>Anyway, I raise this issue b/c of the many man and computer hours lost by this check.</div><div><br></div><div>Not once has this check actually helped us, in any measurable way, avoid errors.</div><div><br></div><div><br></div></div></div>
</div>