<div dir="ltr">just to be clear: it should be called in this way<div><br></div><div><span style="font-family:arial,sans-serif;font-size:12.8000001907349px">reg_subject_deform.sh </span><span style="font-family:arial,sans-serif;font-size:12.8000001907349px">KKI2009-11-t1weighted.nii.gz S10.nii.gz TEST</span><br></div><div><span style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:12.8000001907349px">i could not find an itk test that covers the 3D case of multiple stages ... if someone knows of one, let me know.</span></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div><br></div>brian<br><div><br></div><div><br></div></div></div>
<br><div class="gmail_quote">On Wed, Nov 5, 2014 at 9:25 AM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Brian,<div><br></div><div>This does not look like a simplified test case to illustrate the problem. Also it didn't work for me:</div><div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo">[blowekamp@malawi PhysicalSpaceError]$ ./reg_subject_deform.sh </div><div style="margin:0px;font-size:11px;font-family:Menlo">antsRegistration -d 3 --float 1 -u 1 -w [0.005, 0.995] -z 1 -o [ , deformed.nii.gz ] -r [ , , 1] -t Rigid[0.1] -m MI[ , , 1, 32, Regular, 0.25] -c [200x100x50,1e-8,10] -f 6x4x2 -s 4x3x1vox -t Affine[0.1] -m MI[ , , 1, 32, Regular, 0.25] -c [100x100x50x10,1e-8,10] -f 4x4x2x1 -s 4x2x1x0vox -t SyN[0.2,3,0] -m CC[, , 1, 2] -c [40x50x30,1e-9,10] -f 4x2x1 -s 2x1x0vox</div><div style="margin:0px;font-size:11px;font-family:Menlo">All_Command_lines_OK</div><div style="margin:0px;font-size:11px;font-family:Menlo">Using single precision for computations.</div><div style="margin:0px;font-size:11px;font-family:Menlo"> bad file name </div><div style="margin:0px;font-size:11px;font-family:Menlo">Exception Object caught: </div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">itk::ExceptionObject (0x7fcb90f1ca88)</div><div style="margin:0px;font-size:11px;font-family:Menlo">Location: "virtual void itk::CenteredTransformInitializer<itk::Euler3DTransform<float>, itk::Image<float, 3>, itk::Image<float, 3> >::InitializeTransform() [TTransform = itk::Euler3DTransform<float>, TFixedImage = itk::Image<float, 3>, TMovingImage = itk::Image<float, 3>]" </div><div style="margin:0px;font-size:11px;font-family:Menlo">File: /scratch/blowekamp/build/ANTS/ITKv4-install/include/ITK-4.7/itkCenteredTransformInitializer.hxx</div><div style="margin:0px;font-size:11px;font-family:Menlo">Line: 42</div><div style="margin:0px;font-size:11px;font-family:Menlo">Description: itk::ERROR: CenteredTransformInitializer(0x7fcb90f1c4b0): Fixed Image has not been set</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div></div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">Brad</div><div><div class="h5"><div><br><div><div>On Nov 4, 2014, at 3:37 PM, brian avants <<a href="mailto:stnava@gmail.com" target="_blank">stnava@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">this example exhibits the problematic behavior (CentOS release 6.3 )<div><br></div><div><a href="https://copy.com/6imJcj9ZuAGoQVtG" target="_blank">https://copy.com/6imJcj9ZuAGoQVtG</a><br></div><div><br></div><div><p><span>reg_subject_deform.sh </span>KKI2009-11-t1weighted.nii.gz S10.nii.gz TEST</p><p><br></p>
</div></div><div class="gmail_extra"><br clear="all"><div><div><div><br></div>brian<br><div><br></div><div><br></div></div></div>
<br><div class="gmail_quote">On Tue, Nov 4, 2014 at 9:54 AM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Was it just the DisplacementFieldTransform being the problem or was it other filters in general and randomly?</div><div><br></div>The proposed new variable should be a static member variable of ImageToImageFilter, hence the term global. It would be used to set the value here, instead of a constant [1]. This is similar to the GlobalDefaultNumberOfThreaders, as it effects the initial value for all new filters. The complication is that this base class is templated, and this global need to transcend the templates. A similar things was done with the ImageSource class by adding a second private parent without templates [2], [3]. The complexity there with lazy initialization is not needed for this case, as we just have a simple float. Additionally I have developed a preference for private namespace local statics for this type of case, as it produces a cleaner symbol table for shared libraries.<div><br></div><div>Clearly for the DisplacementField, the tolerance variables should be exposed similarly as done in the ImageToImageFilter. And it could pull the default from the variable from above, however getting the default for a transform from a filter may not make since.<br><div><br></div><div><br></div><div><br></div><div><br></div><div>[1] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageToImageFilter.hxx#L40-L41" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageToImageFilter.hxx#L40-L41</a></div><div>[2] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageSource.h#L50-L87" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageSource.h#L50-L87</a></div><div>[3] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/src/itkImageSource.cxx#L27-L46" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/src/itkImageSource.cxx#L27-L46</a><div><div><br><div><div><br></div><div><br><div><div>On Nov 4, 2014, at 9:28 AM, brian avants <<a href="mailto:stnava@gmail.com" target="_blank">stnava@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">so - just to be clear ... same thing needs to be done here:<div><br></div><div><p style="font-size:13.63636302948px;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;line-height:20.3636360168457px">ITKv4/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.h</p><p style="font-size:13.63636302948px;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;line-height:20.3636360168457px">and how does <span style="font-size:13.3333339691162px;line-height:normal;color:rgb(34,34,34);font-family:arial,sans-serif">Get/</span><span style="font-size:13.3333339691162px;line-height:normal;color:rgb(34,34,34);font-family:arial,sans-serif">SetGlobalDefault differ from </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-wrap;background-color:rgb(248,238,199)">Set/GetCoordinateTolerance</span><span style="font-size:13.3333339691162px;line-height:normal;color:rgb(34,34,34);font-family:arial,sans-serif"> </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-wrap;background-color:rgb(248,238,199)">Set/GetDirectionTolerance</span><span style="font-size:13.3333339691162px;line-height:normal;color:rgb(34,34,34);font-family:arial,sans-serif"> </span></p><p style="font-size:13.63636302948px;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;line-height:20.3636360168457px"><span style="font-size:13.3333339691162px;line-height:normal;color:rgb(34,34,34);font-family:arial,sans-serif">which already exists in the image to image filter (but not displacement field)?</span></p></div></div><div class="gmail_extra"><br clear="all"><div><div><br></div>brian<br><div><br></div><div><br></div></div>
<br><div class="gmail_quote">On Tue, Nov 4, 2014 at 9:26 AM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I agree that would be good.<div><br></div><div>The other thing which can be done concurrently is add the ImageToImageFilter::Get/SetGlobalDefault methods. Any one want to volunteer for that one?</div><div><br></div><div>Brad</div><div><br><div><div>On Nov 4, 2014, at 9:21 AM, brian avants <<a href="mailto:stnava@gmail.com" target="_blank">stnava@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">i guess the next step is to dig up a couple of examples of this behavior and post them somewhere. </div><div class="gmail_extra"><br clear="all"><div><div><br></div>brian<br><div><br></div><div><br></div></div>
<br><div class="gmail_quote">On Tue, Nov 4, 2014 at 9:14 AM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That is a question: why is an exact copy not happening? Is is due to runtime errors or accumulation of errors during IO?<br>
<br>
Brad<br>
<div><br>
<br>
On Nov 4, 2014, at 3:51 AM, <<a href="mailto:M.Staring@lumc.nl" target="_blank">M.Staring@lumc.nl</a>> <<a href="mailto:M.Staring@lumc.nl" target="_blank">M.Staring@lumc.nl</a>> wrote:<br>
<br>
> Hi all,<br>
><br>
> Would it be possible to fix this issue by passing the physical space by reference, or by performing an exact copy?<br>
><br>
> Regards, Marius<br>
><br>
>> -----Original Message-----<br>
>> From: Insight-developers [mailto:<a href="mailto:insight-developers-bounces@itk.org" target="_blank">insight-developers-bounces@itk.org</a>] On<br>
>> Behalf Of Matt McCormick<br>
>> Sent: maandag 3 november 2014 18:39<br>
>> To: brian avants<br>
>> Cc: <a href="mailto:Insight-developers@itk.org" target="_blank">Insight-developers@itk.org</a><br>
>> Subject: Re: [ITK-dev] image and deformation field physical space check<br>
>><br>
>> Hi Brian,<br>
>><br>
>> Thanks for discussing this.<br>
>><br>
>> I think a combination of fixing the underlying issue that is being brought up by<br>
>> the exception, relaxing the tolerance, and improving the documentation is a<br>
>> good approach.<br>
>><br>
>> 2 cents,<br>
>> Matt<br>
>><br>
>> On Mon, Nov 3, 2014 at 11:40 AM, brian avants <<a href="mailto:stnava@gmail.com" target="_blank">stnava@gmail.com</a>> wrote:<br>
>>> This email is motivated by this issue:<br>
>>><br>
>>> <a href="https://github.com/stnava/ANTs/issues/74" target="_blank">https://github.com/stnava/ANTs/issues/74</a><br>
>>><br>
>>> but it is not isolated to ants. Worth a read for additional context.<br>
>>><br>
>>> ITK currently enforces a relatively strict check that image and<br>
>>> displacement fields "occupy the same physical space." However, for<br>
>>> some unclear (to me) reasons, the direction matrices or origins of<br>
>>> images can lose precision when passing through ITK pipelines (<br>
>>> especially through resampling or resolution-changing filters ). This<br>
>>> results in filters aborting and this can occur at various different<br>
>>> places in a complex series of ITK-based operations.<br>
>>><br>
>>> My concern with this is that it can lead to a very severe loss of<br>
>>> productivity when this somewhat unpredictable error occurs. For instance,<br>
>>> a user downloads a toolkit based on ITK ( itk-snap, ants, elastic,<br>
>>> brainsfit, joint label fusion, etc). The user expects registration or<br>
>>> segmentation filters to "work well" especially when the data is of a<br>
>>> standard sort. Then, after some oft-substantial execution time, this<br>
>>> mysterious error appears:<br>
>>><br>
>>> itk::ERROR: ImageToImageFilter(0x7fb3b2307ac0): Inputs do not occupy<br>
>>> the same physical space!<br>
>>><br>
>>><br>
>>> While I am all for correctness, when the impact on productivity exceeds a<br>
>>> certain threshold, I think it is useful to bend the rules a bit. Perhaps<br>
>>> one of these would improve the situation:<br>
>>><br>
>>> 1) change:<br>
>>><br>
>>> ITKv4/Modules/Filtering/DisplacementField/include/itkDisplacementField<br>
>>> Transform.hxx<br>
>>><br>
>>> and<br>
>>><br>
>>> ITKv4/Modules/Core/Common/include/itkImageToImageFilter.hxx<br>
>>><br>
>>> changing direction tolerance and coordinate tolerance to 1.e-4<br>
>>><br>
>>> <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/F" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/F</a><br>
>>> iltering/DisplacementField/include/itkDisplacementFieldTransform.hxx#L<br>
>>> 454-L457<br>
>>><br>
>>> <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/C" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/C</a><br>
>>> ore/Common/include/itkImageToImageFilter.hxx#L40-L41<br>
>>><br>
>>> and change the documentation too:<br>
>>><br>
>>> <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/C" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/C</a><br>
>>> ore/Common/include/itkImageToImageFilter.h#L76-L87<br>
>>><br>
>>> 2) Change the exception to a warning. This would at least allow<br>
>>> complex pipelines to execute while notifying the user of a possible issue.<br>
>>><br>
>>> 3) Document all of the places that the user/developer should call:<br>
>>><br>
>>> Set/GetCoordinateTolerance Set/GetDirectionTolerance .<br>
>>><br>
>>> This last solution would require adding Set/GetCoordinate and<br>
>>> Direction tolerance to:<br>
>>><br>
>>> <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/F" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/F</a><br>
>>> iltering/DisplacementField/include/itkDisplacementFieldTransform.h<br>
>>><br>
>>> as well, for consistency.<br>
>>><br>
>>> Anyway, I raise this issue b/c of the many man and computer hours lost<br>
>>> by this check.<br>
>>><br>
>>> Not once has this check actually helped us, in any measurable way,<br>
>>> avoid errors.<br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
>>><br>
>>> Visit other Kitware open-source projects at<br>
>>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>><br>
>>> Kitware offers ITK Training Courses, for more information visit:<br>
>>> <a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br>
>>><br>
>>> Please keep messages on-topic and check the ITK FAQ at:<br>
>>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>><br>
>>> Follow this link to subscribe/unsubscribe:<br>
>>> <a href="http://public.kitware.com/mailman/listinfo/insight-developers" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br>
>>><br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Kitware offers ITK Training Courses, for more information visit:<br>
>> <a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br>
>><br>
>> Please keep messages on-topic and check the ITK FAQ at:<br>
>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://public.kitware.com/mailman/listinfo/insight-developers" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-developers" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br>
<br>
</div></blockquote></div><br></div>
</blockquote></div><br></div></div></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div></div></div></div></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div></blockquote></div><br></div>