Extract_metrics with slice-direction partial volumes


When using sct_extract_metrics, what is the preferred way to deal with partial volume effects in the slice direction for slices and/or per-level data? That is, if the DTI slice coverage is C2:C6 for example, when in template space the top- and bottom-most levels will have only partial overlap with the available data as in the figure included. The middle two levels are obviously ok, but the levels overlapping the edge of the slice field of view appear to average true values with the 0 values without real data.

  • One method would be to exclude voxels with 0 values similar to fslstats (-M) flag. In sct, negative values can be excluded with -discard-neg-val flag, but seemingly not 0 voxels.
  • The alternative is to mask the input per-level masks with a mask that covers the DTI slice coverage, as an example, although that includes an additional per-subject step.

I am curious what the sct team recommends to deal with this?


#Additional commands used to demonstrate effects:
sct_extract_metric -i FA_reg.nii
-f {SCT_DIR}/data/PAM50/template/PAM50_levels.nii.gz
-method wa -perlevel 1
-vert 2:9
-vertfile ${SCT_DIR}/data/PAM50/template/PAM50_levels.nii.gz

#partial output:

#if using fslstats in the same way, we get the same values (reordered for consistency w/sct):
fslstats -K ${SCT_DIR}/data/PAM50/template/PAM50_levels.nii.gz FA_reg.nii -m

#if using fslstats with non-zero mean, we get more appropriate values for the ‘edge’ levels, but the mid-levels are unchanged:
fslstats -K ${SCT_DIR}/data/PAM50/template/PAM50_levels.nii.gz FA_reg.nii -M

Hi @mbudde,

My deepest apologies for the late response. I am writing to let you know that @jcohenadad is currently out of office, and will return on August 28th.

I will check in with other members of the lab to see if they can provide insight into your question. But, otherwise, I thank you for patience until Julien returns. :blush:

Kind regards,

One thing I will say, though, is that this seems like an excellent suggestion, and relatively easy for us to implement given the existence of -discard-neg-val as you mention. Thank you for the suggestion! I’ll open a ticket for this feature request. :slightly_smiling_face:

Kind regards,

1 Like

Hi Matt! Thanks for reaching out. Agreed with @joshuacwnewton about leveraging the already existing flag. I don’t see any other “easy” solution.

thanks for the response, gents.

As a workaround, I tried to subtract small values from the input image:
sct_maths -i FAin.nii.gz -sub 1e-16 -o FAout.nii.gz
and ran sct_extract_metric again with -discard-neg-val flag enabled. However, it didn’t seem to have any effect. (tried other less-small values too).

I see you opened the Advanced options in a subsequent issue, so I’ll find a different workaround for now. Thanks and regards!

Interesting. So it suggests a bug with this flag. @joshuacwnewton could you please look into this? Thanks!

Of course! Two issues have been opened on the SCT repo, and I will look into them promptly:

Kind regards,

1 Like