_alg

This is Algorithm master class and all algorithms must inherit from it.

class model.algorithms._alg.Algorithm[source]
belongs()[source]

Identifies the category to which this algorithm implementation is assoc iated with. Therefore you the contributor returns a string yielding the name of the associated category. E.g. we have an algorithm “blur” which is created through implementing the abstract class Algorithm. In “blur” we override the belongs method to return “preprocessing” to associate the “blur” algorithm instance with the category “preprocessing”.

Returns:
self.parent: The string identifier to which category this

algorithm belongs to

find_ui_element(name)[source]

This method helps the json parser to find the ui elements with the given name

Args:
|name: name of the ui element we are looking for

Returns:

get_icon()[source]
Returns:
icon_path: The path to the icon to be used
get_name()[source]

This method returns the name of the implemented algorithm. E.g. int case the contributor is implementing a “watershed” algorithm, his get_name method should return “watershed”. By default this method raises an error if the user is not overriding his own get_name method.

Returns:
self.name: The name of the algorithm specified in this implementation.
process(input_data)[source]

Contains the logic of the implemented algorithm. While computing the pipeline each algorithm will be called with its process method giving the output image from the previous algorithm processed in the pipeline The images are used to draw the result of each algorithm in the left section of the UI. Therefore the contributor should return an image itself at the end of this method. By default this method raises an error if the user is not overriding his own process method.

Args:
input_data: a tuple which contains all relevant arguments found in

the results of the previous processed algorithm. As common in the pipeline pattern, the successors always get called with the information the predecessor created. The first element in input_data should always be image array, the second element is reserved for graph. This is why algorithm process methods operate on args indeces (args[0] or args[1]). Please consider this in case you decide to add an algorithm which produces something different than an image array or networkx graph object.

report_pip()[source]

This method returns a dictionary which contains all relevant algorithm information and returns it to the pipeline along with the algorithm name. The pipeline needs this information to create a json representation of the algorithm. It will encode the dic as following: E.g. blur : {“type” : “preprocessing”, “kernelsize” : 2.5} The encoding of the dic to json will be done by the pipeline which collects the dictionary of each algorithm in the processing list.

Returns:
self.name, collections.OrderedDict (list): A tuple consisting of the name of the algorithm and the dic containing all relevant information about the algorithm which need to be stored on the filesystem for the pipeline.json.
set_icon(icon_path)[source]
Args:
icon_path: The path to the icon to be used
set_modified()[source]

Set modified to True

set_store_image(state)[source]
unset_modified()[source]

Set modified to False

class model.algorithms._alg.CheckBox(name, default)[source]

A class defining a Checkbox of type boolean to display in the algorithm detail section of the UI. After calling the CheckBox constructor, the program automatically creates ui widgets as well as qt slots and signals to connect this checkbox with the UI.

set_value(arg1)[source]

The set_value method is used by the UI and the batch-mode of NEFI as an input source of selected values for this particular checkbox instance. The @pyqtSlot(bool) decoration declares this method as as QT-Slot. To get more information about Slots and Signals in QT read about it in the official QT documentation.

Args:
arg1: the boolean value selected in the ui or the pipeline in

batch-mode

class model.algorithms._alg.DropDown(name, options, default=None)[source]

A class defining a DropDown menu of type string to display in the algorithm detail section of the UI. After calling the DropDown constructor, the program automatically creates ui widgets as well as qt slots and signals to connect this DropDown with the UI.

set_value(arg1)[source]

The set_value method is used by the UI and the batch-mode of NEFI as an inputsource of selected values for this particular DropDown instance. The @pyqtSlot(str) decoration declares this method as as QT-Slot. To get more information about Slots and Signals in QT read about it in the official QT documentation.

Args:
arg1: the string value selected in the ui or the pipeline in the batch-mode
class model.algorithms._alg.FloatSlider(name, lower, upper, step_size, default)[source]

A class defining a slider of type float to display in the algorithm detail section of the UI. After calling the FloatSlider constructor, the program automatically creates ui widgets as well as qt slots and signals to connect this slider with the UI.

set_value(arg1)[source]

The set_value method is used by the UI and the batch-mode of NEFI as an input source of selected values for this particular slider instance. The @pyqtSlot(int) decoration declares this method as as QT-Slot. To get more information about Slots and Signals in QT read about it in the official QT documentation.

Args:
arg1: the integer value selected in the ui or the pipeline in

batch-mode

class model.algorithms._alg.IntegerSlider(name, lower, upper, step_size, default)[source]

A class defining a slider of type int to display in the algorithm detail section of the UI. After calling the IntegerSlider constructor, the program automatically creates ui widgets as wellas qt slots and signals to connect this slider with the UI.

set_value(arg1)[source]

The set_value method is used by the UI and the batch-mode of NEFI as an input source of selected values for this particular slider instance. The @pyqtSlot(int) decoration declares this method as as QT-Slot. To get more information about Slots and Signals in QT read about it in the official QT documentation.

Args:
arg1: the integer value selected in the ui or the pipeline in

batch-mode