If you change the assignment of fileList in the foreach loop to:
set fileList = ( $fileList Image.$i )
then fileList will be an array. You can extract the Rescale Slope
from the Dicom header like this:
dicom_hdr $fileList[1] | grep Rescale
---
But get rid of the extra garbage with awk, and use it to set scale:
set scale = `dicom_hdr $fileList[1] | grep Slope | awk -F/ '{print $5}'`
---
Then run to3d and 3dcalc:
3dcalc -a ... -expr "a*$scale" ...
Be sure to use double quotes in the 3dcalc expression, in order
to access the $scale variable.
- rick