Functions¶
-
Functions.
AboutMenu
(event)¶ Creates the information dialog about the program.
Parameters: event (wx.Event) – A variable that is automatically fed by wxPython but isn’t used here.
-
Functions.
AddStDRT
(CurrentProject)¶ Takes the standard Diffuse Reflection Targets and saves them to the workfolder. This function is used to make sure the user always has the standard DRT’s available.
Parameters: CurrentProject (String) – File location of the project where the DRT’s should be added.
-
Functions.
BuildOpsTree
(OpsTreePanel, PluginManager)¶ Builds the operations tree in the main window. This is done using the yapsy pluging manager. (See yapsy documentation for more information) The function loops trough all the categories present in the plugins directory and appends the corresponding plugins to the panel, thus creating the operations tree.
Parameters: - OperationsTreePanel (wx.Panel) – The panel where the final wx.TreeCtrl should be put onto.
- PluginManager (yapsy.PluginManager) – The global yapsy pluging manager used by the program.
Returns: The panel with the operations tree and a dictionary with plugin names as keys and the link to the yaspy-plugin file as values.
Return type: wx.Panel and dictionary
-
Functions.
ChangeMetadata
(FilePath, FileName, CurrentProject)¶ Modifies a metadata file. The user is presented with a panel where he/she can modify the metadata from the selected file.
Parameters: - FilePath (List of string) – Path of the file which metadata should be modified.
- FileName (List of string) – Name of the file which metadata should be modified.
- CurrentProject (String) – Current project folder where the file and metadata are located.
-
Functions.
CheckProjectFolders
(CurrentProject)¶ Checks the project folder to see if any files or folders are missing and adds them if required.
Parameters: CurrentProject (String) – Folder to check
-
Functions.
CleanSPECIMDict
(dict)¶ This functions cleans up the dictionary created from HDR files. It removes all variables deemed unnecessary. Some of these are replaced by others and some are omitted altogether.
The variables that are deleted:
- x start
- byte order
- vroi
- fwhm
- Wavelength
- errors
- description
- vimg
- file type
- header offset
- y start
- sensorid
- himg
- hroi
- default bands
- fodis
The variables that are modified:
- lines,samples and bands are combined into “Shape” and “Shape Original Data”
- tint becomes “Shuttertime”
- data type becomes “Bit Depth”
- Wavelength becomes WavelengthInfo
Parameters: dict (Python Dictionary) – the full dictionary generated from HDR files. Returns: Dictionary with all the required metadata Return type: Dictionary
-
Functions.
CreatePluginManager
()¶ Creates the yapsy plugin manager object based on the Plug-Ins folder. NOTE: This function does not actually show the plugins in the program. It just loads them into the yapsy manager. The function BuildOpsTree does this.
Returns: This returns a yapsy plugin manager. This manager contains all the information about the plugins and where they need to be placed in the ops tree. Return type: yapsy.PluginManager
-
Functions.
DeleteItem
(FilePath, FileName, CurrentProject)¶ Is used to delete files selected by user. Also appends to the log file what file has been removed.
Parameters: - FilePath (List of string) – Path of the file to delete.
- FileName (List of string) – Name of the file to delete.
- CurrentProject (String) – Current project folder.
-
Functions.
GenerateDirectories
(WorkFolder)¶ Generates the default directories when a workfolder has been chosen or changed. This function is of no use to anyone else. If you would like more directories to be available please contact the TIPP developers
Parameters: WorkFolder (String) – Path to the workfolder. Return type: None
-
Functions.
KeyCodeNumber
(event)¶ Catches the keyboard events and returns the KeyCode. The KeyCode repressents the key that is pressed. (Easiest way to know which numbers belongs to a key is to print the KeyCode or use wx.WXK..)
Parameters: event (wx.event) – This tells the user with which event this defintions is called. Returns: The KeyCode Return type: int
-
Functions.
LoadProject
(WorkFolder)¶ Generates a wx.DirDialog where the user can select a project (folder) to load and then returns this folder. :param WorkFolder: WorkFolder where all projects are located. :type WorkFolder: String :rtype: String
-
Functions.
MakeFilePath
(CurrentProject, FileName)¶ This function returns the Filepath based on the settings of the project metedata FileTypeLocationDic
Parameters: - CurrentProject (string) – The current opened project
- FileName (string) – The new file name that needs a file path. It is important to include the extentie because it is used to place the file in a certain folder.
-
class
Functions.
MetaNotebook
(*args, **kwargs)¶ Creates a notebook for the project metadata.
-
ReloadNotebooks
(CurrentProject)¶ Reload and Make for every dictionary a new notebook
-
-
Functions.
NewProject
(WorkFolder)¶ Creates a new project. Catches problems with the user selecting a name that has been chosen. If so, the user gets the option to load or try again. Returns the projectpath.
Parameters: WorkFolder (String) – WorkFolder where all projects are located. Return type: String
-
Functions.
OverwriteFileCheck
(FilePathLst)¶ This function checks if the file(s) already exist and removes it.
Parameters: FilePath (String) – The path that has to be check
-
Functions.
ReadFileName
(FileNames)¶ This function takes a list of filenames and tries to read out the following metadata (Image Type WavelengthInfo Shuttertime acquistion date). Futhermore it read out all the numbers in the filenames into lists.
Parameters: FileNames – list with filenames Returns: This return two things MetaData and a dict with unknown MetaData that contains list with floats as values and as keys positions in the splitted string. If the filenames were not consistent it returns MetaData and False.
-
Functions.
ReadHDR
(FilePath)¶ This function reads trough the supplied HDR file and obtains all the information from it and adds it to a dictionary.
Parameters: FilePath (String) – The path of the HDR file to be read. Return type: Dictionary
-
Functions.
ReadXML
(FilePath)¶ Reads a XML file and returns the metadata and filenames
Parameters: FilePath (String) – filepath of the file to be read. Return type: dict,list,list,list
-
Functions.
RenameFile
(FilePath, FileName, CurrentProject, Ext)¶ Gives the user a window in which they can rename files.
Parameters: - FilePath (list of Strings) – List of filepaths of the files to be renamed.
- FileName (list of Strings (of the same length as FilePath)) – List of filenames of the files to be renamed.
- CurrentProject (String) – Current project folder.
Return type: None
-
Functions.
Returnwavelengthlst
(WavelengthInfo, bands)¶ Returns the list of wavelengths from the variables c,b,a in WavelengthInfo = ax**2 + bx + c. This function basically does the inverse of CreateWavelengthlst. This defintion is only used by main.py if a file is imported with an old version of the program (before April-2017).
Parameters: - WavelengthInfo (list of int's) – The array with values c,b,a in y = ax**2 + bx + c
- bands (int) – The number of bands to be created.
Return type: np.ndarray of length bands with all the wavelengths of type int
-
Functions.
TrueColorArray
(func, OrgData, WavelengthLst, Range)¶ Param func: The weights of the newton polynomial function.
Parameters: - OrgData (Array) – The xi terms of the newton polynomial function.
- WavelengthLst (Array) – The Wavelength list.
- Range (List) – The range for which the function is valid.
Return type: Array
-
Functions.
Uint8_To_Str
(lst)¶ This function converts uin8 to a string
Parameters: lst (list) – A list with Uint8. Return type: string
-
Functions.
Uint8_To_Uint16
(lst)¶ This function converts uin8 to uin16
Parameters: lst (list) – A list with Uint8. The len must be even. Return type: list
-
Functions.
UpdateLog
(LogEntry, CurrentProjectPath)¶ Updates the logfile with the logentry.
Parameters: - LogEntry (String) – The log entry to be added to the logfile.
- CurrentProjectPath (String) – The path of the log file.
Return type: None
-
Functions.
WarningDialog
(message, title)¶ This function creates a warning message dialog box with an OK button.
Parameters: - message (String) – The message that appears in the dialog
- title (String) – The caption of the dialog’s title bar.
Return type: None
-
Functions.
WriteHDR
(FilePath, Metadata, version)¶ This function write a HDR based on the dictionary.
Parameters: - FilePath (String) – The path of the HDR file to be read.
- Metadata (dict) – A dictionary with metadata that is written to the hdr file
Return type: None
-
Functions.
patch_crypto_be_discovery
()¶ Monkey patches cryptography’s backend detection. Objective: support pyinstaller freezing.