我想将 DisplacementFieldTransform 保存为 SimpleITK 中的图像。
文档说:
位移场,例如存储在 DisplacementFieldTransform 对象中的位移场,也可以保存为图像(.nrrd、.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 保存为图像?