5ttgen hsvs result modification

Hello,

I am attempting to create a 5TT.mif file using 5ttgen hsvs for ACT. The resulting image looks quite good overall (Screenshot1), but the cerebellum area could be improved. I would like to replace only this specific section with the results from SynthSeg (Screenshot2).

I tried creating a SynthSeg2ACT.txt file modeled after FreeSurfer2ACT.txt (Screenshot3. I am actually interested in using only the highlighted sections).

I looked into /usr/local/mrtrix3/lib/mrtrix3/_5ttgen/hsvs.py, but the script was quite complex, and I was unsure which part to modify. Any tips or guidance would be greatly appreciated!

Thank you in advance.



Hello,
Check out the 5ttedit command. If you are able to extract the white-matter and SGM component of the SynthSeg segmentation, something like this might work:

5ttedit <5ttact.mif> -wm <cerebellum_wm_synthseg.mif> -sgm <cerebellum_sgm_synthseg.mif> <modified5TT.mif>

Hope this helps :slight_smile:

1 Like

and, to extract the relevant structures from SynthSeg, something like this might be helpful

for region_index in <list_of_index_of_interest>
do
mrcalc <synthseg_segmentation> ${region_index} -eq extracted_region_${region_index}.mif
done

Then add all the relevant extracted regions to create a single cerebellum WM image <cerebellum_wm_synthseg.mif>, and repeat for SGM to create <cerebellum_sgm_synthseg.mif>

1 Like

Hi Arkiev,

Thank you very much! Your advice was really helpful.
I put it into practice and got the image I expected.

I’ll list the commands that I used here in case they might be helpful for others.

for i in 8 47; do mrcalc synthseg.nii.gz $i -eq gm_extracted_${i}.mif; done
for i in 7 46; do mrcalc synthseg.nii.gz $i -eq wm_extracted_${i}.mif; done
mrcalc gm_extracted_8.mif gm_extracted_47.mif -add  cerebellum_gm.mif
mrcalc wm_extracted_7.mif wm_extracted_46.mif -add cerebellum_wm.mif
mrtransform cerebellum_wm.mif -template 5TT.mif cerebellum_wm_transformed.mif
mrtransform cerebellum_gm.mif -template 5TT.mif cerebellum_gm_transformed.mif 
5ttedit 5TT.mif -wm cerebellum_wm_transformed.mif -sgm cerebellum_gm_transformed.mif modified_5TT.mif

Best,
Kikuko

1 Like