[Insight-users] Need help with LandmarkInitializer

Andinet Enquobahrie andinet.enqu at kitware.com
Sat Apr 28 16:59:47 EDT 2007


Hi Evelyn,

There is a "LandmarkPointContainer" and " LandmarkPointType" data types  
defined in the API that you
can use. For example for the fixed landmarks, you can do the following...

--------------------------------------------------------------------
    LandmarkInitializerType::LandmarkPointContainer fixedPointContainer;
    LandmarkInitializerType::LandmarkPointType  fixedPoint;
    ....
   ......

 // Read the file containing coordinates of fixed points.
 std::ifstream   fixedFile;

  if( fixedFile.fail() )
  {
    std::cerr << "Error opening points file with name : " << std::endl;
    std::cerr << argv[1] << std::endl;
    return 2;
  }
  unsigned int pointId = 0;
  fixedFile >> fixedPoint;

  while( !fixedFile.eof() )
  {
    fixedPointContainer.push_back ( fixedPoint );
    fixedFile >> fixedPoint;
   }

    .....
    landmarkInitializer->SetFixedLandmarks( fixedPointContainer);
    i
-------------------------------------------------------------------------------

HTH,

-Andinet

>Hi ITK users,
>
>I would like to use the LandMarkInitializer. Could someone please suggest
>the proper arguments for SetFixedLandmarks() and SetMovingLandmarks()? i.e.
>this is what I have:
>
>landmarkInitializer->SetFixedLandmarks( fixedPointSet->GetPointData() );
>landmarkInitializer->SetMovingLandmarks( movingPointSet->GetPointData() );
>
>But I would get this compiler error:
>
>'itk::LandmarkBasedTransformInitializer<TTransform,TFixedImage,TMovingImage>::SetMovingLandmarks'
>: cannot convert parameter 1 from
>'itk::VectorContainer<TElementIdentifier,TElement> *' to 'std::vector<_Ty>
>&'
>
>Thanks so much,
>Evelyn
>
>===========================================
>Here are the typedefs:
>
>typedef itk::PointSet< float, Dimension >   PointSetType;
>typedef PointSetType::PointType     PointType;
>typedef PointSetType::PointsContainer  PointsContainer;
>
>PointSetType::Pointer fixedPointSet  = PointSetType::New();
>PointSetType::Pointer movingPointSet = PointSetType::New();
>PointsContainer::Pointer fixedPointContainer  = PointsContainer::New();
>PointsContainer::Pointer movingPointContainer = PointsContainer::New();
>
>PointType fixedPoint;
>PointType movingPoint;
>
>// Read the file containing coordinates of fixed points.
>std::ifstream   fixedFile, movingFile;
>
>  if( fixedFile.fail() )
>  {
>    std::cerr << "Error opening points file with name : " << std::endl;
>    std::cerr << argv[1] << std::endl;
>    return 2;
>  }
>  unsigned int pointId = 0;
>  fixedFile >> fixedPoint;
>  while( !fixedFile.eof() )
>  {
>    fixedPointContainer->InsertElement( pointId, fixedPoint );
>    fixedFile >> fixedPoint;
>    pointId++;
>  }
>  fixedPointSet->SetPoints( fixedPointContainer );
>  std::cout <<  "Number of fixed Points = " <<
>fixedPointSet->GetNumberOfPoints()   << std::endl;
>  if( movingFile.fail() )
>  {
>    std::cerr << "Error opening points file with name : " << std::endl;
>    std::cerr << argv[2] << std::endl;
>    return 2;
>  }
>  pointId = 0;
>  movingFile >> movingPoint;
>  while( !movingFile.eof() )
> {
>    movingPointContainer->InsertElement( pointId, movingPoint );
>    movingFile >> movingPoint;
>    pointId++;
>  }
>  movingPointSet->SetPoints( movingPointContainer );
>  std::cout <<  "Number of moving Points = " <<
>movingPointSet->GetNumberOfPoints() << std::endl;
>
>  typedef itk::VersorRigid3DTransform< double > VersorTransformType;
>  VersorTransformType::Pointer vTransform =VersorTransformType::New();
>
> typedef itk::LandmarkBasedTransformInitializer< VersorTransformType,
>ImageType, ImageType > LandmarkInitializerType;
>  LandmarkInitializerType::Pointer landmarkInitializer =
>LandmarkInitializerType::New();
>  landmarkInitializer->SetFixedImage( fixedReader->GetOutput() );
>  landmarkInitializer->SetMovingImage( movingReader->GetOutput() );
>  landmarkInitializer->SetFixedLandmarks( fixedPointSet->GetPointData() );
>  landmarkInitializer->SetMovingLandmarks( movingPointSet->GetPointData() );
>  
>


-- 
==========================================================
Andinet A. Enquobahrie, PhD
R&D Engineer
Kitware Inc.

28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x124
www.kitware.com




More information about the Insight-users mailing list