[ITK] Create an itk transform file from a vector image

Maxime Taquet mtaquet at gmail.com
Mon Aug 18 10:46:02 EDT 2014


Thank you, Matt!

For the record, here is the piece of code that solved my problem (it
creates a transform named "transform" that contains the deformation field
contained in “myfield.nrrd"):

// Read the input vector image
typedef itk::Image<typename itk::Transform<double, 3, 3>::OutputVectorType,
3> FieldImageType;
FieldImageType::Pointer fieldImage;
itk::ImageFileReader<FieldImageType>::Pointer fieldReader =
 itk::ImageFileReader<FieldImageType>::New();
std::string myFieldFileName = "myfield.nrrd";
fieldReader->SetFileName(myFieldFileName);
fieldReader->Update();
fieldImage = fieldReader->GetOutput();

// Define a transform from the field
itk::DisplacementFieldTransform<double,3>::Pointer transform =
itk::DisplacementFieldTransform<double,3>::New();
transform->SetDisplacementField(fieldImage.GetPointer());
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140818/e48d6f82/attachment-0002.html>


More information about the Community mailing list