-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ants.atropos probimgs = [iio2.image_read(probsout[0])] #554
Comments
This is strange, if there are truly no probability images generated, it should complain specifically about that. When you say occasionally, do you mean that it fails on particular data, or occasionally fails with the same data? What ANTsPy version do you have? What OS? The error output doesn't match the code you've provided, does it depend on the particular settings in the call to atropos? If you can make a reproducible example with data I will try it out. |
I am using ants version 0.3.8. If I don't read in the mask and generate one from the image using Why is it failing. I have tried going and putting print statements in the atropos code to determine why. It looks like it uses pybind11 for the c++ wrappers. It is hard to troubleshoot the c++ code in this way. Any suggestions? |
Can you try adding |
Adding in verbose, I think that I understand why, there is an issue with my mask. The maximum value is very small. `check mask 0.0 9.1837e-41 Running Atropos for 3-dimensional images. Progress: itk::ExceptionObject (0x18215430) /rsrch1/ip/rglenn1/support_packages/miniconda/conda_gpu4/envs/tensorflow/lib/python3.9/site-packages/ants/segmentation/atropos.py:142: UserWarning: ERROR: Non-zero exit status! Traceback (most recent call last): |
Thanks - I see why it's not reporting this error properly, and will work on that. I'm still not clear about the workflow here. The parameters referenced in the error message, I understand you can't share the data, but could you post a complete series of commands to produce the error? Starting with reading in the image and mask. Please also print the image and mask to the terminal, eg
One thing we need to check is that the images are in the same physical space. |
Sure. I guess that I am getting a similar error with masks that have the correct values [0,1]. It looks like my mask origin is different than the patient origin and that is why I am getting an error. This is inside a for loop on a set of patients:
This is the output: check mask ANTsImage (RAI) check mask 0.0 1.0 Running Atropos for 3-dimensional images. Progress: itk::ExceptionObject (0x17804560) /rsrch1/ip/rglenn1/support_packages/miniconda/conda_gpu4/envs/tensorflow/lib/python3.9/site-packages/ants/segmentation/atropos.py:142: UserWarning: ERROR: Non-zero exit status! Traceback (most recent call last): |
OK great, I think we've found two errors:
is from the image and mask having different definitions of physical space. Their origin and direction should be the same. This
is from the mask being all zero, or very close to zero, causing the segmentation domain to be empty. Once the image and mask have the same headers, I recommend saving them both to disk and opening with ITK-SNAP to ensure they look correct. |
Thanks for the help!! |
I am trying to use ants.atropos on an image and I occasionally get the following error with probsout list being empty:
import ants
img = ants.image_read('image.nii.gz')
img = ants.resample_image(img, (64,64), 1, 0)
mask = ants.image_read('mask.nii.gz')
seg = ants.atropos( a = img, m = '[0.2,1x1]', c = '[2,0]', i = 'kmeans[3]', x = mask )
check tdir /tmp/ antsrcs6skj16prob*.nii.gz check probsout [] Traceback (most recent call last): File "/rsrch1/ip/rglenn1/data/cervical_patients/python_ants_image_seg.py", line 38, in <module> seg2 = ants.atropos( a = new_img, m = '[0.2,1x1x1]', c = '[10,0]', x = mask ) # i = 'kmeans[2]', File "/rsrch1/ip/rglenn1/support_packages/miniconda/conda_gpu4/envs/my_tf-gpu/lib/python3.9/site-packages/ants/segmentation/atropos.py", line 150, in atropos probimgs = [iio2.image_read(probsout[0])] IndexError: list index out of range
Any suggestions?
The text was updated successfully, but these errors were encountered: