[Insight-users] Representation of deformation field

Luis Ibanez luis.ibanez at kitware.com
Wed May 26 18:55:53 EDT 2004


Hi Josiane,

In your code snippet there is no initialization for
the values of the deformation field. You are simply
instantiating the class and creates one object of it,
but dont initialize the field in any way.

For examples on how to generate a deformation field,
please look at:

     BSplineWarping1.cxx
     LandmarkWarping2.cxx

In the case of

     DeformableRegistration4.cxx

the deformation field is the result of using BSplines
as a transform. Note that this example already writes
the deformation field into a file in the form of a
Vector image. Just make sure that you use the MetaImage
format when you write the deformation field.




   Regards,


      Luis




-----------------------------------------------------
Josiane Yankam Njiwa--DEA Clarysse--Fin 11/04 wrote:

> Hi,
> 
> I use the deformableRegistration4.cxx, and I have problem to write the
> deformationField in file ( image), so I hope to keep these values that i
> will use in another viewer.
> I wrote the code below, but I have in my file all the points at 0, and I
> don't understand why.
> Is somebody can help me .
> 
> Regards.
> 
> Josiane
> 
> typedef itk::Vector< float, ImageDimension >  VectorType;
>   typedef itk::Image< VectorType, ImageDimension >  DeformationFieldType;
> 
>   DeformationFieldType::Pointer field = DeformationFieldType::New();
>   field->SetRegions( fixedRegion );
>   field->SetOrigin( fixedImage->GetOrigin() );
>   field->SetSpacing( fixedImage->GetSpacing() );
>   field->Allocate();
> 
>   typedef itk::ImageRegionIterator< DeformationFieldType > FieldIterator;
>   FieldIterator fi( field, fixedRegion );
> 
>   fi.GoToBegin();
> 
>   TransformType::InputPointType  fixedPoint;
>   TransformType::OutputPointType movingPoint;
>   DeformationFieldType::IndexType index;
> 
>   VectorType displacement;
> 
>   std::ofstream file;
>   std::ofstream file1;
> 
>   file.open("Essai.txt");
>   file1.open("Essai1.txt");
> 
> 
>   while( ! fi.IsAtEnd() )
>     {
>     index = fi.GetIndex();
>     field->TransformIndexToPhysicalPoint( index, fixedPoint );
>     movingPoint = transform->TransformPoint( fixedPoint );
> 	std::cout << fixedPoint    << std::endl;
> 	std::cout << movingPoint    << std::endl;
>     displacement[0] = movingPoint[0] - fixedPoint[0];
>     displacement[1] = movingPoint[1] - fixedPoint[1];
> 	file << displacement[0];
> 	file1 << displacement[1];
>     fi.Set( displacement );
>     ++fi;
>     }
>  file.close();
>  file1.close();
> _______________________________________________
> 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