PartSeg.common_gui.colormap_creator

This module contains class used to create and manage colormaps.

class PartSeg.common_gui.colormap_creator.ChannelPreview(colormap, accepted, name, removable=False, used=False, parent=None)[source]

Bases: QWidget

class for preview single colormap. Witch checkbox for change selection.

Parameters
  • colormap (Colormap) – colormap to show

  • accepted (bool) – if checkbox should be checked

  • name (str) – name which will be emitted in all signals as firs argument

edit_request([str][, Colormap])

send after pressing edit signal (name) (ColorMap object)

property is_checked

If colormap is selected

paintEvent(event)[source]
remove_request(str)

Signal with name of colormap (name)

selection_changed(str, bool)

checkbox selection changed (name)

set_blocked(block)[source]

Set if block possibility of remove or uncheck

set_chosen(state)[source]

Set selection of check box.

property state_changed

Inner checkbox stateChanged signal

class PartSeg.common_gui.colormap_creator.ColormapCreator(parent=None)[source]

Bases: QWidget

Widget for creating colormap.

colormap_selected(Colormap)

emitted on save button click. Contains current colormap in format accepted by create_color_map()

current_colormap()[source]
Return type

Colormap

Returns

current colormap

set_colormap(colormap)[source]

set current colormap

class PartSeg.common_gui.colormap_creator.ColormapEdit[source]

Bases: QWidget

Preview of colormap. Double click used for add/remove colors. Single click on marker allows moving them

add_color(position, color)[source]

Add color to current colormap

Parameters

color (Color) – Color with position.

clear()[source]

Remove color markers. Reset to initial state.

distribute_evenly()[source]

Distribute color markers evenly.

mouseDoubleClickEvent(event)[source]

If click near marker remove it. Otherwise emmit double_click signal with event position factor.

Return type

None

mouseMoveEvent(e)[source]
Return type

None

mousePressEvent(e)[source]
Return type

None

mouseReleaseEvent(e)[source]
Return type

None

paintEvent(a0)[source]
Return type

None

refresh()[source]

Recreate presented image and force repaint event

class PartSeg.common_gui.colormap_creator.ColormapList(colormap_map, selected=None, parent=None)[source]

Bases: QWidget

Show list of colormaps

blocked()[source]

Channels that cannot be turn of and remove

Return type

Set[str]

check_state(name)[source]

Check state of widget representing given colormap

Parameters

name (str) – name of colormap which representing widget should be checked

Return type

bool

edit_signal(Colormap)

Colormap for edit

get_colormap_widget(name)[source]

Access to widget showing colormap. Created for testing purpose.

Return type

ChannelPreview

get_selected()[source]

Already selected colormaps

Return type

Set[str]

remove_signal(str)

Name of colormap to remove

resizeEvent(event)[source]
set_state(name, state)[source]

Set if given colormap is selected

Parameters
  • name (str) – name of colormap

  • state (bool) – state to be set

Return type

None

showEvent(event)[source]
visibility_colormap_change(str, bool)

Hide or show colormap

class PartSeg.common_gui.colormap_creator.ColormapLoad[source]

Bases: PartSegCore.io_utils.LoadBase

classmethod get_name()[source]

Algorithm name. It will be used during interface generating and in registering to proper PartSeg.PartSegCore.algorithm_describe_base.Register.

Return type

str

Returns

name of algorithm

classmethod load(load_locations, range_changed=None, step_changed=None, metadata=None)[source]

Function for load data

Parameters
  • load_locations (List[Union[str, BytesIO, Path]]) – list of files to load

  • range_changed (Optional[Callable[[int, int], Any]]) – callback function for inform about number of steps to be done

  • step_changed (Optional[Callable[[int], Any]]) – callback function for report that single step has been done

  • metadata (Optional[dict]) – additional information needed by function. Like default spacing for load image

Return type

Colormap

Returns

Project info or list of project info

class PartSeg.common_gui.colormap_creator.ColormapSave[source]

Bases: PartSegCore.io_utils.SaveBase

classmethod get_name()[source]

Algorithm name. It will be used during interface generating and in registering to proper PartSeg.PartSegCore.algorithm_describe_base.Register.

Return type

str

Returns

name of algorithm

classmethod save(save_location, project_info, parameters=None, range_changed=None, step_changed=None)[source]
Parameters
  • save_location (Union[str, BytesIO, Path]) – location to save, can be buffer

  • project_info – all project data

  • parameters (Optional[dict]) – additional parameters for saving method

  • range_changed – report function for inform about steps num

  • step_changed – report function for progress

class PartSeg.common_gui.colormap_creator.PColormapCreator(settings)[source]

Bases: PartSeg.common_gui.colormap_creator.PColormapCreatorMid

ColormapCreator variant which save result in ViewSettings

hideEvent(a0)[source]

Save custom colors on hide

Return type

None

class PartSeg.common_gui.colormap_creator.PColormapCreatorMid(settings)[source]

Bases: PartSeg.common_gui.colormap_creator.ColormapCreator

Class to add export and import buttons to ColormapCreator without full PColormapCreator

class PartSeg.common_gui.colormap_creator.PColormapList(settings, control_names)[source]

Bases: PartSeg.common_gui.colormap_creator.ColormapList

Show list of colormaps. Integrated with ViewSettings

Parameters
  • settings (ViewSettings) – used for store state

  • control_names (List[str]) – list of names of PartSeg.common_gui.stack_image_view.ImageView for protect used channels from uncheck or remove

blocked()[source]

Channels that cannot be turn of and remove

Return type

Set[str]

get_selected()[source]

Already selected colormaps

Return type

Set[str]

PartSeg.common_gui.colormap_creator.color_from_qcolor(color)[source]

Convert QColor to Color

Return type

Color

PartSeg.common_gui.colormap_creator.qcolor_from_color(color)[source]

Convert Color to QColor

Return type

QColor