Is there any methods to align native ROI masks on MNI space?


I would like to ask how to align native individual ROI masks drawn on SUMA (.niml.roi format) on the MNI space.

It seems that the way to back transform MNI based ROI masks to native space definitely. However, I could not find a way to reverse it.

May I ask you to let me know how to transform native ROI to MNI space?

AFNI version info (afni -ver): Jan 11 2024 (Version AFNI_24.0.01 'Caracalla')

The alignment is usually done on some smooth intensity dataset like a T1 or T2 dataset aligned to a similar template dataset like the MNI152_2009c_template(_SSW) dataset in our distribution. Depending on the alignment program, you might use slightly different options. With the @SSwarper program, for instance, this is an example command:

3dNwarpApply -nwarp 'anatQQ.subid_WARP.nii anatQQ.subid.aff12.1D' \
  -base ~/abin/MNI152_2009_template_SSW.nii.gz -input myrois.nii.gz \
  -ainterp NN -prefix myrois_MNI.nii.gz

Thank you so much!

It helped.


Another option here:

  • Convert your subject's *.niml.roi dataset to a *.niml.dset in that subject standard mesh in the standard way (described below).
  • Because the mesh is standard you, can then think about just placing that mesh on the MNI template dataset's mesh, and then converting that to a volume there using 3dSurfToVol.

Even though the above suggestion of using nonlinear volumetric alignment (@SSwarper or 3dQwarp, say), the surface-mesh-based approach here would be faster, and avoid an intermediate round of interpolation.

So, in more detail:

  • check out how to convert the ROI-dset to a NIML-dset in this AFNI Academy video, which uses the AFNI Bootcamp demo data in AFNI_data6/FT_analysis/FT/SUMA, and basically means use this command (which is for a left hemisphere ROI, but you could obviously change "lh" to "rh" pretty easily here and below):
     ROI2dataset -prefix $prefix.lh.niml.dset -input $prefix.lh.niml.roi
  • Grab one of the MNI space surface meshes data directories that we have using one of the following commands (or copy+paste the link into a browser); probably you would want the first one in the list here, but I put the rest for completeness:
    curl -O       
    curl -O
    curl -O        
    curl -O        
    curl -O        
    curl -O        
    curl -O        
    curl -O        
    curl -O           
  • then go into the directory of that dataset, copy over your specific NIML-dset that you created above from drawing+converting, and basically run the 3dSurfToVol command shown in the video or script in the Bootcamp demo directory:
     3dSurf2Vol                      \
     -spec std.141.MNI152_2009_lh.spec     \
     -surf_A smoothwm             \
     -surf_B pial                 \
     -sv FT_SurfVol.nii           \
     -grid_parent MNI152_2009_SurfVol.nii  \
     -map_func mode               \
     -f_steps 12                  \
     -sdata $prefix.lh.niml.dset  \
     -prefix $prefix.lh.s2v.roi.nii.gz

... and you should have a shiny, new volumetric ROI in MNI-2009 space. Please let us know how that goes.


Thank you so much. I also tried it through the 3dSurf2Vol function. But I used -map_func mask rather than mode. Is the function (-map_func mask) off from the purpose compared to 'mode'?

Here is the mode I tried.

-sdata_1D $ROI''$HEMI'forAFNI.1D.dset'
-spec $mni_dir/MNI_N27
-surf_A $mni_dir/$HEMI'.pial.gii'
-sv $mni_dir'/MNI_N27_SurfVol.nii'
-grid_parent $mni_dir'/MNI_N27_SurfVol.nii'
-map_func mask
-prefix $ROI'

The mode and nzmode are useful when mapping multiple ROIs from the surface into a volume, say from an atlas defined on a surface. I have found that the MNI2009c surface mappings may not work as well as the MNI_N27, but they are usually at least roughly correct. When mapping from the surface to the volume, also consider @surf_to_vol_spackle. In the projection from surface to volume, some voxels may be missed, and that program helps to fill in the gaps - if you are filling a segmented mask, like the cortical ribbon mask. You can also optionally smooth within that mask using 3dLocalstat -stat mode or nzmode.

Oh, thank you so much for the additional tips, also.