algorithms

constant_threshold

grabcut_dilation_erosion_otsu

adaptive

watershed_distance_transform_otsu

connected_component_filter

med_blur

simple_cycle

edge_attribute_filter

largest_connected

_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

fast_nl_denoise

grabcut_distance_transform_otsu

gauss_blur

blur

_thread

class model.algorithms._thread.myThread(threadID, name, counter)[source]

Bases: threading.Thread

run()[source]
model.algorithms._thread.print_time(threadName, delay, counter)[source]

_utility

Various help functions for processing results.

model.algorithms._utility.check_operator(dropdown)[source]

Converts the string value of the DropDown element in operator object

Args:
dropdown : DropDown object from the algorithm class
Returns:
op_object: operator object converted
model.algorithms._utility.draw_edges(img, graph, col=(0, 0, 255))[source]

Draw network edges on the input image.

Args:
img : Input image where edges are drawn
graph : Input graph containing the edges
Kwargs:
col : colour for drawing
Returns:
Input image img with nodes drawn into it
model.algorithms._utility.draw_graph(image, graph)[source]

Draw the graph on the image by traversing the graph structure.

Args:
image : the image where the graph needs to be drawn
graph : the *.txt file containing the graph information

Returns:

model.algorithms._utility.draw_nodes(img, graph, radius=1)[source]

Draw all nodes on the input image.

Args:
img : Input image where nodes are drawn
graph : Input graph containing the nodes
Kwargs:
radius : Radius of drawn nodes
Returns:
Input image img with nodes drawn into it

fast_nl_denoise_color

bilateral

smooth_degree_two_nodes

otsus

watershed_dilation_erosion_otsu

reduce_img

guo_hall

watershed_dilation_erosion_adaptive

color_enchance

class model.algorithms.color_enchance.AlgBody

Bases: model.algorithms._alg.Algorithm

Color enhancement algorithm implementation

compute_channels(image_channel)
process(args)

invert_color