CreateClassMap

Declaration: CreateClassMap (ScllList: TStringList; ClassesToInclude: TIntArray; ClassMode: integer; CMapName: string; CMapData: TMat4D; CMapMetaData: TMetaData; CMapDSet: TIlabTrnDataSet; FeedBack: boolean): integer;
The function CreateClassMap generates a class map from a set of spectral collections. The idea behind a class map is the compilation of selected spectra into an artificial image. The spectra are extracted from spectral collections and are arranged in a pattern of roughly quadratic regions which contain spectra originating from the same collection and having a common class number. The figure below shows an example of a class map consisting of six classes and origination from four different spectral collections. The yellow pixels in the map are empty (due to the fact that not all classes in all spectral collections have the same number of spectra). In addition to the actual hypercube of the class map (parameters CMapData and CMapMetaData) CreateClassMap also creates a corresponding dataset (parameter CMapDSet) which can be used as a training set for subsequent processing.

The parameter ScllList contains the list of the filenames of the spectral collections to be combined into the class map. The first entry of the file list is the master collection which controls the spectral type and spectral scaling of the class map. The array ClassesToInclude contains the class numbers to be included into the class map.

The ClassMode parameter controls which information is used as class information when creating the corresponding dataset CMapDSet. A zero value assigns the classes according to the classes in specified in ClassesToInclude, a value of one assigns the classes according to the spectral collections in ScllList.

The parameter CMapName specifies the filename of the saved class map. If you leave it blank the resulting class map is not saved to disk. If CMapName contains a full path both the class map and the dataset are stored in the specified folder, if CMapName does not contain a full path, the classmap is stored in the Epina ImageLab work directory and the dataset is stored in the TDTS subfolder of it.

The paramters CMapData and CMapMetaData contain the raw data and the meta data of the created class map, respectively.

The parameter Feedback determines whether a progress bar indicates the progress of the calculations. Please note that unless the script progress bar is already visible you have to make it visible before calling CreateClassMap, otherwise the feedback will not be displayed. You can activate the script progress bar by calling the function ScriptBar(0).

The function returns the following error numbers:

 0 ... everything is OK
-1 ... invalid ClassMode
-2 ... empty ScllList
-3 ... empty ClassesToInclude
-4 ... specified ScllList does not contain the specified classes
-5 ... Data or MetaData does not exist in memory
-6 ... cannot find the master .ilab file (derived from SclList[0]) -11 ... error when saving the .cube file
-13 ... error when saving the .scll file
-14 ... error when saving the .ilab or the .pcmp file
-15 ... error when saving the .anno file