Use the N-Dimensional Visualizer to identify and cluster the purest pixels in a dataset in n-dimensional space. The N-Dimensional Visualizer scatter plot helps you visualize the shape of a data cloud that results from plotting image data in spectral space.

The goal with the N-Dimensional Visualizer is to visually identify and distinguish the purest pixels in the image. The purest pixels always form the very tip of a corner in the data cloud. Each corner corresponds to one spectrally-unique material in the image; therefore, you should try to find all the corners of the data cloud and assign each corner to a different class. Once you separate the purest pixels into different classes, you can use the spectrum from those classes as the endmembers for spectral analysis. You can rotate the data in n-dimensional space, add and define classes, and refine and collapse classes to make additional class selections easier.

For additional details, see Locating Endmembers in a Spectral Data Cloud.

The N-Dimensional Visualizer is accessed from the following:

See the following sections for details on the N-Dimensional Visualizer:

Start the N-Dimensional Visualizer from the Toolbox


If you are starting the N-Dimensional Visualizer from the ENVI Toolbox, open the data in one of the following ways. You can skip this step if you are accessing it from the Spectral Hourglass Workflow or Region of Interest Tool, as the data will already be open.

  1. From the Toolbox, select Spectral > N-Dimensional Visualizer. The N-Dimensional Visualizer dialog appears.
  2. Select the data to load from the drop-down list. The options are:

    • From MNF and PPI:

      Select an MNF Raster file, a PPI Raster file, and set the Max. PPI Pixels to Use in the N-Dimensional Visualizer. Spectrally subset the MNF data to exclude noise bands, which can be determined by reviewing the eigenimages and eigenvalue plot.

    • From Raster and ROIs:

      Select a Raster file and open a Region of Interest file. In the ROI Selection dialog that appears, select the ROI to use.

    • From Previous State File:

      Select a .sav file created from a previously-saved N-Dimensonal Visualizer state.

Auto Cluster Classes


The Cluster tool to automatically clusters pixels into base classes. If you are accessing the N-Dimensional Visualizer from the ENVI Toolbox or the Region of Interest Tool, the only available classes will be "nD Unclassified" and "nD Class." Clustering will give give you a starting point to rotate and refine the clusters of pixels in the data cloud into class groups.

If you are accessing the N-Dimensional Visualizer from the Spectral Hourglass Workflow, classes will already be pre-clustered when the N-Dimensional Visualizer window opens.

From the Cluster drop-down list , select one of the following methods:

  • Classic: You need MNF and PPI files for your data to use this method. It finds the pixel with the highest PPI score and uses it as the seed for the first cluster. Then it iteratively creates more clusters until either the number of clusters is one more than the number of MNF bands used, or the inherent dimensionality of the data is reached. A second phase to cluster groups pixels that are near these corner points, and reconciles clusters that may need to be joined, and checks the dimensionality of the simplex formed by the cluster means.

  • K-Means: Performs a K-Means classification on the full data cloud and then runs a refine-by-mean on each resulting class to determine the result.

While clustering is a useful tool, you can improve the result when you explore the data and define corner clusters manually.

Select the Scatter Plot Dimensions and Rotate


Click on the band numbers at the bottom of the N-Dimensional Visualizer window to select the bands (dimensions) to include in the scatter plot.

  • Select at least two bands to see data in the scatter plot.

  • Select three bands to use manual rotation.

  • Select three or more bands to use animated rotation.

You can zoom and pan the scatter plot using the mouse wheel. To reset the plot after zooming or panning, click the Reset Plot Range button .

To manually rotate the axes:

  1. Enable the Axes check box if you want to display the axes in the scatter plot.
  2. Click the Drive Axes button , then use the left mouse button to click and drag the data cloud to manually rotate the axes of the 3D scatter plot.

To automate axes rotation:

Use the animation buttons to automate rotating the plot axes. You must have 3D or more selected to automate rotation.

  1. Enable the Axes check box if you want to display the axes in the scatter plot.
  2. Use the animation buttons do the following:

    • Step Backwards through the rotation.
    • Pause rotation.
    • Play Forwards Plays a continuous rotation.
    • Step Forwards through the rotation.
    • Play Back and Forth Rotates back and forth continuously.
    • New Random Projection ENVI randomly selects a new projection, which can help you get to a desired projection quicker.

You can use the Refine tool to automatically refine the pre-clustered results. How to manually refine the results is described next.

To determine which pixels correspond to different image endmembers, you can rotate the data cloud until the pixels form a protrusion, or arm, out of the data cloud. When a distinct corner becomes visible, stop the animation and use one of the tools described in Create and Manage Classes to select the most extreme corner pixels to signify that they represent one endmember. It is best not to select all of the pixels that cluster into a corner. If possible, try to identify only the few pixels in that corner that form the most extreme tip of the corner. These pixels contain the largest fraction of that particular endmember material. The less extreme pixels contain larger fractions of other materials. A corner may consist of tens of clustered pixels or only one or two similar pixels.

After you have defined the corner pixels, watch the data cloud rotate, and make sure that the pixels you selected stay together in all projections. Change the dimensions (bands) used in the scatter plot periodically, so that every band is ultimately included in the scatter plot. This ensures that all of the pixels you have identified as being in the same class really do have similar values at all wavelengths. If the pixels do not cluster in all projections, they do not correspond to the same material. If you find that some of the pixels separate from the rest of the class in some projections, then you can delete those pixels from the class, which is described in Manage Classes.

Manage Classes


The Classes panel to the right of the scatter plot lists all the defined classes, including the nD Unclassified class. Each class has an assigned color, with the number of pixels it contains (in parenthesis).

Typically, classes are defined when groups of pixels stay together during rotation and are separated from the rest of the pixels.

Add and Delete Classes

To add classes:

  1. Click the Add Class button. Or, right click the Classes folder and select Add Class.

  2. You can change the class color from the Current Class Color drop-down list .

To delete classes:

  • To delete the active class, click the Delete Class button . Or, right-click the class in the Classes list and select Delete Class.

  • To delete all classes, click the Delete All Classes button . Or, right-click the Classes folder and select Delete Classes.

Add Pixels to a Class

  1. Select the class.

  2. Use one of the following to select pixels:

    • Use the Polygon Lasso tool to select larger groups of pixels for a class. Select a class and click the Polygon Lasso button, then draw a polygon around the pixels to select. The pixels are marked with the class symbol in the color for that class.

    • Use the Paintbrush tool to select smaller groups of pixels. Select a class and click the click the Paintbrush button, then click or drag to select the pixels. The pixels are marked with the class symbol in the color for that class.

    You can change the class symbol used to mark the pixels in the Properties window.

Clear Classes

To remove pixels from a class:

  • To remove some of the pixels from a class, select the class, then press the Shift key and use the Polygon Lasso or the Paintbrush to select the pixels to remove.

  • To clear all pixels from a active class, right-click and select Clear Class

  • To clear all pixels from all classes, right click the Classes folder and select Clear All.

Merge Classes

  1. In the Classes list, right-click the class you want to merge from and select Merge Class with.

  2. From the Merge Class with context menu, select the class you want to merge to.

    The class you selected to merge from is removed from the Classes list.

Refine Classes


The Refine tool automatically reduces the number of pixels in a class by comparing thousands of different projections. It keeps only the pixels that remain adjacent throughout those projections. The selected bands that are selected when the Refine tool is run will affect the result.

To refine classes by mean:

  • To refine the active class by mean, select [Active Class] By Mean from the Refine drop-down list . Or, right-click the class in the Classes list and select Refine Class by Mean.

  • To refine all classes by mean, select [All] By Mean from the Refine drop-down list .

To refine classes by using the Pixel Purity Index score:

  • To refine the active class by PPI score, select [Active Class] By PPI Score from the Refine drop-down list . Or, right-click the class in the Classes list and select Refine Class by PPI Score.

  • To refine all classes by PPI score, select [All] By PPI Score from the Refine drop-down list .

Collapse Classes


You can collapse the classes by means or by variance to make class definition easier. Both methods iteratively collapse the data cloud based on the defined classes. You need at least two classes with one or more pixels in them to collapse classes.

Select one of these options from the Collapse drop-down list :

  • By Mean: The space spanned by the spectral mean of each class is derived through a modified Gram-Schmidt process. The complementary, or null, space is also calculated. The dataset is projected onto the null space, and the means of all classes are forced to have the same location in the scatter plot. For example, if you have identified two classes in the data cloud and you collapse the classes by their mean values, ENVI arranges the data cloud so that the two means of the identified classes appear on top of each other in one place. As the scatter plot rotates, ENVI only uses the orientations where these two corners appear to be on top of each other.

  • By Variance: ENVI calculates the band-by-band covariance matrix of the classified pixels (lumped together regardless of class), along with eigenvectors and eigenvalues. A standard principal components transformation is performed, packing the remaining unexplained variance into the low-numbered bands of the collapsed data.

    Collapsing by variance is often used for partial unmixing work. For example, if you are trying to distinguish very similar (but distinct) endmembers, you can put all of the other pixels of the data cloud into one class and collapse this class by variance. The subtle distinctions between the unclassified pixels are greatly enhanced in the resulting scatter plot.

  • Uncollapse: Uncollapses the data and returns to the original dataset.

Save and Restore the N-Dimensional Visualizer State


You can save and restore the state of the N-Dimensional Visualizer, including the classes highlighted groups of pixels. You can restore the saved state in future N-Dimensional Visualizer sessions.

  • Select File > Save to save the N-Dimensional Visualizer state. Enter an output filename with the extension .sav.
  • To restore a previously saved state:

    • Select File > Restore from the N-Dimensional Visualizer window menu and open the file.

    • If you are starting the N-Dimensional Visualizer from the Toolbox, select the From Previous State File option to open data, then specify the .sav file.

Export the Result to the Data Manager


Select Export Result to Data Manager to add the nD Class Result to the Data Manager. The result contains the ROIs created during the N-Dimensional Visualizer session. From the Data Manager, you can save the ROIs to an .xml file by right-click the result and selecting Save As.

Additional Identification Tools


Import Spectra

You can import spectra from a raster in the View to compare it in the scatter plot.

  1. Click in the raster to select a pixel. The spectra for that pixel is added to the Spectral Plot.

  2. Add the spectra to the N-Dimensional Visualizer with one of the following

    • Right-click on the Classes panel and select Import Spectra, then select the spectra to import from the list.

    • Click to expand plot properties panel of the Spectral Profile, then drag the spectra to the Classes panel. The imported spectra is added to a Plots list in the Classes panel.

Note: Note that some spectra may fall outside the current projection and will not be visible until you rotate the data.

Identify a Pixel

To determine the location of a pixel in the input raster:

  1. Click the Locate Pixel in Image button .

  2. Click on a pixel in the scatter plot. The pixel is highlighted in the image in the View.

Identify a Class

To identify a class:

  1. Right-click the class in the Classes list and select Identify Class. The Data Selection dialog appears.

  2. Select the input raster and click OK.

The ROI Statistics View and the Material Identification Tool appear.

Plot Mean Spectra for a Class

To plot the mean spectra for the selected class:

  1. Right-click the class in the Classes list and select Mean Spectra. The Data Selection dialog appears.

  2. Select the input raster and click OK. Typically, this file contains reflectance data.

If a Spectral Profile window is active, the mean spectra are automatically extracted from the file opened in the Spectral Profile.

N-Dimensional Visualizer Property Settings


Animation Speed: Sets the animation speed.

Class Symbol: The symbol to use for defined classes. Use the drop-down list to select a different symbol.

Cluster Maximum Classes: The maximum number of classes to create when clustering.

Cluster Distance: The distance in data units for pixels to be considered as part of the same cluster.

Refine Distance (pixels): The distance at which to do refinement (in pixels).

Refine Iterations: The number of projections to use when refining classes.