Hello Everyone
I am working with a paediatric data set, particularly interested in the basal ganglia. I’ve found FIRST does a poor job of parcellating the subcortical structures for these scans, but I’ve been very happy with the results from MAPER. I’d like to edit the 5ttgen output to replace the sgm volume with the result from MAPER (extracting the relevant parcellations from this and combining to create a binary mask). Feeding this into 5ttedit with the -sgm option then labels the voxels supplied in this mask as sgm, which appears to add to the SGM volume in the 5ttgen output, and subtract these voxels from the other tissue files (gm, wm etc). This works nicely, but there are voxels labelled as the sgm originally, which I’d like to remove, and allocate to generally white matter. Is there an easy way to do that?

Welcome Daniel!

The 5ttedit command is exceptionally simple, essentially just providing an “override” functionality to manually force specific voxels to be specific tissues. The operation you are seeking is actually more complex, and so requires a slightly more sophisticated solution than what that command currently provides.

There’s a number of different options, depending on how complex you want to go. Differences lie in:

  1. Whether or not it’s possible to retain partial volume information (or whether each voxel is 100% one specific tissue);

  2. Whether or not it’s possible for such modifications to be applied subsequent to 5ttgen or whether it needs to be hijacked internally.

To explain point 2, imagine a voxel that is labelled as 100% SGM by FIRST, but that MAPER considers to be 0% SGM. If you are certain that you want the operation to be “anything labelled as SGM by FIRST but not by MAPER should instead be assigned to WM”, then it’s a matter of:

  • Breaking the 5TT image into 3D volumes;
  • Devising the appropriate calculations to be performed by mrcalc in order to derive the desired individual per-tissue partial volume images (such that they will sum to 1.0 in every voxel);
  • Re-concatenating into a 5TT 4D image.

This can however require some gymnastics to get right, as can be seen in the 5ttgen fsl code, as anything that’s added to one tissue needs to be subtracted from others in the appropriate fashion. However if instead you were to say that "anything labelled as SGM by FSL FIRST but not by MAPER should instead retain whatever tissue segmentation was made by FSL fast", this might be impossible to do after 5ttgen, because if 5ttgen labels a voxel as 100% SGM, then the information about how fast labelled that voxel prior to the introduction of information from FIRST is lost in the 5TT output image.

Alternatively, if you prefer the segmentation results from MAPER on your data more generally, and not just specifically for the SGM structures, you might prefer to avoid 5ttgen fsl entirely, and instead have an alternative 5ttgen algorithm that takes the complete output of MAPER and generates from it a 5TT image? I can give you pointers if that’s something you want to try.