Guys, I need help reviewing this code. I am trying to resample a MRI FLAIR image in to a 1mm x 1mm x 1mm space, and then resample that image’s label according to the resampled image.
Everything sound ok, BUT the result is a TOTAL zero label image.
Please take a look:
interpolator_image = sitk.sitkBSplineResamplerOrder3
interpolator_label = sitk.sitkNearestNeighbor
pixelType_image = sitk.sitkFloat32
pixelType_label = sitk.sitkUInt16
transform = sitk.Transform(3, sitk.sitkIdentity)
spacing = (1.0, 1.0, 1.0)
origin = image.GetOrigin()
direction = image.GetDirection()
size = image.GetSize()
defaultPixelValue = 0.0
resampler = sitk.ResampleImageFilter()
resampler.SetDefaultPixelValue(defaultPixelValue)
resampler.SetInterpolator(interpolator_image)
resampler.SetOutputDirection(direction)
resampler.SetOutputOrigin(origin)
resampler.SetOutputPixelType(pixelType_image)
resampler.SetOutputSpacing(spacing)
resampler.SetSize(size)
resampler.SetTransform(transform)
resampler.SetUseNearestNeighborExtrapolator(False)
resampled_flair = resampler.Execute(image)
resampled_label = sitk.Resample(label_image, resampled_flair);
Any help is welcomed.