[Insight-users] how to invoke a transform for a
LandMarkSpatialObject?
kurt
kurtzhao at yeah.net
Fri May 12 17:33:30 EDT 2006
Hi,
I have a problem to invoke a transform for a LandmarkSpatialObject. I transform has been modified. I tried both
landmark -> ComputeObjectToParentTransform ( ) ;
landmark -> ComputeObjectToWorldTransform ( ) ;
neither worked.
any input will be appreciated!
Best Regards
Kurt Zhao
typedef itk::LandmarkSpatialObject<2> LandmarkType;
typedef LandmarkType::Pointer LandmarkPointer;
typedef itk::SpatialObjectPoint<2> LandmarkPointType;
LandmarkPointer landmark = LandmarkType::New();
landmark->SetPoints(list);
double translation [ 2 ] ;
translation [ 0 ] = 5 ;
translation [ 1 ] = 10 ;
landmark -> GetObjectToWorldTransform ( ) -> SetTranslation ( translation ) ;
landmark -> GetObjectToWorldTransform ( ) -> Print ( std::cout ) ;
landmark -> ComputeObjectToParentTransform ( ) ;
//landmark -> ComputeObjectToWorldTransform ( ) ;
unsigned int nPoints = landmark->GetPoints().size();
LandmarkType::PointListType::const_iterator itLandmark = landmark->GetPoints().begin();
while(itLandmark != landmark->GetPoints().end())
{
Image2DType::IndexType index;
index[0] = (unsigned long) (*itLandmark).GetPosition()[0];
index[1] = (unsigned long) (*itLandmark).GetPosition()[1];
std::cout << "Kurt after: " << index << std::endl;
itLandmark++;
}
The output:
Kurt before: [31, 94]
ScalableAffineTransform (0158B790)
RTTI typeinfo: class itk::ScalableAffineTransform<double,2>
Reference Count: 1
Modified Time: 547
Debug: Off
Observers:
none
Matrix:
1 0
0 1
Offset: [5, 10]
Center: [0, 0]
Translation: [5, 10]
Inverse:
1 0
0 1
Singular: 0
Scale : 1 1
MatrixScale : 1 1
Kurt after: [31, 94]
More information about the Insight-users
mailing list