Main Window¶
GUI Main Window
This file contains all the relevant functions for defining and operating Paint4Brains’ main window.
- Usage:
To use this module, import it and instantiate is as you wish:
from Paint4Brains.GUI.MainWindow import MainWindow
window = MainWindow(parameters)
-
class
Paint4Brains.GUI.MainWindow.MainWindow(file, label_file=None)¶ MainWindow class for Paint4Brains.
This class contains the implementation of a series of functions required for the Main Windows of the Paint4Brains GUI. Wraps MainWidget to allow a Menu. To operate, the constructor class calls the MainWidget class which contains the bulk of the gui and enables the use of menus. Because of this most of this class is dedicated to defining menu entries and actions to be added to these entries Another thing it does is load the nib files from a string containing the path.
- Args:
- file (str): Path leading to the location of the brain data file. label_file (str): Path to the location of the labeled data file.
-
load()¶ Labelled data loader.
This function loads labelled data. Opens a loading window through which you can select what label data file to load. Once a file is uploaded it automatically sets the app to drawing mode
-
load_initial()¶ Original brain loader
Loads the “base” brain. The pre-segmentation scan has to be uploaded before the gui is initialised! This can be done either through the command line beforehand (this can be set in pycharm too) or through a window that appears on start (gets annoying). If you try to open it with nothing it complains and gives you an error message.
- Raises:
- Error: Failed to load!
-
save()¶ Labelled data saver
Saves the edited labelled data into a previously saved file Saves edits into a new .nii file. If no file has been saved before it reverts to save_as It still does not copy the headers (something to do)
-
save_as()¶ Labelled data saver with a new name
This function saves the edited labelled data into a new file Saves edits into a new .nii file. Opens a window in which you can type the name of the new file you are saving. It still does not copy the headers (something to do)
-
segment()¶ Call the segmentation function
Method that returns a segmented brain This function calls the brainSegmentation function in BrainData, which transforms (pre-processes) the brain file and then calls QuickNAT for running the file.
-
view_edit_tools()¶ Toggle editing toolbar
Switch the toolbar with editing buttons to visible or invisible Makes it the opposite of what it was previously
-
view_histogram()¶ Toggle histogram widget
Opens an intensity histogram for all voxels in the nii file. This enables the user to make intensity corrections on the loaded brain.
-
view_visualization_tools()¶ Toggle visualization toolbar
Switch the toolbar with editing buttons to visible or invisible Makes it the opposite of what it was previously