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

Tissue prior output volumes in random order #3213

Open
tangwei opened this issue May 7, 2024 · 13 comments
Open

Tissue prior output volumes in random order #3213

tangwei opened this issue May 7, 2024 · 13 comments

Comments

@tangwei
Copy link

tangwei commented May 7, 2024

Description

I generated tissue maps from some pre-computed Q-ball peaks:

from dipy.segment.tissue import TissueClassifierHMRF
hmrf = TissueClassifierHMRF()
apm = anisotropic_power(qball_peaks.shm_coeff)
results = hmrf.classify(apm, nclass=3, beta=.1)

The third output in results is the PVE volume which contains the 3 identified classes. They follow a random order when I compared the volumes from different subjects using the same script. Is there a way to make the volumes follow a fixed order? Here is what MRTrix used:

0: Cortical grey matter
1: Sub-cortical grey matter
2: White matter
3: CSF
4: Pathological tissue

https://mrtrix.readthedocs.io/en/dev/quantitative_structural_connectivity/act.html

@pjsjongsung
Copy link
Contributor

From what I understand it should not be random, given the innate intensity difference between CSF, GM and WM. Do you have some images of how it is random? For example does CSF and GM change classes with each other sometimes?

@tangwei
Copy link
Author

tangwei commented May 7, 2024

From what I see in HCP 7T data, it's random among all three, not only between CSF & GM. Here's an example from two HCP subjects.

Subject 100610:

0:
image

1:
image

2 (basically empty):
image

Subject 102816:

0:
image

1:
image

2:
image

@pjsjongsung
Copy link
Contributor

I see. I still think it is ordered intensity wise, but it is giving unstable results. You can see that on subject 100610 GM and CSF share labels, which is why WM got label 1 and there is almost nothing for label 2.

I am not sure what happened on 102816, but it seems to be a similar problem of GM and CSF being mixed up.

This seems to be a limit of the method itself, which hopefully we will be able to address later on.
For now, could you try maybe changing the number of classes to 4? I found that using 4 can sometimes give better results (where 0 is CSF, 1 is GM, 2 and 3 is WM)

@tangwei
Copy link
Author

tangwei commented May 7, 2024

This would not be a problem with analyses using just a few subjects because one can manually identify the tissue maps. It becomes a real problem with batch processing. For example, I need to run the same algorithm through 100+ subjects and it won't be practical to check each individual. In the latter case, I don't think changing the number of classes would guarantee the consistency across subjects.

@pjsjongsung
Copy link
Contributor

I agree. It was just a workaround I found when dealing with few subjects. We could definitely benefit from a more robust/less tweaking required tissue segmentation. But maybe others have an easier solution for now.

@tangwei
Copy link
Author

tangwei commented May 7, 2024

Yeah, I have a temporary solution using the aparc+aseg files provided by HCP to match the tissue masks. But general users would benefit more from something independent of additional check files.

@Garyfallidis
Copy link
Contributor

I think when we say 3 it is actually 4. 3 + background.

@Garyfallidis
Copy link
Contributor

The mean intensity for each class should be different and easy to sort.
Background should have the lowest, csf second lowest, gm should be the third intensity and wm should be the last.
You can use the mean intensity for each class to correct the order of the labels.
To move to a 5 class representation that separates cortical to subcortical wm should not be a problem. But currently it is not available with this HMRF application. But if the current order is random we should fix that.

@pjsjongsung
Copy link
Contributor

@Garyfallidis The current order is not random. It appears random because CSF and GM had some issues separating but as you can see from the images WM is always a higher class.

@Garyfallidis
Copy link
Contributor

Garyfallidis commented May 7, 2024

Okay, indeed the error seems different. Good catch @pjsjongsung

@tangwei
Copy link
Author

tangwei commented May 11, 2024

I see, now that makes sense. It's a tissue separation issue, not order issue. Nonetheless the issue seems prominent. I checked the 176 HCP 7T subjects, only about 80 had correct tissue classification like the second subject above. The rest of the subjects mostly had GM + CSF mixing like 100610, but 20+ subjects had WM + CSF mixing as well:

0:
image

1:
image

2:
image

ACT breaks down with either type of mixing.

@Garyfallidis
Copy link
Contributor

Great feedback. Please send us a couple of the data that fail.

@tangwei
Copy link
Author

tangwei commented May 11, 2024

Sure, I'm using the HCP 7T data on UITS' storage /N/project/hcp_dcwan. Here are some problematic subjects:

  1. GM + CSF mixing: 100610, 406836, 901442
  2. WM + CSF mixing: 436845, 200614
  3. A weird GM + WM mixing: 111312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants