fsl img2stdcoord
#!/bin/sh
: <<COMMENTBLOCK
Purpose: convert voxel coordinates to mm coordinates. Why?
Because fslstats -x outputs voxel coordinates and
atlasquery expects mm coordinates.
See also std2imgcoord and img2imgcoord to go the other way.
Input: 1) image name
2) x in voxel coordinates
3) y in voxel coordinates
4) z in voxel coordinates
COMMENTBLOCK
img=$1
voxdimX=$2
voxdimY=$3
voxdimZ=$4
# Use the same img for both -img and -std to omit any trasform to standard space
# This simply translates voxel coordinates to mm coordinates for any image
echo ${voxdimX} ${voxdimY} ${voxdimZ} | img2stdcoord -img ${img} -std ${img}