How to save the deformation field ?

I am executing deformableregistration15.cxx
I wonder how to save the deformation field? In which format should I save it?
It didn’t happen with both mhd and mha formats.

Deformation field is an image of vectors, and can be written to disk just like any other image. That example already has the code for writing. But that only happens if you supply all the command line parameters (filenames). What is the exact problem you are running into?

It is also possible to use the TransformFileWriter to write the transformation to an HDF5 file.

Thanks @matt.mccormick I stored it in .tfm format. How to read it? how to visualize it?

.h5 is recommended. You can visualize it with the 3D Slicer Transform Visualizer.

1 Like