Hello,
My lab has .tif images we need to do a groupwise registration on and I am having difficulty reading them into SimpleITK. If I understand correctly, to register images they need to be floats so I have tried reading in the images as float32 and reading as tifs and then casting to float32 using this code:
import SimpleITK as sitk
from SimpleITK import Cast as cast
fixfloat = sitk.ReadImage(“tmov.jpg”, outputPixelType = sitk.sitkFloat32)
fix = sitk.ReadImage(“tmov.jpg”)
fixcast = cast(fix, sitk.sitkFloat32)
The image being read is just a red triangle I made in Photoshop to test with.
tfix.tif (567.1 KB)
When I read it in converting to float32, the image ends up being blank when I save it out. When I read it it in as-is, the image displays properly when saved out but when I try to cast it I get the message:
:ERROR: Filter does not support casting from casting vector of 8-bit unsigned integer to 32-bit float
Because of this, the image version I can register is blank and the image showing the triangle can’t be registered. I would be extremely grateful for some advice on what I am doing wrong.
Thanks very much in advance!
Rock