[Insight-developers] itk::ImageBase::TransformIndexToPhysicalPoint/TransformPointToContinuousIndex ignores spacing?

kent williams norman-k-williams at uiowa.edu
Tue Mar 17 12:43:38 EDT 2009


I put my simple test program, plus my modified itkWarpImageFilter files
here:

http://www.cornwarning.com/xfer/warptest.tar.gz

And yes I'm definitely using TransformIndexToPhysicalPoint on the output
image, and then trying to use TransformPhysicalPointToContinuousIndex on the
deformation field.




On 3/17/09 11:08 AM, "Luis Ibanez" <luis.ibanez at kitware.com> wrote:

> 
> Hi Kent,
> 
> May it be that you are mixing up expectations between the methods:
> 
> 
>     TransformIndexToPhysicalPoint             and
>     TransformContinuousIndexToPhysicalPoint ?
> 
> 
> as well as
> 
> 
>     TransfromPhysicalPointToIndex             and
>     TransformPhysicalPointToContinuousIndex ?
> 
> 
> Can you post to the list the actual computation that led to you
> think that spacing is not being taken into account ?
> 
> 
>      Thanks,
> 
> 
>          Luis
> 
> 
> --------------------------
> kent williams wrote:
>> It looks like I'm going to have to roll my own functions to go between
>> indices and points for the WarpImageFilter because this doesn't work:
>> 
>> while( !outputIt.IsAtEnd() )
>>  {
>>   // get the output image index
>>   index = outputIt.GetIndex();
>>   outputPtr->TransformIndexToPhysicalPoint( index, point );
>> 
>>   typename DeformationFieldInterpolatorType::ContinuousIndexType defIndex;
>>   fieldPtr->TransformPhysicalPointToContinuousIndex(point,defIndex);
>>   if(!m_DeformationFieldInterpolator->IsInsideBuffer(defIndex))
>>     {
>>     itkExceptionMacro(<< "Output location outsde DeformationField"
>>                       " Buffer" << point);
>>     }
>>     // get the required displacement
>>     displacement =
>>     m_DeformationFieldInterpolator->EvaluateAtContinuousIndex(defIndex);
>>     // stuff removed
>>   }
>> 
>> What I thought would happen (and what the function names seem to imply) is
>> that given an IJK index into an image volume, you could get a world
>> coordinate system point corresponding to that index.
>> 
>> And conversely, given a point in the WCS, you can retrieve a corresponding
>> continuous index.
>> 
>> The problem? These functions don't take spacing into account; so the names
>> of the functions are false advertising.  So calling
>> TransformPhysicalPointToContinuousIndex with physical point in the output
>> image doesn't return a continuous index inside the Deformation Field.
>> 
>> In the particular test I'm working on, the output image has a size of
>> 16x16x16 and spacing of 1MM, the deformation field has a size of 8x8x8 and
>> spacing of 2MM. 
>> 
>> Since this behavior has been written in stone for years I don't imagine it
>> will be changed.  But it's a bit disappointing to me.
>> 
>> Is there a way to use the existing ITK physical point/index stuff that takes
>> spacing into account?
>> 
>> 
>> 
>> Notice: This UI Health Care e-mail (including attachments) is covered by the
>> Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential
>> and may be legally privileged.  If you are not the intended recipient, you
>> are hereby notified that any retention, dissemination, distribution, or
>> copying of this communication is strictly prohibited.  Please reply to the
>> sender that you have received the message in error, then delete it.  Thank
>> you.
>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>> 



More information about the Insight-developers mailing list