[ITK] [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/community/attachments/20150202/72ae3d27/attachment.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
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://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list