CubeFile¶
-
class
pysis.CubeFile(stream_or_fname, filename=None)[source]¶ A Isis Cube file reader.
-
apply_numpy_specials(copy=True)[source]¶ Convert isis special pixel values to numpy special pixel values.
Isis Numpy Null nan Lrs -inf Lis -inf His inf Hrs inf Parameters: copy – whether to apply the new special values to a copy of the pixel data and leave the orginial unaffected Returns: a numpy array with special values converted to numpy’s nan, inf and -inf
-
apply_scaling(copy=True)[source]¶ Scale pixel values to there true DN.
Parameters: copy – whether to apply the scalling to a copy of the pixel data and leave the orginial unaffected Returns: a scalled version of the pixel data
-
bands¶ Number of image bands.
-
base¶ An additive factor by which to offset pixel DN.
-
data= None¶ A numpy array representing the image data.
-
dtype¶ Pixel data type.
-
filename= None¶ The filename if given, otherwise none.
-
get_image_array()[source]¶ Create an array for use in making an image.
Creates a linear stretch of the image and scales it to between 0 and 255. Null, Lis and Lrs pixels are set to 0. His and Hrs pixels are set to 255.
Usage:
from pysis import CubeFile from PIL import Image # Read in the image and create the image data image = CubeFile.open('test.cub') data = image.get_image_array() # Save the first band to a new file Image.fromarray(data[0]).save('test.png')
Returns: A uint8 array of pixel values.
-
label= None¶ The parsed label header in dictionary form.
-
lines¶ Number of lines per band.
-
multiplier¶ A multiplicative factor by which to scale pixel DN.
-
classmethod
open(filename)[source]¶ Read an Isis Cube file from disk.
Parameters: filename – name of file to read as an isis file
-
samples¶ Number of samples per line.
-
shape¶ Tuple of images bands, lines and samples.
-
size¶ Total number of pixels.
-
specials_mask()[source]¶ Create a pixel map for special pixels.
Returns: an array where the value is False if the pixel is special and True otherwise
-
start_byte¶ Index of the start of the image data (zero indexed).
-
tile_lines¶ Number of lines per tile.
-
tile_samples¶ Number of samples per tile.
-