我想将DisplacementFieldTransform另存为SimpleITK中的图像。
The documentation
说:
位移场,例如存储在DisplacementFieldTransform对象中的位移场,也可以保存为图像(.nrd、.nhdr、.mha、.mhd、.nii、.nii.gz)。
但当我这样做的时候
demons = sitk.FastSymmetricForcesDemonsRegistrationFilter()
demons.SetNumberOfIterations(15)
# Standard deviation for Gaussian smoothing of displacement field
demons.SetStandardDeviations(1.0)
demons.AddCommand( sitk.sitkIterationEvent, lambda: command_iteration(demons) )
displacementField = demons.Execute(followup, baseline)
deformation_field = sitk.DisplacementFieldTransform(displacementField)
deformationFieldPath = os.path.join(destinationDataPath, str(patientId) + '_deformationField.nrrd')
sitk.WriteTransform(deformation_field, deformationFieldPath)
我得到以下错误:
RuntimeError: Exception thrown in SimpleITK WriteTransform: /tmp/SimpleITK-build/ITK/Modules/IO/TransformBase/include/itkTransformFileWriter.hxx:167:
itk::ERROR: TransformFileWriterTemplate(0x555a72b3e700): Could not create Transform IO object for writing file /home/amasson/fastai/EMISEP-differences/6_deformationField.nrrd
Tried to create one of the following:
HDF5TransformIOTemplate
HDF5TransformIOTemplate
MatlabTransformIOTemplate
MatlabTransformIOTemplate
TxtTransformIOTemplate
TxtTransformIOTemplate
You probably failed to set a file suffix, or
set the suffix to an unsupported type.
如何将DisplacementFieldTransform保存为图像?