mdt.gui.maps_visualizer package

Submodules

mdt.gui.maps_visualizer.actions module

class mdt.gui.maps_visualizer.actions.ConfigAction[source]

Bases: mdt.gui.maps_visualizer.actions.ModelUpdateAction

An abstract implementation of a model update action meant for updating only the configuration.

apply(data_config_model)[source]

Apply the changes to the configuration and keeps the data intact.

By default this method calls _apply(data_config_model) to facilitate quick implementation.

unapply()[source]

Return the configuration as it was before the application of this function.

Returns:the previous model
Return type:mdt.gui.maps_visualizer.base.DataConfigModel
class mdt.gui.maps_visualizer.actions.ModelUpdateAction[source]

Bases: object

apply(data_config_model)[source]

Apply the changes to the given model and return a new model.

Parameters:data_config_model (mdt.gui.maps_visualizer.base.DataConfigModel) – the current data and configuration
Returns:the updated/new model
Return type:mdt.gui.maps_visualizer.base.DataConfigModel
unapply()[source]

Return the configuration as it was before the application of this function.

Returns:the previous model
Return type:mdt.gui.maps_visualizer.base.DataConfigModel
class mdt.gui.maps_visualizer.actions.NewConfigAction(new_config)[source]

Bases: mdt.gui.maps_visualizer.actions.ConfigAction

apply(data_config_model)[source]

Apply the changes to the configuration and keeps the data intact.

By default this method calls _apply(data_config_model) to facilitate quick implementation.

unapply()[source]

Return the configuration as it was before the application of this function.

Returns:the previous model
Return type:mdt.gui.maps_visualizer.base.DataConfigModel
class mdt.gui.maps_visualizer.actions.NewDataAction(data, config=None)[source]

Bases: mdt.gui.maps_visualizer.actions.ModelUpdateAction

Sets the new data and (optional) configuration when applied.

This class will change some parts of the configuration to make sure that removing or adding maps does not result in an improper configuration.

apply(data_config_model)[source]

Apply the changes to the given model and return a new model.

Parameters:data_config_model (mdt.gui.maps_visualizer.base.DataConfigModel) – the current data and configuration
Returns:the updated/new model
Return type:mdt.gui.maps_visualizer.base.DataConfigModel
unapply()[source]

Return the configuration as it was before the application of this function.

Returns:the previous model
Return type:mdt.gui.maps_visualizer.base.DataConfigModel
class mdt.gui.maps_visualizer.actions.SetAnnotations(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'annotations'
class mdt.gui.maps_visualizer.actions.SetColorBarNmrTicks(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = ['colorbar_settings', 'nmr_ticks']
class mdt.gui.maps_visualizer.actions.SetColorbarLocation(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = ['colorbar_settings', 'location']
class mdt.gui.maps_visualizer.actions.SetColormap(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'colormap'
class mdt.gui.maps_visualizer.actions.SetDimension(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'dimension'
class mdt.gui.maps_visualizer.actions.SetFlipud(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'flipud'
class mdt.gui.maps_visualizer.actions.SetFont(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'font'
class mdt.gui.maps_visualizer.actions.SetGeneralMask(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'mask_name'
class mdt.gui.maps_visualizer.actions.SetInterpolation(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'interpolation'
class mdt.gui.maps_visualizer.actions.SetMapClipping(map_name, new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleMapSpecificConfigAction

config_attribute = 'clipping'
class mdt.gui.maps_visualizer.actions.SetMapColorbarLabel(map_name, new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleMapSpecificConfigAction

config_attribute = 'colorbar_label'
class mdt.gui.maps_visualizer.actions.SetMapColormap(map_name, new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleMapSpecificConfigAction

config_attribute = 'colormap'
class mdt.gui.maps_visualizer.actions.SetMapScale(map_name, new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleMapSpecificConfigAction

config_attribute = 'scale'
class mdt.gui.maps_visualizer.actions.SetMapTitle(map_name, new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleMapSpecificConfigAction

config_attribute = 'title'
class mdt.gui.maps_visualizer.actions.SetMapsToShow(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'maps_to_show'
class mdt.gui.maps_visualizer.actions.SetPlotTitle(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'title'
class mdt.gui.maps_visualizer.actions.SetRotate(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'rotate'
class mdt.gui.maps_visualizer.actions.SetShowAxis(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'show_axis'
class mdt.gui.maps_visualizer.actions.SetShowPlotColorbars(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = ['colorbar_settings', 'visible']
class mdt.gui.maps_visualizer.actions.SetShowPlotTitles(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'show_titles'
class mdt.gui.maps_visualizer.actions.SetSliceIndex(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'slice_index'
class mdt.gui.maps_visualizer.actions.SetVolumeIndex(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'volume_index'
class mdt.gui.maps_visualizer.actions.SetZoom(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = 'zoom'
class mdt.gui.maps_visualizer.actions.SimpleConfigAction(new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.ConfigAction

A simple configuration action this sets the given value to the config attribute of the configuration.

The config_attribute can be a list, if so, we iteratively look up the corresponding attributes and change the last attribute element.

config_attribute = None
class mdt.gui.maps_visualizer.actions.SimpleMapSpecificConfigAction(map_name, new_value)[source]

Bases: mdt.gui.maps_visualizer.actions.SimpleConfigAction

config_attribute = None

mdt.gui.maps_visualizer.base module

class mdt.gui.maps_visualizer.base.Controller[source]

Bases: object

Controller interface

apply_action(action, store_in_history=True)[source]

Apply a new configuration action.

If there is no difference between the current config and the one generated by this new action, the action will not be stored in history and will not need to be applied.

Parameters:
  • action (mdt.gui.maps_visualizer.base.ConfigAction) – the configuration action to add and apply
  • store_in_history (boolean) – if this action should be stored in the history or not
get_model()[source]

Get the model the view should represent.

Returns:
the model the view should represent. This is also the model the actions can use for updating
the model.
Return type:DataConfigModel
has_redo()[source]

Check if this controller has an redo action available.

Returns:True if an redo action is available.
Return type:boolean
has_undo()[source]

Check if this controller has an undo action available.

Returns:True if an undo action is available.
Return type:boolean
redo()[source]

Reapply a previously undone configuration action

set_data(data_info, config=None)[source]

Set new data to visualize.

Parameters:
undo()[source]

Undo a previous configuration action

class mdt.gui.maps_visualizer.base.DataConfigModel[source]

Bases: object

The model contains all the state information for viewing the maps, both the data and the configuration.

get_config()[source]

Get the current configuration.

Returns:the visualization configuration.
Return type:mdt.visualization.maps.base.MapPlotConfig
get_data()[source]

Get the current data.

Returns:the information about the data we are viewing
Return type:mdt.visualization.maps.base.DataInfo
class mdt.gui.maps_visualizer.base.QtController[source]

Bases: mdt.gui.maps_visualizer.base.Controller, MockClass

apply_action(action, store_in_history=True)[source]

Apply a new configuration action.

If there is no difference between the current config and the one generated by this new action, the action will not be stored in history and will not need to be applied.

Parameters:
  • action (mdt.gui.maps_visualizer.base.ConfigAction) – the configuration action to add and apply
  • store_in_history (boolean) – if this action should be stored in the history or not
get_model()[source]

Get the model the view should represent.

Returns:
the model the view should represent. This is also the model the actions can use for updating
the model.
Return type:DataConfigModel
has_redo()[source]

Check if this controller has an redo action available.

Returns:True if an redo action is available.
Return type:boolean
has_undo()[source]

Check if this controller has an undo action available.

Returns:True if an undo action is available.
Return type:boolean
model_updated = <MockNamedComponent name='mock()' id='140623380290584'>
redo()[source]

Reapply a previously undone configuration action

set_data(data_info, config=None)[source]

Set new data to visualize.

Parameters:
undo()[source]

Undo a previous configuration action

class mdt.gui.maps_visualizer.base.SimpleDataConfigModel(data, config)[source]

Bases: mdt.gui.maps_visualizer.base.DataConfigModel

The model contains all the state information of the current viewing.

Parameters:
get_config()[source]

Get the current configuration.

Returns:the visualization configuration.
Return type:mdt.visualization.maps.base.MapPlotConfig
get_data()[source]

Get the current data.

Returns:the information about the data we are viewing
Return type:mdt.visualization.maps.base.DataInfo

mdt.gui.maps_visualizer.main module

class mdt.gui.maps_visualizer.main.AboutDialog(parent)[source]

Bases: mdt.gui.model_fit.design.ui_about_dialog.Ui_AboutDialog, MockClass

class mdt.gui.maps_visualizer.main.ExportImageDialog(parent, plotting_frame, controller)[source]

Bases: mdt.gui.maps_visualizer.design.ui_save_image_dialog.Ui_SaveImageDialog, MockClass

static plot_frame_resized()[source]
previous_values = {'dpi': None, 'height': None, 'output_file': None, 'width': None, 'writeScriptsAndConfig': False}
class mdt.gui.maps_visualizer.main.MapsVisualizerWindow(controller, parent=None)[source]

Bases: MockClass, mdt.gui.maps_visualizer.design.ui_MainWindow.Ui_MapsVisualizer

Instantiate the maps GUI

Parameters:controller (mdt.gui.maps_visualizer.base.Controller) – the controller to use for updating the views
dragEnterEvent(event)[source]

Function to allow dragging nifti files in the viewer for viewing purpose.

dropEvent(event)[source]

One or more files where dropped in the GUI, load all the nifti files among them.

resizeEvent(event)[source]
send_sigint(*args)[source]
set_window_title(title)[source]
update_model(model)[source]
class mdt.gui.maps_visualizer.main.PlottingFrameInfoToStatusBar(controller, status_bar_label)[source]

Bases: mdt.gui.maps_visualizer.renderers.base.PlottingFrameInfoViewer

clear_voxel_info()[source]

Tell the info viewer that we are no longer looking at a specific voxel.

set_voxel_info(map_name, onscreen_coords, data_index)[source]

Highlight a single voxel.

Parameters:
  • map_name (str) – the name of the map for which we are displaying the value
  • onscreen_coords (tuple of x,y) – the coordinates of the voxel onscreen
  • data_index (tuple of x,y,z,v) – the 4d coordinates of the corresponding voxel in the data
mdt.gui.maps_visualizer.main.pyqtSlot(*args, **kwargs)

Mocked decorator, needed in the case we need to mock a decorator

mdt.gui.maps_visualizer.main.start_gui(data=None, config=None, controller=None, app_exec=True, show_maximized=False, window_title=None)[source]

Start the GUI with the given data and configuration.

Parameters:
  • data (DataInfo) – the initial set of data
  • config (MapPlotConfig) – the initial configuration
  • controller (mdt.gui.maps_visualizer.base.QtController) – the controller to use in the application
  • app_exec (boolean) – if true we execute the Qt application, set to false to disable.
  • show_maximized (true) – if we want to show the window in a maximized state
  • window_title (str) – the title of the window
Returns:

the generated window

Return type:

MapsVisualizerWindow

mdt.gui.maps_visualizer.widgets module

mdt.gui.maps_visualizer.widgets.pyqtSlot(*args, **kwargs)

Mocked decorator, needed in the case we need to mock a decorator

Module contents