History of AFNI updates  

|
April 09, 2019 04:09PM
Hi, Jim-

OK. How about the following?

From how you described your question, I was assuming that you have the list of "x y z" coordinates in a certain orientation defined already (your "meta-analytic maxima coordinate(s)"). I call this file "coor_centers.txt", below. And you can put in the name of the file whose contents you are probing in this variable (in whatever space):
"set vmast = DSET_OF_INTEREST"

One important assumption is that the spheres are *not* contiguous/overlapping/touching. Here, only one max would be found for such a "chain" of spheres.

#!/bin/tcsh

set coor_sph  = coor_centers.txt
set vmast     = DSET_OF_INTEREST

# make binary mask of *isolated* spheres centered around ${coor_sph} locations
3dUndump                              \
    -overwrite                        \
    -xyz                              \
    -orient RAI                       \
    -prefix f00_roi_sph.nii.gz        \
    -master "${vmast}"                \
    -datum byte                       \
    -srad 2.1                         \
    ${coor_sph}

# multiple that mask of spheres times the dset of interest-- i.e., punch out sphere regions from that dset of interest
3dcalc                                \
    -overwrite                        \
    -a "${vmast}"                     \
    -b f00_roi_sph.nii.gz             \
    -expr 'step(b)*a'                 \
    -prefix f01_dset_sph.nii.gz

# for each isolated sphere, make a map of single maximum value
3dROIMaker                            \
    -overwrite                        \
    -inset  f01_dset_sph.nii.gz       \
    -prefix f02_dset_sph_max          \
    -only_some_top 1                  \
    -nifti

# dump the max locations+values to a text file
3dmaskdump                            \
    -xyz                              \
    -noijk                            \
    -mask f02_dset_sph_max_GM.nii.gz  \
    "${vmast}"                        \
    > f03_sph_max_loc.txt

How does that look?

--pt
Subject Author Posted

Getting maxima value voxel within a spatial mask

jmbjork April 09, 2019 03:31PM

Re: Getting maxima value voxel within a spatial mask

ptaylor April 09, 2019 04:09PM

Re: Getting maxima value voxel within a spatial mask

rick reynolds April 09, 2019 05:08PM

Re: Getting maxima value voxel within a spatial mask

Daniel Glen April 10, 2019 09:59AM

Re: Getting maxima value voxel within a spatial mask

jmbjork April 11, 2019 10:36AM