-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
Atropos stops early with "posterior probability" that doesn't depend on intensities data #1791
Comments
Not a bug. The posterior probability has converged and the final posterior is not dumped to the screen. It's a quirk of the command iterator. |
You mean that the mean maximum posterior probability is 0.596973 both before and after Iteration 1, and that's how Atropos decides to stop? It also doesn't depend on the number of classes: |
For starters, your example image is probably contributing to the problematic output. I would recommend doing some reading on this type of segmentation approach if you're really curious about how things are working "under the hood." I would start by reading the original Atropos paper and perhaps some of its references. |
I computed mean maximum posterior (or at least, what I understand "We track convergence by summing up the maximum posterior probability at each site over the segmentation domain." and "mean maximum posterior probability over the region of interest" to mean) from the output images like this (compute_mean_maximum_posterior.py):
and the results are completely different from the 0.596973 number in the Atropos output, and different from each other: For the output of different Atropos runs (which all stop after reporting I can't find the definition of When I run Atropos on a different brain CT I downloaded (CTBrain.nii.gz; I created a brain mask for it which is brainmask.nii.gz, it behaves as I expect: The Full script and output:
So yes, something about my input files is contributing to this, but I've now observed it on very different intensity images:
|
Get / Set methods are often defined via macro, so a text search for GetSomething will not work, but you can often find m_Something in the code. In the case of m_CurrentPosteriorProbability, I think it's updated here: ANTs/ImageSegmentation/antsAtroposSegmentationImageFilter.hxx Lines 1148 to 1150 in 9aebf5a
|
And note that although Atropos is a generic segmentation tool, in the brain, the underlying methodology is most often applied to T1-w MRI and not CT. In fact, depending on what segmentation output you're looking for in your CT image, Atropos might not be the best tool. |
I think I figured out what's going wrong: I could fix this loop but I don't know what else has similar issues; is there some easy way I can force |
Good find - I think this might not be just your OS, because I can reproduce the same thing on my Mac. It doesn't happen if I downsample your example images to 1mm resolution. |
Looks like something we would need to fix. We often use a consistent 32-bit RealType to conserve memory and reduce overhead from casting, which can be significant. But things that are summed over whole volumes should probably be double, what do you think @ntustison ? |
Sure, that shouldn't be a problem. You might even be able to simply swap out RealType in the header file without too many additional changes. |
Thanks for your persistence in tracking this down, @stephen-q-le . Let us know if there's further issues |
Operating system and version
NixOS 24.05.3103.0c53b6b8c2a3 (Uakari)
CPU architecture
x86_64 (PC, Intel Mac, other Intel/AMD)
ANTs code version
ANTs Version: 2.5.1.dev1-gGIT-NOTFOUND Compiled: Jan 1 1980 00:00:00
ANTs installation type
Other (please specify below):
NixOS package install
Summary of the problem
I have a brain mask such that the Atropos output looks like this, for various image intensities:
This seems to be a bug, as neither of these make sense to me:
I don't understand why Atropos would ever stop if it hasn't reached the number of iterations limit and hasn't generated two "posterior probability" values close to each other, but I'm not sure that's a bug.
Commands to reproduce the problem.
Output of the command with verbose output.
full-log.txt
Data to reproduce the problem
redacted-brainmask-map.nii.gz
garbage_data-label.nii.gz
Note: I encountered this issue on a high-resolution CT scan, with a brain mask I created outside ANTs. To replicate the issue using data I'm willing to upload, I kept the same image dimensions and resolution, and replaced the intensities with hand-drawn garbage data.
I made up another garbage data file "garbage_data-vesselness.nii.gz" but it's too big to upload.
The text was updated successfully, but these errors were encountered: