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
self.enviTaskFromProcedure::PreExecute, _EXTRA=refExtra
self.GetProperty, INPUT_RASTER=raster
interleaveParam = self.Parameter('INTERLEAVE')
interleaveParam.Value = raster.Interleave
rasterStatistics = ENVIRasterStatistics(raster)
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
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
self.enviTaskFromProcedure::PostExecute, _EXTRA=refExtra
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