PartSeg.common_backend package

Module contents

This module contains non gui Qt based components

PartSeg.common_backend.napari_get_settings(path=None)[source]
Return type:

NapariSettings

Submodules

PartSeg.common_backend.abstract_class module

class PartSeg.common_backend.abstract_class.QtMeta[source]

Bases: ObjectType, ABCMeta

Class to solve metaclass conflict for multiple inheritance:

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclass of all its bases

>>> class A:
...    pass
...
>>> class Test(QObject, A, metaclass=QtMeta):
...    pass

PartSeg.common_backend.base_argparser module

PartSeg.common_backend.base_settings module

PartSeg.common_backend.except_hook module

PartSeg.common_backend.load_backup module

PartSeg.common_backend.partially_const_dict module

class PartSeg.common_backend.partially_const_dict.PartiallyConstDict(editable_items)[source]

Base class for creating dict to mixin predefined and user defined variables.

const_item_dict: ClassVar[Dict[str, Any]] = {}

Dict with non removable elements

get_position(key)[source]

Get item position as unique int. For sorting purpose

Raises:

KeyError – if element not in dict

Return type:

int

item_added(object) = <PySide2.QtCore.Signal object>

Signal with item added to dict

item_removed(object) = <PySide2.QtCore.Signal object>

Signal with item remove from dict

PartSeg.common_backend.progress_thread module

class PartSeg.common_backend.progress_thread.ExecuteFunctionThread(fun, args=None, kwargs=None)[source]

Bases: ProgressTread

Generic Thread to execute

run(self)[source]
staticMetaObject = <PySide2.QtCore.QMetaObject object>
class PartSeg.common_backend.progress_thread.ProgressTread[source]

Bases: QThread

error_signal(Exception) = <PySide2.QtCore.Signal object>
info_function(label, val)[source]
range_changed(int, int) = <PySide2.QtCore.Signal object>
staticMetaObject = <PySide2.QtCore.QMetaObject object>
step_changed(int) = <PySide2.QtCore.Signal object>

PartSeg.common_backend.segmentation_thread module

class PartSeg.common_backend.segmentation_thread.SegmentationThread(algorithm)[source]

Bases: QThread

Method to run calculation task in separated Thread. This allows to not freeze main window. To get info if calculation is done connect to finished.

clean()[source]

clean cache if thread is running. Call SegmentationAlgorithm.clean() otherwise. :

exception_occurred(Exception) = <PySide2.QtCore.Signal object>

Signal emitted when some exception occur during calculation.

execution_done(ROIExtractionResult) = <PySide2.QtCore.Signal object>

Signal contains result of segmentation algorithm. Emitted if calculation ends without exception and SegmentationAlgorithm.calculation_run() return not None result.

finished_task()[source]

Called on calculation finished. Check if cache is not empty. In such case start calculation again with new parameters.

get_info_text()[source]

Proxy for SegmentationAlgorithm.get_info_text().

progress_signal(str, int) = <PySide2.QtCore.Signal object>

Signal with information about progress. This is proxy for SegmentationAlgorithm.calculation_run() report_fun parameter`

run()[source]

the calculation are done here

set_image(image)[source]

check if calculation is running. If yes then cache parameters until it finish, otherwise call SegmentationAlgorithm.set_image() :type image: :param image: image to be set

set_mask(mask)[source]

check if calculation is running. If yes then cache parameters until it finish, otherwise call SegmentationAlgorithm.set_mask() :type mask: :param mask: mask to be set

set_parameters(*args, **kwargs)[source]

check if calculation is running. If yes then cache parameters until it finish, otherwise call SegmentationAlgorithm.set_parameters()

start(priority=PySide2.QtCore.QThread.Priority.InheritPriority)[source]

If calculation is running remember to restart it with new parameters.

Otherwise start immediately.