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

kent williams norman-k-williams at uiowa.edu
Tue Mar 17 11:56:33 EDT 2009


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.



More information about the Insight-developers mailing list