Here’s a piece of code I’m trying to run using pydicom and itk (using pydicom for a better dicom tag extraction since itk was failing to get some tags).
ds = pydicom.read_file(file_path)
np_image = ds.pixel_array
itk_image = itk.GetImageFromArray(np.ascontiguousarray(np_image))
lumfilter = itk.RGBToLuminanceImageFilter.New(Input=itk_image)
However, lumfilter
fails since it’s expecting an RGB image itkImageRGBUC2
, but the image that ITK created from the array is of type itkImageUC3
. Is itkCastImageFilter
the only way to go, or am I missing something?
Thanks!