Segment Manager

Segmenter Manager Module

This file contains a collection of classes and functions which augment the segmentation operation.

Usage:

To use this module, import it and instantiate is as you wish:

from Paint4Brains.GUI.SegmentManager import SegmentThread, SegmentManager

manager = SegmentManager()

class Paint4Brains.GUI.SegmentManager.SegmentManager(parent)

SegmentManager class

This is a class containing several useful functions which augment the segmentation process.

Args:
parent (class): Base or parent class
error_message(error)

Error prompt

This function produces an error message if one arises during segmentation.

Args:
error (pyqtSignal): Error signal generated during segmentation.
finished_message()

Finish prompt

This function prompts the user that segmentation has ended. It also signals the ImageViewer to enable editing, display the labels and enable color editing.

popup_button(i)

Popup button

Opens a popup window, prompting the user to select the type of desired hardware for segmentation.

Args:
i (str): User input by pressing the button.
run_segmentation(device=None)

Run segmentation

Function which runs the segmentation and assigns it to a thread.

Args:
device (int/str): Device type used for training (int - GPU id, str- CPU)
show_initial_message()

Initial Message Prompts

A series of initial messages displayed to the user in the Segmentation Popup Window

started_message()

Start message prompt

This function prompts the user with different messages based on the selected hardware configuration.

class Paint4Brains.GUI.SegmentManager.SegmentThread(brain, device)

Segment Worker Thread

In order to allow the operation of the software while segmentation is running, and prevent freezing on older hardware, the segmentation process is threaded.

Attributes:
start_signal (pyqtSignal): Signal marking the start of segmnetation end_signal (pyqtSignal): Signal marking the end of segmentation error_signal (pyqtSignal, str): String of any error raised during execution
Args:
window (class): ImageViewer class device (int/str): Device type used for training (int - GPU id, str- CPU)
run()

Run function

Run function which, if receiving a run signal, starts the segmentation using a thread, or otherwise ends the thread or raises an error.