viewerLUT¶
Module that contains the ViewerLUT class amongst other things
- class tuiview.viewerLUT.BandLUTInfo(scale, offset, lutsize, minval, maxval, nodata_index=0, background_index=0, nan_index=0)[source]¶
Class that holds information about a band’s LUT
- class tuiview.viewerLUT.ViewerLUT(*args: Any, **kwargs: Any)[source]¶
Class that handles the Lookup Table used for transformation between raw data and stretched data
- newPercent¶
emitted when a new percent value is available
alias of
int
- applyLUTRGB(datalist, mask)[source]¶
Apply LUT to 3 bands of imagery passed as a list of arrays. Return a QImage
- applyLUTSingle(data, mask)[source]¶
Apply the LUT to a single band (color table or greyscale image) and return the result as a QImage
- static createFromFile(fileobj, stretch)[source]¶
Read a text file created by saveToFile and create an instance of this class
- static createFromGDAL(gdaldataset, stretch)[source]¶
Creates a ViewerLUT object from the metadata saved to a GDAL dataset. stretch needed to find what type of stretch.
- createLUT(dataset, stretch, rat, image=None)[source]¶
Main function. dataset is a GDAL dataset to use. stetch is a ViewerStretch instance that describes the stretch. rat is an instance of ViewerRAT - for reading color table if image is not None it should be a QImage returned by the apply functions and a local stretch will be calculated using this.
- createStretchLUT(gdalband, stretch, lutsize, localdata=None)[source]¶
Creates a LUT for a single band using the stretch method specified and returns it. If localdata is not None then it should be an array to calculate the stats from (ignore values should be already removed) Otherwise these will be calculated from the whole image using GDAL if needed.
- static deleteFromGDAL(gdaldataset)[source]¶
Remove all LUT entries from this dataset assumed the dataset opened with GA_Update
- getHistogramWithProgress(gdalband, minVal, maxVal, localdata=None)[source]¶
Helper method. Calculates histogram using GDAL. If localdata is not None, histogram calulated using the data in this numpy array.
- getStatisticsWithProgress(gdalband, localdata=None)[source]¶
Helper method. Just quickly returns the stats if they are easily available from GDAL. Calculates them using the supplied progress if not. If localdata is not None, statistics are calulated using the data in this numpy array.
- highlightRows(color, selectionArray=None)[source]¶
Highlights the specified where selectionArray == True Saves the existing LUT in self.backuplut if not already Assumes selectionArray is the same length as the LUT
- loadColorTable(rat, nodata_rgba, background_rgba, nan_rgba)[source]¶
Creates a LUT for a single band using the RAT
- static readSurrogateColorTables(gdaldataset)[source]¶
Read the surrogate color tables stored in the file’s metadata into a dictionary keyed on the name.
- saveToFile(fileobj)[source]¶
Save current stretch to a text file so it can be stored and manipulated
- setColorTableLookup(lookupArray, colName, surrogateLUT, surrogateName)[source]¶
Uses lookupArray to index into surrogateLUT where values != 0. Pass None to reset. Need to pass colName and surrogateName so we can save as part of LUT
- static writeSurrogateColorTables(gdaldataset, tables)[source]¶
Write a dictionary of surrogate color tables to the file’s metadata.
- writeToGDAL(gdaldataset)[source]¶
Writes the LUT and BandInfo into the given dataset assumed the dataset opened with GA_Update Good idea to reopen any other handles to dataset to the file as part of this call
- endProgress¶
emitted when progress finished
- newProgress = 'QString'¶
emitted when a new progress bar is needed
- tuiview.viewerLUT.GDALProgressFunc(value, string, lutobject)[source]¶
Callback function called by GDAL when calculating stats or histogram.