dipy icon indicating copy to clipboard operation
dipy copied to clipboard

Tissue prior output volumes in random order

Open tangwei opened this issue 1 year ago • 13 comments

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

tangwei avatar May 07 '24 19:05 tangwei

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?

pjsjongsung avatar May 07 '24 20:05 pjsjongsung

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

tangwei avatar May 07 '24 20:05 tangwei

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)

pjsjongsung avatar May 07 '24 21:05 pjsjongsung

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.

tangwei avatar May 07 '24 21:05 tangwei

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.

pjsjongsung avatar May 07 '24 22:05 pjsjongsung

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.

tangwei avatar May 07 '24 22:05 tangwei

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

Garyfallidis avatar May 07 '24 22:05 Garyfallidis

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.

Garyfallidis avatar May 07 '24 22:05 Garyfallidis

@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.

pjsjongsung avatar May 07 '24 22:05 pjsjongsung

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

Garyfallidis avatar May 07 '24 22:05 Garyfallidis

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.

tangwei avatar May 11 '24 01:05 tangwei

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

Garyfallidis avatar May 11 '24 02:05 Garyfallidis

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

tangwei avatar May 11 '24 17:05 tangwei