PartSeg.common_backend package¶
Module contents¶
This module contains non gui Qt based components
Submodules¶
PartSeg.common_backend.abstract_class module¶
- class PartSeg.common_backend.abstract_class.QtMeta(name, bases, namespace, /, **kwargs)[source]¶
Bases:
wrappertype
,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¶
- class PartSeg.common_backend.base_argparser.CustomParser(*args, **kwargs)[source]¶
Bases:
ArgumentParser
Argument parser with set of predefined flags:
--no_report
- disable error reporting, still showing dialog with information. Setstate_store.report_errors
.--no_dialog
- disable error reporting and showing dialog. Exceptions will be printed on stderr. Setstate_store.show_error_dialog
.--no_update
- disable check for updates on application startup
--save_suffix
- add special suffix to directory contains saved state. designed to allow separate projects.Set
state_store.save_suffix
.
--save_directory
- set custom save directory. default can be previewed in Help > State directoryfrom PartSeg main menu, Set
state_store.save_folder
.
--inner_plugins
- designed to hide part plugin from default start.
--develop
– for developer purpose. Allow to reload part of Program without restarting. May be unstable.Set
state_store.develop
. Base on thisPartSeg.common_gui.advanced_tabs.AdvancedWindow
constructor add developer tab.
- parse_args(args=None, namespace=None)[source]¶
overload of
argparse.ArgumentParser.parse_args()
. Set flags like described in class documentation.
- PartSeg.common_backend.base_argparser.proper_path(val)[source]¶
Check if val is proper path in current system
- Raises:
argparse.ArgumentTypeError – on validation error
- PartSeg.common_backend.base_argparser.proper_suffix(val)[source]¶
check if val contains only alphanumeric characters
- Raises:
argparse.ArgumentTypeError – on validation error
PartSeg.common_backend.base_settings module¶
PartSeg.common_backend.except_hook module¶
- PartSeg.common_backend.except_hook.my_excepthook(type_, value, trace_back)[source]¶
Custom excepthook. Close application on
KeyboardInterrupt
.If
PartSeg.state_store.always_report
is set then just sent report using sentry. otherwise show dialog with information about error and ask user if he wants to send report usingshow_error()
.
- PartSeg.common_backend.except_hook.show_error(error=None)[source]¶
For
SegmentationLimitException
andTiffFileException
show dialog with information about problem.For other exceptions show
ErrorDialog
dialog with information about error that allow to report it.- Parameters:
error – exception to show
- PartSeg.common_backend.except_hook.show_warning(header=None, text=None, exception=None)[source]¶
Show warning
QMessageBox
This function is to ensure creation warning dialog in main thread.
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.
- item_added(object)¶
Signal with item added to dict
- item_removed(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
- class PartSeg.common_backend.progress_thread.ProgressTread[source]¶
Bases:
QThread
- error_signal(Exception)¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- range_changed(int, int)¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- step_changed(int)¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
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
.- exception_occurred(Exception)¶
Signal emitted when some exception occur during calculation.
- execution_done(ROIExtractionResult)¶
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.
- progress_signal(str, int)¶
Signal with information about progress. This is proxy for
SegmentationAlgorithm.calculation_run()
report_fun parameter`
- 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