if (.not.exist(THEONE_FILE)) then
   message e spectrum "Image not loaded..."
   return error
endif
define integer pix[4] n
let pix 0
!
if (ALLONE%DIM[4].GT.1) THEN
   let pix[4] &3
endif
if (ALLONE%DIM[3].GT.1) THEN
   let pix[3] &2
endif
if (ALLONE%DIM[2].GT.1) THEN
   let pix[2] &1
endif
!
for i 2 to allone%ndim
  if (pix[I].lt.1.or.pix[I].gt.ALLONE%DIM[I]) then
    message e spectrum "Slice out of bounds "'pix[i]'" "'allone%dim[i]'
    return error
  endif
next
!
let n allone%dim[1]
!
define image thespe[n,2] gag_scratch:my_spectrum.gdf double
let thespe[i,j] (i-allone%convert[1,1])*allone%convert[3,1]+allone%convert[2,1]

if (pix[4].ne.0) then
  let thespe[2] allone['pix[2]','pix[3]','pix[4]']
else if (pix[3].ne.0) then
  let thespe[2] allone['pix[2]','pix[3]']
else
  let thespe[2] allone['pix[2]']
endif
dele /var thespe
!
col x 1 y 2 /tab gag_scratch:my_spectrum.gdf
!


