HSImage
Hyperspectral Image Interface Library for ENVI-BIL image files
All Classes Functions Variables Typedefs Groups Pages
Public Member Functions | Static Public Attributes | List of all members
HSI.classified_hsimage Class Reference

This class provides an interface for labeled and classified ENVI-BIL hyperspectral images. More...

Public Member Functions

def __init__
 Constructor Default constructor to create empty classified_hsimage instance.
 
def __init__
 Constructor. More...
 
def __init__
 Constructor (Recommended) More...
 
def getClassSpectra
 
def getClassTF
 getClassTF More...
 
def getAvgClassTF
 getAvgClassTF More...
 
def getPixelClass
 getPixelClass More...
 
def setSpectraClass
 setSpectraClass More...
 
def setSpectraClass
 setSpectraClass More...
 
def setImageClass
 setImageClass More...
 
def getImageClass
 setImageClass More...
 

Static Public Attributes

tuple hsimage = hsimage()
 getClassSpectra More...
 

Detailed Description

This class provides an interface for labeled and classified ENVI-BIL hyperspectral images.

It requires either a loaded hsimage instance, an OpenCV image and a list of ("name", [color]) tuples or a full set of hyperspectral image files: header (.hdr), image (.raw) and a label (.lif) file. Using the method with the .lif files is recommended. This method assumes that the spectrometer files have been previously loaded with the hsimage instance and have been saved to the (.hdr) file. This happens automatically if the spectrometer files are loaded with the hsimage instance.

Definition at line 131 of file HSI.dxy.

Constructor & Destructor Documentation

def HSI.classified_hsimage.__init__ (   img,
  label_img,
  label_colors 
)

Constructor.

Constructor for loading with hsimage instance, OpenCV Label image and vector of class name and color tuples

Parameters
imghsimage instance
label_imgnumpy array compatible with OpenCV containing 3-channel colors for the different classes present in the image
label_colorslist of ("name",[blue,green,red]) tuples associating the class names to the appropriate color in the label_img
Returns
classified_hsimage classified_hsimage instance

Definition at line 144 of file HSI.dxy.

def HSI.classified_hsimage.__init__ (   image_file,
  header_file,
  label_file 
)

Constructor (Recommended)

Constructor for loading from file system using the image (.raw), header (.hdr) and label (.lif) files. This method assumes that at some previous time the spectrometer files have been loaded in the image and stored in the image .hdr file. If you are unsure that this has happened, load the underlying hsimage into memory and specify the spectrometer file locations. You can can also check to see if the end of the header file has the spectrometer file locations stored at the end of the file.

Parameters
image_fileImage (.raw) file
header_fileHeader (.hdr) file
label_fileLabel (.lif) file
Returns
classified_hsimage classified_hsimage instance

Definition at line 153 of file HSI.dxy.

Member Function Documentation

def HSI.classified_hsimage.getAvgClassTF (   class_name)

getAvgClassTF

Gets the mean reflectance spectrum of a specific class. Returns one spectrum.

Parameters
class_nameName of class to retrieve
Returns
List[float] Returns a list of floats containing the average spectrum of a class

Definition at line 181 of file HSI.dxy.

def HSI.classified_hsimage.getClassTF (   class_name,
  num_spectra 
)

getClassTF

Gets the reflectance (transfer function) spectra from a specific class by name

Parameters
class_nameName of class to retrieve
num_spectraNumber of spectra to return. -1 to return all class reflectance spectra
Returns
List[List[float]] Returns a nested list of floats containing the returned reflectance spectra in the requested class

Definition at line 174 of file HSI.dxy.

def HSI.classified_hsimage.getImageClass ( )

setImageClass

Sets the class(es) of the getImageClass

Returns the OpenCV compatilble numpy array showing the class labels by color at each pixel of the image.

Returns
np.array OpenCV compatible numpy array

Definition at line 221 of file HSI.dxy.

def HSI.classified_hsimage.getPixelClass (   row,
  col 
)

getPixelClass

Gets the class of a specific (row,col) pixel and returns it as a string

Parameters
rowRow of pixel to retrieve
colColumn of pixel to retrieve
Returns
String Name of class of retrieved pixel

Definition at line 189 of file HSI.dxy.

def HSI.classified_hsimage.setImageClass (   class_labels,
  class_list 
)

setImageClass

Sets the class(es) of the whole image to a new set based on the class_labels input which is an image colored with the class information

Parameters
class_labelsOpenCV compatible numpy array where each point is colored with the corresponding class color
class_listList of tuples of class name and corresponding color

Definition at line 211 of file HSI.dxy.

def HSI.classified_hsimage.setSpectraClass (   row,
  col,
  class_name 
)

setSpectraClass

Sets the class of one pixel by (row,col) to a new class by name

Parameters
rowRow of pixel to change class
colColumn of pixel to change class
class_nameNew class name for updated pixel

Definition at line 197 of file HSI.dxy.

def HSI.classified_hsimage.setSpectraClass (   pixel_locs,
  class_name 
)

setSpectraClass

Sets the class of a set of pixels to a new class by name

Parameters
pixel_locsA list of (row,col) tuples for each pixel to update
class_nameNew class name for updated pixel

Definition at line 204 of file HSI.dxy.

Member Data Documentation

tuple HSI.classified_hsimage.hsimage = hsimage()
static

getClassSpectra

Gets a number of wavelength spectra from a specific class by name

Parameters
class_nameName of class to retrieve
num_spectraNumber of spectra to return. -1 to return all class spectra
Returns
List[List[float]] Returns a nested list of wavelength spectra intensities of one class hsimage

Underlying hsimage object that contains the image data that classified_hsimage is built around. Accessible and enables the entire API of hsimage.

Definition at line 164 of file HSI.dxy.


The documentation for this class was generated from the following file: