Get spinal cord volume

Is there any command to get the spinal cord volume in mm3?
I need some code like sct_analyze_lesion that calculate the lesion volume from a mask, but using the t2_seg.nii.gz as a mask, for example.

Hi Angelo,

what if you run something like this?

sct_analyze_lesion -m t2_seg.nii.gz -s t2_seg.nii.gz

Hi jcohenadad!
Thank you! I think that this is the way! It gives me 7 results the t2_seg.nii.gz
Do you know any way to get the individual volume from cervical and thoracic spinal cord? I`v tried to execute MAP50_leves.nii.gz, but it gives me 107 results…

Hi,
You could generate one cervical mask and one thoracic mask, based on the labeled segmentations, and then compute mask volume. Something like this:

# Generate thoracic mask
sct_maths -i t2_seg_labeled.nii.gz -bin 7 -o t2_seg_thoracic.nii.gz
# Generate cervical mask
sct_maths -i t2_seg_thoracic.nii.gz -sub 1 -o t2_seg_thoracic-minus1.nii.gz
sct_maths -i t2_seg_labeled.nii.gz -mul t2_seg_thoracic-minus1.nii.gz -o t2_seg_cervical.nii.gz
sct_maths -i t2_seg_cervical.nii.gz -mul -1 -o t2_seg_cervical.nii.gz
sct_maths -i t2_seg_cervical.nii.gz -bin 0.5 -o t2_seg_cervical.nii.gz
# Compute cord volume
sct_analyze_lesion -m t2_seg_cervical.nii.gz -s t2_seg_cervical.nii.gz 
sct_analyze_lesion -m t2_seg_thoracic.nii.gz -s t2_seg_thoracic.nii.gz 

Below is an image illustrating the two masks:

Best,
Julien

1 Like

Thats perfect! Thank you very much Julien!