3dRoimaker: similar ROI sizes

Hello,

I’m trying to create 4 different target masks for tractography. My ROIs differ in size but I would like them to be of (approximately) the same size. Is there a specific option in 3dRoimaker I can use to achieve this?

Many thanks,
Sandra

Hi, Sandra-

Does that mean that you have a single 3D dataset with 4 ROIs already in it, and you would like to differentially inflate them to be of the same (or at least similar) volume?

–pt

Yes, that is exactly what I would like to achieve (and I have already created the single 3D dataset with 4 ROIs)

Hi, Sandra-

Hmm, OK. I don’t know of one single command that can do that. You could inflate them separately/individually, while leaving the other ones there so that nothing overlaps…

Taking a step back, I’m a bit curious about inflating them differentially. Can I ask where the original ROIs come from (anatomical, FMRI, other…)? From purely tractographic considerations, there isn’t really an expectation that the target ROIs are the same size

But if you really want to, theeeeen you could do something like this:


#!/bin/tcsh

set ivol = start_roi.nii  # your starting volume name-- the 3D dset of ROIs

set opref    = INF

set roi_inds = ( 1 2 3 4 ) # whatever the ROI indices happen to be-- don't have to be consecutive
set infl_val = ( 2 3 1 4 ) # how much to inflate each ROI (matching order of ROI inds)
set Nrois    = $#roi_inds


# initialize 
set basevol = "$ivol" 

foreach ii ( `seq 1 1 $Nrois` )
    # will inflate [i]th ROI each time
    set rrr = ${roi_inds[$ii]}

    # make a list of The Other ROIs-- the ones not inflated in this
    # step. '0' just here for being able to put commas from the start.
    set all_others = "0"  
    foreach jj ( `seq 1 1 $Nrois` )
        if ( $jj != $ii ) then
            set all_others = "${all_others},${roi_inds[$jj]}"
        endif
    end

    set ovol   = "${opref}_${ii}"                # inflated ROI this round
    set ovol2  = "${opref}_${ii}_recon.nii.gz"   # infl ROI + The Others

    echo "++ For output dset $ovol, ii=$ii and the others are $all_others"
    
    3dROIMaker -echo_edu                          \
        -inset "${basevol}<${rrr}>"               \
        -refset "${basevol}<${rrr}>"              \
        -inflate "$infl_val[$ii]"                 \
        -wm_skel DTI/DT_FA+orig.                  \
        -skel_thr 0.2                             \
        -skel_stop                                \
        -csf_skel "${basevol}<${all_others}>"     \
        -mask mask_DWI+orig                       \
        -prefix ${ovol}                          \
        -nifti

    # put back together: the newly inflated ROI and The Others
    3dcalc \
        -a "${basevol}<${all_others}>" \
        -b ${ovol}_GMI.nii.gz          \
        -expr 'a + b'                  \
        -prefix "$ovol2"

    # take the inflated one as the basevol for the next pass
    set basevol = "$ovol2"
end

echo "++ Done.  Final volume of interest should be:"
echo "   $basevol"

One way to make equal size ROIs is to put spheres around the centers of each. See this link for some ways to create spheres.

https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/rois_corr_vis/suma_spheres.html

Thanks both, those are good ideas to play with. I’m going to try it out!

@ptaylor I sent a private message about my project :slight_smile: