13153 Rate this article:
No rating

ENVITask: New and Improved in ENVI 5.2


As I blogged about back in February, ENVI 5.1 introduced ENVITask as the new API for analytics. For the just released ENVI 5.2 we have added a lot of new tasks and supporting functionality. In the ENVI 5.1 release, we had 4 tasks, in ENVI 5.2 we now have 58:

IDL> nv = ENVI()


AutoChangeThresholdClassification BuildBandStack BuildRasterSeries BuildTimeSeries ChangeThresholdClassification ClassificationAggregation ClassificationSmoothing ClassificationToShapefile ColorSliceClassification DarkSubtractionCorrection DimensionsResampleRaster EqualizationStretchRaster FXSegmentation ForwardICATransform ForwardMNFTransform ForwardPCATransform GaussianStretchRaster GramSchmidtPanSharpening ISODATAClassification ImageBandDifference ImageIntersection ImageThresholdToROI LinearPercentStretchRaster LinearRangeStretchRaster LogStretchRaster MahalanobisDistanceClassification MappingResampleRaster MaximumLikelihoodClassification MinimumDistanceClassification NNDiffusePanSharpening OptimizedLinearStretchRaster PCPanSharpening PercentThresholdClassification PixelScaleResampleRaster QUAC QuerySpectralIndices ROIToClassification RPCOrthorectification RXAnomalyDetection RadiometricCalibration RadiometricNormalization RasterStatistics RasterViewshed RegridRaster RegridRasterSeriesByIndex RegridRasterSeriesByIntersection RegridRasterSeriesByUnion ReprojectGLT RootStretchRaster SpectralAngleMapperClassification SpectralIndex SpectralIndices ThematicChange TrainingClassificationStatistics VectorAttributeToROIs VectorRecordsToROI VegetationSuppression VideoToRasterSeries


There isn't enough space to go into details about them all here, but we have documentation with example code for each. Just look under Programming > Routines > Data Processing in the ENVI help contents to find them all (or here on the web). Or if you're feeling more adventurous you can just request a task using the enviTask() factory function and inspect the task object itself, since it provides a lot of introspection and self-documentation.

We have added a couple of new properties to enviTaskParameter, MIN and MAX. These are only applicable for numeric types, and provide for bounded or unbounded range validation. These represent inclusive bounds, so if MIN = 0 then VALUE ≥ 0. These are both optional properties on any parameter, and can be specified independently if the range is unbounded.

Besides adding a lot of tasks to our catalog, a lot of work gone into ensuring that each and every one of these enviTasks can be invoked on an ENVI Services Engine server. These are published under a special ENVI service, so the URL to find them will be http://<host>:<port>/ese/services/ENVI. We have expanded the datatypes supported by ESE to allow all 58 of the ENVITasks to be run. Look under Writing Tasks > Data Types > ENVI Data Types in the ESE help to learn how to specify these new types.

Another new feature is what we call the dynamic UI for ENVITasks. If you have an ENVITask object, you can pass it into an ENVIUI method to build a dialog to set all the parameters. If you have some of the parameters already set, those  values will appear in the dialog. Here is a quick example of how to do this:

IDL> e = ENVI()

ENVI> oTask = enviTask('NNDiffusePanSharpening')

ENVI> ret = e.UI.SelectTaskParameters(oTask)

The return value of the function is the name of the button pressed by the user, either "OK" or "Cancel". Here is the dialog that shows up for the NNDiffusePanSharpening task:

As you can see, different parameter types will use different widgets to allow user input. Clicking on the input raster widgets will open up the standard ENVI raster selection dialog, complete with spatial and spectral subsetting options. The Pixel_Size_Ratio parameter is an integral type, so we have the spinner box, and the two smoothness parameters are floating point so they are specialized text entry widgets that only allow numbers to be typed in. You'll also notice the Output_Raster parameter has been populated with a filename, using the $TEMP environment variable for the path and the task name as the filename. This can easily be changed by typing in a new filename, or using the "..." button to use the file selection dialog to pick an output location and name. The ? button at the bottom will bring up a help page describing each of the parameters in detail. The Preview button can be checked to run the task at the current viewport resolution and spatial extents, and will load the results into the view so you can verify if these are the parameter values you want. Once you hit OK, the task will be run on the full input data and saved to the files you specified.