AFNI Message Board

History of AFNI updates  

|
February 21, 2018 01:19PM
This can be accomplished a few ways. Here is a short script that subdivides based on distance from a particular coordinate. In this case, I just hand-picked it.

#!/bin/tcsh
# subdivide_ROI_by_distance.csh
# subdivide a region of interest based on distance from a particular xyz coordinate

set baseset = MNIa_caez_ml_18+tlrc
set coords = ( '-15' '-4' '-7' )
set maskval = 72
set subn = 3
# calculate distance map for mask (simple euclidean distance)
3dcalc -a $baseset -expr "equals(a,$maskval)*sqrt(($coords[1]-x)^2 + ($coords[2]-y)^2 + ($coords[3]-z)^2)" \
-prefix roi_distmap.nii.gz -overwrite
set maxdist = `3dBrickStat -max roi_distmap.nii.gz`
# subdivide the regions into thirds, for instance
set minsubroi_dist = 0
foreach subroi (`count -digits 1 1 $subn`)
set subroi_dist = `ccalc -float -expr "$maxdist*$subroi/$subn"`
3dcalc -a roi_distmap.nii.gz -b $baseset -expr "equals(b,$maskval)*$subroi*within(a,$minsubroi_dist, $subroi_dist)" \
-overwrite -prefix subroi_$subroi.nii.gz
set minsubroi_dist = $subroi_dist
end
3dMean -max -prefix allsubrois.nii.gz -overwrite subroi_*.nii.gz



Edited 1 time(s). Last edit at 02/21/2018 02:07PM by Daniel Glen.


Subject Author Posted

subdivide atlas region

rolinskira February 16, 2018 04:16PM

Re: subdivide atlas region Attachments

Daniel Glen February 21, 2018 01:19PM

Re: subdivide atlas region

rolinskira February 21, 2018 03:15PM



Sorry, only registered users may post in this forum.

Click here to login