vertices in a specific anatomical region above a given q threshold

Hi - what is the best way to calculate the number of vertices in a specific anatomical region above a given q threshold?

Thanks!

Some variants of these steps would work:

set minimum and maximum values

set minthresh = 3.3
set maxthresh = 100

which ROI to use

set roiindex = 4

count thresholded values within mask region

3dBrickStat -count -non-zero -mask rois.niml.dset"<$roiindex>" stats.niml.dset"<$minthresh…$maxthresh>"

or in two steps like this:

First limit the number of vertices to the region with something like this

3dcalc -a rois.niml.dset -b stat.niml.dset -expr “equals(a,$roiindex)*b” -prefix maskedstat.niml.dset

Count nodes in masked stats above threshold

3dmaskdump -noijk -mask maskedstats.niml.dset"<$minthresh…$maxthresh>" maskedstats.niml.dset | wc -l