[ITK-users] applying transform to point

Hammond, Emily M emily-hammond at uiowa.edu
Mon Feb 2 15:53:54 EST 2015


Hello all,

Here is the flow of my program.

1. read in fiducial points noted with Slicer (to my understanding to get from Slicer to ITK, invert the first two coordinates)
2. read in transform from files with TransformFileReaderTemplate class. This reads in the transforms as a list and I can add multiple transforms to the list.
3. apply the transforms in the list (in order) to the fiducials using the TransformPoint method for each transform. Here is the code I am using to apply the transforms.

// create iterator to parse through the transform list
TransformListType::const_iterator itTrans = this->m_TransformList.begin();
for(; itTrans != this->m_TransformList.end(); itTrans++ )
{
// determine what type of transform it is
if( !strcmp( (*itTrans)->GetNameOfClass(), "AffineTransform" ) )
{
// extract transform
AffineTransformType::Pointer affineTrans = static_cast< AffineTransformType * >( (*itTrans).GetPointer() );

// apply to landmarks
LandmarksType::const_iterator itLM = this->m_TransformedMovingLandmarks.begin();
for(; itLM != this->m_TransformedMovingLandmarks.end(); itLM++ )
{
this->m_TransformedMovingLandmarks[ itLM->first ] = affineTrans->TransformPoint( itLM->second );
}
}
else if( !strcmp( (*itTrans)->GetNameOfClass(), "BSplineTransform" ) )
{
// extract transforms
BSplineTransformType::Pointer bsplineTrans = static_cast< BSplineTransformType * >( (*itTrans).GetPointer() );

// apply to landmarks
LandmarksType::const_iterator itLM = this->m_TransformedMovingLandmarks.begin();
for(; itLM != this->m_TransformedMovingLandmarks.end(); itLM++ )
{
this->m_TransformedMovingLandmarks[ itLM->first ] = bsplineTrans->TransformPoint( itLM->second );
}
}
else
{
std::cerr << "TransformType is not recognized." << std::endl;
}
}

NOTE: m_TransformedMovingList is initialized to the original read in fiducial list

4. read out the transform fiducials (invert first two coordinates for observation in Slicer purposes)
5. Compare the results using Slicer

Problem: This method works just fine with scaling and translation transforms (given the last coordinate is inverted instead of the first two -> first question), however, once rotation (and shearing) is applied the result is wrong. Can anyone give some insight? I'm assuming there is some coordinate system conversion that needs to take place on the transform.

Thanks!
Emily Hammond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150202/72ae3d27/attachment.html>


More information about the Insight-users mailing list