ImageThresholdClass

A copy of this file is also available in the \examples\tasks\baseclassexample folder of the ENVI installation path.

PRO ImageThresholdExample::PreExecute, _REF_EXTRA=refExtra

compile_opt idl2, hidden

 

; Call the superclass PreExecute next to ensure required input

; parameters are set before accessing them.

self.enviTaskFromProcedure::PreExecute, _EXTRA=refExtra

 

; Retrieve the value for INPUT_RASTER to set interleave, since

; interleave is hidden must use parameter to set

self.GetProperty, INPUT_RASTER=raster

interleaveParam = self.Parameter('INTERLEAVE')

interleaveParam.Value = raster.Interleave

 

; Get raster statistics to verify parameter values are valid

rasterStatistics = ENVIRasterStatistics(raster)

 

; Set minimum and maximum if not set by user

self.GetProperty, MAXIMUM=maximum, MINIMUM=minimum

if ISA(maximum,/NULL) then begin

  self.SetProperty, MAXIMUM=MAX(rasterStatistics.Max)

endif

if ISA(minimum,/NULL) then begin

  self.SetProperty, MINIMUM=MIN(rasterStatistics.Min)

endif

 

; Verify the minimum and maximum are set to values within the raster

self.GetProperty, MAXIMUM=maximum, MINIMUM=minimum

if maximum GT MAX(rasterStatistics.Max) then begin

  message,'Must set MAXIMUM to a value within the raster'

endif

 

if minimum LT MIN(rasterStatistics.Min) then begin

  message,'Must set MINIMUM to a value within the raster'

endif

 

END

 

PRO ImageThresholdExample::PostExecute, _REF_EXTRA=refExtra

compile_opt idl2, hidden

 

; Call the superclass PostExecute first to copy values

; to matching keywords if passed into Execute

self.enviTaskFromProcedure::PostExecute, _EXTRA=refExtra

 

; Build pyramids for any output ENVIRaster

paramNames = self.ParameterNames()

foreach name, paramNames do begin

  parameter = self.Parameter(name)

  if parameter.Direction ne 'OUTPUT' then continue

  if parameter.Type ne 'ENVIRASTER' then continue

  raster = parameter.Value

  raster.CreatePyramid

endforeach

END

 

PRO ImageThresholdExample__define

compile_opt idl2, hidden

void = {ImageThresholdExample, $

        inherits ENVITaskFromProcedure $

       }

END