Hi Lukas,
Those tag coordinates can be subtracted from the origin via
the '3drefit -dxorigin ...' command. The only difficulty is
getting the xyz order correct. The 3drefit command takes xyz
to be RAI.
For example, if a dataset is ASL orientation, then 'A' is the
second coordinate of RAI, 'S' is the third (I/S is third), and
L is the first. See the 'set order' command near the top of
the following script. Modify that line for your orientation.
Note that 'awk' is used in case 3dAttribute outputs values
(near 0.0) in scientific notation.
You will have to re-indent the script, or let me know if you
would like a nicely formatted version sent via email.
- rick
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/tcsh
if ( $#argv != 2 ) then
echo usage: $0 inset outset_prefix
exit
endif
set inset = $1
set outset = $2
# -----------------------------------------------------------------
# first note the orientation order
#
# since this dataset is in ASL orientation, RAI xyz leads to subscripts:
# 2 (A/P is 2 in RAI), 3 (I/S is 3 in RAI), 1 (L/R is 1 in RAI)
set order = ( 2 3 1 )
# -----------------------------------------------------------------
# get negative tag locations to subtract them via "3drefit -dxorigin..."
set tags = ( `3dAttribute TAGSET_FLOATS $inset | \
awk '{printf "%f %f %f", -$1, -$2, -$3}' ` )
echo tags = $tags
# -----------------------------------------------------------------
# make a new dataset
3dcopy $inset $outset
if ( $status ) then
echo "command failed: 3dcopy $inset $outset"
echo "does output file '$outset' already exist?"
exit
endif
# -----------------------------------------------------------------
# carry out 3drefit command
#
3drefit -dxorigin $tags[$order[1]] -dyorigin $tags[$order[2]] \
-dzorigin $tags[$order[3]] $outset+orig