Skip to content
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

Some zeros in aseg.stats #492

Closed
karllandheer opened this issue Mar 21, 2024 · 8 comments
Closed

Some zeros in aseg.stats #492

karllandheer opened this issue Mar 21, 2024 · 8 comments
Labels
question Further information is requested

Comments

@karllandheer
Copy link

Hello, a few values are zero in aseg.stats when I run this command:

docker run -v ${SETUP_DIR}:/data my_fastsurfer:cpu --t1 /data/T1_unbiased_brain.nii.gz --sd /data/ --sid Tutorial --py python3 --allow_root --3T --fs_license /data/FreeSurferLicense.txt --parallel --fsaparc --threads 2

Namely, things like the left and right vessel. Is this expected behavior, or am I missing something? Similarly, I have zeros in the fifth ventricle and optic chiasm.

Thanks very much in advance for your help!!

Screenshot 2024-03-21 at 9 28 07 AM
@karllandheer karllandheer added the question Further information is requested label Mar 21, 2024
@dkuegler
Copy link
Member

dkuegler commented Mar 21, 2024

Can you please say which file you are referring to and which FastSurfer version you are using? I assume it is stats/aseg.stats and the release version, so FastSurfer 2.2.2.

Generally, some zero-values in the stats file are expected, if these specific regions are "requested", but no voxels in the image are labeled as this region. In particular, with both your options (--fsaparc) and that version, this file is generated by FreeSurfer's mri_segstats. We are currently moving over to our own segstats.py implementation, but this change is still only a PR for stats/aseg.stats.

We should also note, that the regions that are zero in this file are regions that might be reasonably zero. Vessels are often not segmented and WM-hypointenisities are not lateralized.
I don't quite know why the 5th ventricle is 0, you might have to have a look at the mri/aseg.mgz to see if any voxel was labeled 5th ventricle and if not, check if this is correct.

@karllandheer
Copy link
Author

Hello, yes it is from aseg.stats, and the version is the Dev branch from Feb 7th (I had to use the dev branch due to an OOM issue from the release branch). Not sure how to check version.

Looking into it further, it seems the 5th ventricle is rare and expected to be zero. The vessels and optic chiasm, however, I do not think should be zeros. I ran FastSurfer on 76 subjects and have FreeSurfer volumes for these same subjects, and they are non-zero (typically volume of 50 mm^3 for left vessel, and 187 mm^3 for optic chiasm). For all 76 subjects both traits were exactly 0 from FastSurfer. I am looking into whether the aseg.mgz has any voxels labeled as these now.

@karllandheer
Copy link
Author

OK, I do not believe that there are any voxels labeled as optic chiasm or 5th vessel (left or right) in aseg.mgz, assuming this is the correct look up table: https://github.com/Deep-MI/FastSurfer/blob/dev/FastSurferCNN/config/FreeSurferColorLUT.txt . The unique values in aseg.mgz are

array([ 0, 2, 3, 4, 5, 7, 8, 10, 11, 12, 13, 14, 15,
16, 17, 18, 24, 26, 28, 31, 41, 42, 43, 44, 46, 47,
49, 50, 51, 52, 53, 54, 58, 60, 63, 77, 251, 252, 253,
254, 255], dtype=int32)

Is this expected behavior that none will be labeled as these two regions? I understand both are small regions, and so maybe the values from freesurfer are just essentially noise (i.e., misclassification) and FastSurfer treats this noise slightly differently? Just want to make sure I am not making a mistake somewhere.

@dkuegler
Copy link
Member

This all seems correct to me.
FastSurfer actually combines some of the labels to reduce the number of labels in the training. For example there is one label for wm-hypointensities, not 5. You can find a list of learning-based labels https://github.com/Deep-MI/FastSurfer/blob/dev/FastSurferCNN/config/FastSurfer_ColorLUT.tsv.
So all additional labels are painted in after the fact, often using Freesurfer binaries.

I think your examples all fall into this category.

@dkuegler
Copy link
Member

dkuegler commented Mar 22, 2024

Not sure how to check version.

./run_fastsurfer.sh --version

You can also add all to get all the version information.

Please note that the dev branch is not a validated setup. It may produce unexpected results. We are currently working to implement CI to reduce this, but only the stable branch and released versions are rigorously tested.

Looking into it further, it seems the 5th ventricle is rare and expected to be zero. The vessels and optic chiasm, however, I do not think should be zeros. I ran FastSurfer on 76 subjects and have FreeSurfer volumes for these same subjects, and they are non-zero (typically volume of 50 mm^3 for left vessel, and 187 mm^3 for optic chiasm). For all 76 subjects both traits were exactly 0 from FastSurfer. I am looking into whether the aseg.mgz has any voxels labeled as these now.

I'll have a look at the numbers of these regions in our rigorous tests later. But we only do those tests for release versions.

@dkuegler
Copy link
Member

Also, I cannot really explain why your OOM errors were fixed by dev over the release version. That makes little sense to me.

@karllandheer
Copy link
Author

Hello, I was suggested to try this by: #444

It seems to have largely solved the issue (still happens but only on about 1/1000 cases, whereas before it was happening on most subjects).

@m-reuter
Copy link
Member

m-reuter commented Apr 12, 2024

Hi, will close this now. It is correct that some labels are not generated in our segmentation network (such as 5th ventricle or optic chiasm). These labels were pretty unreliable and some are non existent in many subjects, which is why we dropped them. Other labels that don't get segmented directly in the neural net get either:

  • added directly afterwards, e.g. by lateralisation of the combined label
  • added afterwards in a separate module (e.g. corpus callosum, gets added in recon-surf and in the future will have it's own deep learning based module)
  • added after surface creation, e.g. WM sub segmentation , as a projection from the cortical surface.

And some, like the ones above, get never created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants