#!/bin/csh -f
# Gets the talairach resolution (in mm) based on the number of slices

if($#argv != 1) then
  echo "USAGE: gettalres instem"
  exit 1;
endif

set instem = $argv[1];

set nslices = `getnslices $instem`;
if($status) then
  echo "ERROR: getnlices: $nslices"
  exit 1;
endif

switch ($nslices)
  case  "32": 
    set res = 8; breaksw;
  case  "64": 
    set res = 4; breaksw;
  case "128": 
    set res = 2; breaksw;
  case "256": 
    set res = 1; breaksw;
  default:
    echo "ERROR: $instem has $nslices slices, can determine tal res"
    exit 1;
    breaksw;
endsw

echo $res;

exit 0;
