viewerstretch

Module that contains ViewerStretch and StretchRule classes

class tuiview.viewerstretch.StretchRule(comp, value, ctband, stretch)[source]

Class that represents a ‘rule’ and a stretch to be applied when that rule matches. The rule contains information about number of bands in a dataset and how to compare, plus if a dataset has a colour table in a particular band

static fromString(string)[source]

Create a StretchRule instance from a json encoded string created by toString()

isMatch(gdaldataset)[source]

Does this rule match the given dataset?

toString()[source]

Convert to a JSON encoded string

class tuiview.viewerstretch.ViewerStretch[source]

Class that represents the stretch. Use the methods here to set the type of stretch you want and the bands used

static deleteFromGDAL(gdaldataset)[source]

Remove the stretch entry from this dataset assumed the dataset opened with GA_Update

static fromGDALFileWithLUT(fname)[source]

For reading a GDAL file with stretch and LUT saved. The stretch is read out and setLUTFromGDAL called with this file also

static fromString(string)[source]

Create a ViewerStretch instance from a json encoded string created by toString()

static fromTextFileWithLUT(fname)[source]

For reading a .stretch file. The stretch is read out of the first line and setLUTFromText called with this file also since .stretch files contain both

static readFromGDAL(gdaldataset)[source]

See if there is an entry in the GDAL metadata, and return a ViewerStretch instance, otherwise None

setAttributeTableSize(size)[source]

set with size of attribute table if one exists LUT will then be created with this size set to None for default behaviour

setBackgroundRGBA(rgba)[source]

Set the RGB to display Background areas as

setBands(bands)[source]

Set the bands to use. bands should be a tuple of 1-based ints

setColorTable()[source]

Use the color table in the image

setGreyScale()[source]

Display a single band in greyscale

setHistStretch(minVal=0.025, maxVal=0.01)[source]

Do a histogram stretch

setLUTFromGDAL(fname)[source]

Read LUT from specified GDAL dataset

setLUTFromText(fname)[source]

Read in the LUT from specified text file

setLinearStretch(minVal=None, maxVal=None)[source]

Just stretch linearly between min and max values if None, range of the data used

setNaNRGBA(rgba)[source]

Set the RGB to display NaN areas as

setNoDataRGBA(rgba)[source]

Set the RGBA to display No Data values as

setNoStretch()[source]

Don’t do a stretch - data is already stretched

setPseudoColor(rampName)[source]

Display with given color ramp

setRGB()[source]

Display 3 bands as RGB

setStdDevStretch(stddev=2.0)[source]

Do a standard deviation stretch

toString()[source]

Convert to a JSON encoded string

writeToGDAL(gdaldataset)[source]

Write this stretch into the GDAL file assumed the dataset opened with GA_Update Good idea to reopen any other handles to dataset