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

Julien Jomier julien.jomier at kitware.com
Tue May 16 12:57:04 EDT 2006


Hi Kurt,

The transforms of the SpatialObjects *do not* modify the position of the
internal points.

You should apply the transform to the corresponding point.
Something like:

TransformedPoint =
landmark->GetObjectToWorldTransform()->TransformPoint((*itLandmark).GetPosition());

Hope that helps,

Julien

kurt wrote:
> 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
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 



More information about the Insight-users mailing list