[Insight-users] Transforming points after registration

Brecht Heyde Brecht.Heyde at med.kuleuven.be
Fri Jan 14 11:25:38 EST 2011


Dear members,

Deforming the moving image to the space of the fixed image to get a deformed moving image (as is done in the optimization while evaluating the image similarity metric) is straightforward by using the itk::ResampleImageFilter.

Now, I would like to know how points in a fixed image, given these transformparameters of the transform T, get mapped by T into the moving image.
I couldn't directly find code in the manual that shows this, but I assume I must initialize a transform with the finalParameters and use the method TransformPoint().
I was wondering how I should efficiently implement this if I would like to know how a lot of points (>10.000) are mapped onto a moving image.

By means of some example code:
Once a given registration is finished it's final transformation parameters can be found by using:
---------------
//code...
typedef ImageRegistrationMethod<FixedImageType,MovingImageType> registration
//code that performs the registration
typedef registration::ParametersType ParametersType;
ParametersType finalParameters = registration->GetLastTransformParameters();
---------------

So far I have put them inside a PointsContainer of a PointSet, and by accessing each point individually calling the TransformPoint() method. Are there alternatives?
---------------
//code fragment

  typedef itk::PointSet<FixedImageType::PointType, 2> PointSetType;
  typedef PointSetType::PointsContainer PointsContainerType;
  typedef PointSetType::PointType PointType;

  PointsContainerType::Pointer pointsContainer = PointsContainerType::New();
  PointType p0, p1;
  p0[0] = 10; p0[1] = 15;
  p1[0] = 20; p1[1] = 18;
  unsigned int pointId = 0;
  pointsContainer->InsertElement(pointId++,p0);
  pointsContainer->InsertElement(pointId++,p1);
  //add more points (read from file eventually...)
  
  typedef PointsContainerType::Iterator IteratorType;

  IteratorType iterator = pointsContainer->Begin();
  IteratorType iteratorEnd = pointsContainer->End();

  while(iterator != iteratorEnd){
	  PointType pointIn = iterator.Value();
      PointType pointOut = forwardTransform->TransformPoint(pointIn);
	  std::cout << pointIn << ", " << pointOut << std::endl;
	  iterator++;
  };
------------------

Moreover, I would like to add a label to each of these points describing a tissueposition (e.g. anterior/posterior) and also the timeinstance. What container would allow me to do this?

Thanks in advance,
Brecht Heyde


More information about the Insight-users mailing list