[Insight-users] a problem to invoke a transform for a LandmarkSpatialObject

kurt kurtzhao at yeah.net
Tue May 16 12:07:47 EDT 2006


Hi Everbody,

Sorry to send it again. The same problem was sent to the list at the night on last Friday. Bad timing....

I tried to updated my ITK, but the transfromation is still not changed....

Thanks a lot!

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]16



More information about the Insight-users mailing list