!------------------------------------------------------------------------
! P_SCALE.GREG
! Procedure to define bitmap scale for multichannel image
! Variables defined in DEFINE.GRAPHIC
! S.Guilloteau 15-Oct-1992
!------------------------------------------------------------------------
!
define logical doextrema
let doextrema &1%extrema.eq.0                  ! No extrema section
let doextrema doextrema.or.(&1%min.eq.&1%max)  ! Extrema are unset?
if (&1%blan.gt.0) then
  let doextrema doextrema.or.(abs(&1%min-&1%blank[1]).le.&1%blank[2])  ! Min is blanked: invalid
  let doextrema doextrema.or.(abs(&1%max-&1%blank[1]).le.&1%blank[2])  ! Max is blanked: invalid
endif
!
define real tmin tmax
if (doextrema) then
  if (&1%blan.gt.0) then
    sic\compute tmin min &1 /blank &1%blank[1] &1%blank[2]
    sic\compute tmax max &1 /blank &1%blank[1] &1%blank[2]
  else
    sic\compute tmin min &1
    sic\compute tmax max &1
  endif
else
  let tmin &1%min
  let tmax &1%max
endif
!
if (scale[1].eq.0) then
  let true_scale[1] tmin
else
  let true_scale[1] scale[1]
endif
if (scale[2].eq.0) then
  let true_scale[2] tmax
else
  let true_scale[2] scale[2]
endif
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
