Semi-Automatic Classification Plugin v.4.0 "Frascati"

After a few beta versions, I am glad to announce the release of the new Semi-Automatic Classification Plugin version 4.0 code name "Frascati" (dedicated to the ESA ESRIN located in Frascati (Italy), which is the European centre of Earth observation missions, and it is involved in the development of the Copernicus Sentinel satellites in particular for the acquisition, distribution and exploitation of data).
Semi-Automatic Classification Plugin version 4.0

I have added several new functions both to the user interface and the processing tools. The user manual is available here (pdf).

new SCP menu in located in the main menu bar of QGIS. One of the main achievements is the optimization of the Maximum Likelihood algorithm, which is considerably faster than before.
Another major change is that temporary ROIs are displayed as overlay, avoiding the loading of temporary shapefiles in QGIS. Also, new options allow for the automatic refresh of temporary ROIs changing ROI parameters.
A combo box allows for the rapid visualization of RGB color composites, which is useful for image interpretation.
New custom functions are available for splitting raster bandsconverting classifications to shapefilereclassifying classifications (also using Python expressions).

In particular, a new tab Band calc for calculation of raster bands using the functions provided by NumPy.
With this new tool it is possible to perform operations between raster bands such as: sum, product, sine, logarithm, etc. (for a list of NumPy function see here); also, the advanced array functions available in NumPy can be used in Band calc for calculating vegetation indices and creating expressions (NumPy functions must have the prefix np.); for instance the expression np.where("raster1" > 1, 1, 0)creates a new raster having value 1 where the input raster (i.e. "raster1") is greater than 1 and 0 where input is not greater than 1, which is useful for creating masks (for more information about NumPy function "Where" see here).
The expression can use the file name of the band or the variable name (e.g. "raster1") assigned automatically. Also, the use of the variable "bandset#b" (e.g. "bandset#b1") is accepted where b is the band number of the band set defined in the tab Band set. For instance, NDVI can be easily calculated as ("bandset#b4" - "bandset#b3")/ ("bandset#b4" + "bandset#b3") . Also, it is possible to calculate multiple rasters at once by entering multiple expressions (separated by new line) such as:
"raster1" * "raster2"
"raster3" * "raster4"

which will produce one raster for "raster1" * "raster2" and another one for "raster3" * "raster4".
New tool Band calc (example of NDVI calculation)

The spectral signature plot allows for the calculation spectral distances (i.e. separability) among signatures, such as: Jeffrey-Matusita distance, Spectral angle, Euclidean distance, Bray-Curtis similarity. Very similar signatures are highlighted with red values.
Calculation of signature distances (similar signatures in red)

The Landsat pre processing tool allows for editing the metadata, which is automatically imported from the MTL file if available, in order to convert DN to reflectance. If the MTL file is not found in the Landsat directory, it is possible to select the path to the MTL file.
If MTL file is not available, a list of bands is created and it is possible to insert manually the required data, which is useful for old Landsat images that have different or no metadata.
Also, it is possible to remove bands from the conversion list.
Landsat conversion parameters from the metadata file

Following the list of main changes:
-new Band calculator for raster operations using NumPy functions
-new Landsat pre processing tab for editing metadata
-new SCP menu in the main menu bar
-enhanced the Maximum Likelihood algorithm which is now considerably faster
-temporary ROI are displayed as overlay (rubber band) with a + symbol on clicked pixel
-new option to hide and show the temporary ROIs
-in ROI dock new option for refreshing automatically the temporary ROI while changing ROI parameters
-in ROI dock new option for automatic plot of temporary ROI
-new option for displaying over the region growing cursor vegetation indices such as NDVI and EVI (the latter only for images converted to reflectance)
-new function for displaying the pixel spectral signature with right click on map using ROI pointer
-new combo box in SCP toolbar for quickly displaying RGB color composites of input image (and automatic creation of a virtual raster for band set)
-now the window spectral signature plot allows for the display of signature values in table and calculation of signature distances
-new tool Split in Pre processing tab for splitting raster bands
-new tool Convert classification to vector in Post processing tab for creating a classification shapefile
-new tool Reclassification in Post processing tab for the easy reclassification from Class ID to Macroclass ID and Python expressions are allowed in the definition (e.g. raster < 3)
-enhanced function Clip multiple rasters
-new reset button for resetting the signature list file
-new button in the classification dock for merging spectral signatures obtaining a new one calculated as the average of signature values (without covariance matrix)
-now classes or macroclasses having ID = 0 are allowed and classified as 0 (unclassified) in the output which is useful for creating masks for classes
-in the signature list it is possible to set the color of multiple selected signatures at once (pressing shift and double click on a color) and check/uncheck all with a double click on the checkbox column (S)
-new function (right click with classification preview pointer) displays the algorithm raster of the preview (a raster where every pixel has the value calculated by the algorithm for the class assigned to the pixel thereof) useful for assessing spectral signatures (black pixels are distant from the spectral signatures and white pixels are closer to the spectral signatures)
-now a classification style (.qml file) is saved along with the classification output allowing for displaying classification colors when loading the classification in new qgis projects
-new buttons in tab Band set for exporting the band set to virtual raster or stacked raster (a multi-band .tif file)
-now the signature file path is stored in the project as absolute or relative path according to QGIS project settings
-in Settings added an option for the creation of virtual rasters for certain temporary data (which saves disk space)
-new button in Debug for testing SCP dependencies

I would like to thank to the beta testers for their support. Very soon I am going to post new tutorials.
Some of the main changes are summarized in the following video.

Please, remember that a Facebook group and a Google+ Community are available for sharing information and asking for help about the Semi-Automatic Classification Plugin.