-
Notifications
You must be signed in to change notification settings - Fork 149
Can't access or save data array in transformix deformation vector field #261
Comments
It should now work on the develop branch. New tests pass on CI. Give it a spin and let me know how it goes. |
@kaspermarstal I got exactly the same issue as @nwschurink .. I can't write the deformation field I get through TransformixImageFilter.GetDeformationField() with sitk.WriteImage().The generated .raw is basically empty, although the generated .mhd seems to have the correct metadata. Also, I can't access the pixel data within the deformation field as well.. I'd be happy if there are any updates regarding this issue :) Thanks for the great effort :) |
@MarHHM It is a while ago that I have encountered it, but I think it was solved on the dev branch as is mentioned by @kaspermarstal. Another (crude) solution (which was a workaround I resorted to at first) would be to run the transformix command from command line (using eg subprocess) and load the deformation field using SimpleITK. It's a messy workaround though, so probably better to just use the dev build. |
Thanks for ur feedback, @nwschurink A while ago, I resorted to using the command line versions (v5.0) of both elastix & transformix (calling them in python through I use sitk currently only for pre & postprocessing (i.e. ITK functionality, but not elastix) as it's still super useful.. Cheers,, |
Hi all, I've gone through quite a painful process to finally get a deformation file exported. But unfortunately the entries are all zero. I initially performed a registration in Anaconda Jupyter:
and the registration looked fine. So I moved onto trying to get the deformation field:
but the deformation field was not exported (the Jacobian and its determinant was exported to .nii files). Issue #259 looked promising so I tried:
but it killed the kernel without producing any errors. So did:
Then I copied the above code and saved it into a .py file and ran it in Anaconda Spyder. Spyder produced output (warnings, parameters, metrics results, etc) in the console that Jupyter did not, but still not deformationField.nii file. Then I repeated the above in PyCharm and it worked! Or so I thought it did... Running the script in PyCharm created the defField.nii file only once! Although the Jacobian .nii files and other .log and .txt files were updated, the deformation field file did not. I tried again after restarting PyCharm but there was no change. I moved on. I read in the defField.nii file I generated once only and converted to a numpy array:
but found that all entries are 0. It's quite a defeating result. Does anyone have any idea what's going on? As far as I'm aware I'm running the latest build of SimpleElastix (1.2.0rc2.dev1162-g2a79d). Thanks. |
Hi, I am posting this a new issue as requested by @kaspermarstal . I am having problem's with the transformix module of SimpleElastix. More specifically, whenever I try to access the numpy data within the ITK deformation vector field image python crashes without raising an error. Another peculiarity is that Transformix is not saving any files to the defined output folder, wheras Elastix is saving files to the correct folder.
I use the following code:
Up until here everything seems to work fine. The output of transformix to the console is:
Ok so just to get some information about the deform variable that I defined, I printed it's info which is:
Using commands that don't try to access the numpy pixel data works fine (e.g. deform.GetNumberOfComponentsPerPixel(), deform.GetSize() etc). However, when I use deform.GetPixel((1,1,1)) or sitk.GetArrayFromImage(deform), or when I try to write the deformation field to a file using sitk.WriteImage(deform, 'deform.mhd') python crashes without raising an error.
The exact version of SimpleElastix that I have installed is simpleitk-1.1.0.dev362+gb3783-py3.6-win-amd64 according to conda. Could it be that this is some bug in the C code?
When running the transformix command from command line itself everything goes fine and I get the resulting deformation field.
The text was updated successfully, but these errors were encountered: