!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! @ l-old-scale
!
! Defines intensity scale (true%scale) from user input (scale) or image
! header
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
if ((scale[1].ne.0).or.(scale[2].ne.0)) then
  let true%scale scale
else if ((size[1].ne.0).or.(size[2].ne.0).or.(range[1].ne.0).or.(range[2].ne.0).or.(first.ne.0).or.(last.ne.0)) then
   define double min max
   @ l-old-vrange.cube &1 range true%vrange
   @ l-old-prange.cube &1 center size
   @ l-old-corner.cube &1
   if (&1%ndim.eq.2) then
      sic\compute min min &1['true%blc[1]':'true%trc[1]','true%blc[2]':'true%trc[2]']
      sic\compute max max &1['true%blc[1]':'true%trc[1]','true%blc[2]':'true%trc[2]']
   else if (&1%ndim.eq.3) then
      sic\compute min min &1['true%blc[1]':'true%trc[1]','true%blc[2]':'true%trc[2]','true%blc[3]':'true%trc[3]']
      sic\compute max max &1['true%blc[1]':'true%trc[1]','true%blc[2]':'true%trc[2]','true%blc[3]':'true%trc[3]']
   else
      message w l-old-scale "Not an image or a cube: ndim = "'&1%ndim'
      let min &1%min
      let max &1%max
   endif
   if ((true%scaling.eq."log").and.(min.eq.0)) then
      ! I hope here that the cube minimum was correctly sic\computed for a logarithmic scale...
      let min &1%min
   endif
   let true%scale 'min' 'max'
else
  let true%scale '&1%min' '&1%max'
endif
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
