AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
March 13, 2019 11:46PM
You could do something like the following short script to create a line in space. At each point, in the line you could also run whereami with an xyz coordinate on the command line to find regions at each of the points. Here, whereami -omask gives a convenient way to get all the regions in one step.

#!/bin/tcsh
# compute a line in a dataset
# usage: makeline3D.csh dset x1 y1 z1 x2 y2 z2
# assumes xyz values are in RAI order

set dset = $1
set x1 = $2
set y1 = $3
set z1 = $4
set x2 = $5
set y2 = $6
set z2 = $7

# compute distance
set origdist = `ccalc "sqrt(($x2-$x1)^2+($y2-$y1)^2+($z2-$z1)^2)"`

# create normalized vector
set normx = `ccalc "($x2-$x1)/$origdist"`
set normy = `ccalc "($y2-$y1)/$origdist"`
set normz = `ccalc "($z2-$z1)/$origdist"`
# create xyz file
echo "# x y z" > xyzline.1D

# do this in a minimum number of steps based on voxel size
set voxsize = `@GetAfniRes -min $dset`
set stepdist = `ccalc "$voxsize/$origdist"`
set nsteps = `ccalc "1/$stepdist"`

# create line by fractional increments of distance
foreach disti (`count 1 $nsteps`)
set dist = `ccalc "$disti * $origdist/$nsteps"`
set newx = `ccalc "$x1+$dist*$normx"`
set newy = `ccalc "$y1+$dist*$normy"`
set newz = `ccalc "$z1+$dist*$normz"`
echo $newx $newy $newz >> xyzline.1D
# could query atlases with whereami here for each xyz coordinate
# but let's do it all at once below
end

# create a new dataset from the xyz values
3dUndump -master $dset -prefix xyzline3D.nii.gz -datum byte -xyz \
-orient RAI -overwrite xyzline.1D
whereami -omask xyzline3D.nii.gz
Subject Author Posted

How to draw ROIs in the volume?

jiaxin March 12, 2019 06:38AM

Re: How to draw ROIs in the volume?

Daniel Glen March 13, 2019 11:46PM

Re: How to draw ROIs in the volume?

jiaxin March 15, 2019 12:56AM

Re: How to draw ROIs in the volume?

Daniel Glen March 15, 2019 04:28PM

Re: How to draw ROIs in the volume?

jiaxin April 03, 2019 08:28AM

Re: How to draw ROIs in the volume?

Daniel Glen April 03, 2019 03:30PM