This is a behaviour of AFNI's 3dROIMaker that we need to account for. From the 3dROIMaker documentation (https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dROIMaker.html):
If an INSET ROI has no corresponding REFSET label, then the former is marked with an integer greater than the max refset label.
Affected code blocks here:
https://github.com/McIntosh-Lab-RRI/tvb-ukbb/blob/3cebec9f0d26ddfb75b82ea7b5ae678a770eb505/bb_structural_pipeline/bb_struct_init#L295
and here:
https://github.com/McIntosh-Lab-RRI/tvb-ukbb/blob/3cebec9f0d26ddfb75b82ea7b5ae678a770eb505/bb_diffusion_pipeline/bb_probtrackx2/bb_pre_probtrackx2#L26
Solution:
- use
fslmaths to detect max integer label of reference image (refset)
- then use that integer with
fslmaths to threshold labelled image output of 3dROImaker