-
Notifications
You must be signed in to change notification settings - Fork 149
4D Indexing / Casting #19
Comments
As you suggest, the issues with casting 4D images and extracting 3D volumes from 4D images is indeed the same as with the JoinSeries filter - it is not supported yet. Will fix this! Elastix is only compiled with short pixel type for 4D by default. This will be changed in the next version to include all basic pixel types (chars, shorts, ints, unsigned equivalents, float and double). Indexing for 4D is not supported in SimpleITK and beyond my SWIG skills 😊 |
Thanks for the reply and explaining a bit of why some of the functions don't work. Indexing would be great but is not needed it seems like extracting should yield the same result. |
Try a doing a git pull. There should now be support for casting 4D images, joining 3D images into 4D images and extracting 3D images from 4D images. |
Thanks for the update. It works now! |
This was a little bit of a goose chase where there seemed to be lots of road blocks preventing me from visualizing the 4D data created from groupwise registration. There are potentially a couple of issues here... or its just me.
When trying to visualize I tried to use indexing to get each individual volume from the 4D image but was unable to index the 4D data in the same way that I index 3D data.
participantOne = resultImage[:,:,:,0]
. The error is simplyThen, as an alternate solution, I tried to use
extractor = sitk.ExtractImageFilter()
and it also threw an errorThe error indicates it is because of the data type (but maybe this is because the image is 4D, I know this was the case with
JoinSeries
) - my SimpleElastix was built with 4D ON. To try and resolve this and see if it was truly the data type, I tried to cast the resultImage to something else usingUInt16ResultImage = sitk.Cast(resultImage, sitk.sitkUInt16)
and this didn't work (again maybe because it's 4D?).So, to test if it was the 4D or the pixel-type, I went back to the images before the groupwise registration and to see if I could cast them to a different type before the registration, assuming this carried through to the post registration. I am able to cast these, but the elastix groupwise registration seems like it won't work on anything except the original image (it's a short). It indicated that this error was again due to the pixel type and that this could be changed either in the cmake or in the elastix parameters.
So, based on this, I tried to alter the paramtermap for 'groupwise' registration to coincide with the data. I may have been doing this incorrectly. But I tried to alter it to float as is recommended in the Elastix documents using:
groupwiseParameterMap = sitk.GetDefaultParameterMap('groupwise') groupwiseParameterMap['FixedInternalImagePixelType'] = ['float'] groupwiseParameterMap['MovingInternalImagePixelType'] = ['float']
I then used groupwiseParameterMap as the input for
elastix.SetParameterMap()
and it still gave the same error.The other alternate for the Elastix groupwise registration is to alter something in the make file but since I built SimpleElastix this wasn't something that I had access too. My next step was to build my own elastix/ITK.
In short. I had issues with:
Sorry for the long post but I thought it was better to be thorough.
Anthony.
The text was updated successfully, but these errors were encountered: