MibRoi

class controllers.MibRoi

Bases: handle

MIBROI - controller for methods of the ROI panel in MIB.

Constructor Summary
MibRoi(mainCtrl, view, guiHandles, model)

MIBROI - Initialize ROI panel controller.

Syntax:
obj = MibRoi(mainCtrl, view, guiHandles, model)
Input Arguments:
  • mainCtrl - [controllers.MibController] handle to main MIB controller

  • view - [views.MibView] handle to main MIB view

  • guiHandles - [struct] GUI component handles for the ROI panel

  • model - [models.MibModel] handle to MIB model

Output Arguments:
  • obj - [MibRoi] initialized ROI panel controller instance

Property Summary
UIFigure

handle to underlying UIFigure

drawingROI

struct tracking an in-progress interactive ROI:

gui

handle to the GUI of the ROI panel (views.components.Roi)

handles

struct of ROI panel handles (panel, listbox, buttons, …)

listeners

cell array of listeners

mibController

controllers.MibController

mibModel

models.MibModel

view

MibView (full app view)

Method Summary
addROI()

ADDROI - Interactively add a new ROI or create one from manual coordinates.

Syntax:
obj.addROI()

Reads the selected ROI type from obj.handles.roiType dropdown (‘Rectangle’, ‘Ellipse’, ‘Polyline’, ‘Lasso’) and either places the ROI interactively on the current image axes or builds it from the coordinate spinners when obj.handles.roiManually is checked.

After successful placement the ROI data struct is stored via core.RoiRegion.storeROI, the ROI list is refreshed, and a ShowImage event is fired to repaint the overlay.

Input Arguments:
  • obj - controllers.MibRoi - the ROI panel controller

Return values: none

Usage:

Example 1:

// called from gui_Callbacks when roiAdd button is pressed
obj.addROI();
gui_Callbacks(hWidget, hData)

GUI_CALLBACKS - callbacks for widgets of some the ROI panel obj.view.handles.panels.roi (obj.cRoi.gui).

Syntax:
obj.gui_Callbacks(hWidget, hData)
Input Arguments:
  • hWidget - handle to the pressed widget

  • hData - handle to supporting data class

listener_updatePanelPosition(src, evtData)

LISTENER_UPDATEPANELPOSITION - Adapt ROI panel grid layout when docked to different AppContainer region.

Syntax:
obj.listener_updatePanelPosition(src, evtData)

The ROI panel uses a mainGridLayout with sub-grids for list/buttons and manual-coordinate areas. Layout is transposed when the panel moves:

  • Bottom - horizontal 5-column layout: ColumnWidth = {310, 3, 320, 3, '1x'}; RowHeight = {'1x'} ColumnSpacing = 12, RowSpacing = 4; Padding = [10 8 10 6]

  • Left/Right - vertical 5-row layout: RowHeight = {130, 3, 130, 3, 1}; ColumnWidth = {'1x'} RowSpacing = 12, ColumnSpacing = 4; Padding = [8 10 6 10]

Each child grid’s Layout.Column (bottom) becomes Layout.Row (vertical) and vice-versa.

Input Arguments:
  • obj - [MibRoi] this controller instance

  • src - [uipanel] the panel whose property changed (obj.view.handles.panels.roiPanel)

  • evtData - [PropertyChangedData] event data; .PropertyName checked for 'Region'

refreshROIList(previousValue)

REFRESHROILIST - Rebuild the ROI list-box items from current hROI.Data and attempt to.

Syntax:
obj.refreshROIList(previousValue)

preserve the previously selected value.

Input Arguments:
  • obj - controllers.MibRoi - the ROI panel controller

  • previousValue - char - previously selected item in the list

Return values: none

Usage:

Example 1:

// refresh list and keep the current selection
obj.refreshROIList(obj.handles.roiList.Value);

Example 2:

// refresh list and select 'All'
obj.refreshROIList('All');
removeROI()

REMOVEROI - Remove selected ROI(s) from the current dataset.

Syntax:
obj.removeROI()

When ‘All’ is selected in the ROI list, removes every ROI after user confirmation. Otherwise removes only the selected ROI. The ROI list is refreshed and the image is repainted.

Input Arguments:
  • obj - controllers.MibRoi - the ROI panel controller

Return values: none

Usage:

Example 1:

// called from gui_Callbacks when roiRemove button is pressed
obj.removeROI();
repositionDrawingROI()

REPOSITIONDRAWINGROI - Reposition the active interactive drawing tool after zoom/pan redraws.

Syntax:
obj.repositionDrawingROI()

the image at a different axes coordinate scale.

Called from controllers.MibController.showImage at the end of every image redraw, so it fires after both scroll-wheel zoom and pan.

The stored data-pixel coordinates in obj.drawingROI.dataPos are converted back to current axes coordinates via models.MibModel.convertDataToMouseCoordinates and applied to the live drawing object, keeping the ROI visually anchored to the same image pixels.

Input Arguments:
  • obj - controllers.MibRoi

Return values: none

roiLoad()

ROILOAD - Load ROIs from a .roi (MAT) file into the current dataset.

Syntax:
obj.roiLoad()

Parameters: none Return values: none

roiModify()

ROIMODIFY - Interactively modify (redraw) an existing ROI.

Syntax:
obj.roiModify()

If “All” is selected in the ROI list a dialog prompts the user to choose which ROI to edit. The appropriate draw tool is then re-launched with the current ROI position pre-loaded. After the user confirms (double-click), the ROI data is updated in-place (label preserved).

Input Arguments:
  • obj - controllers.MibRoi - the ROI panel controller

Return values: none

Usage:

Example 1:

// called from gui_Callbacks when roiModify is triggered
obj.roiModify();
roiSave()

ROISAVE - Save ROIs of the current dataset to a .roi (MAT) file.

Syntax:
obj.roiSave()

Parameters: none Return values: none

roiToSelection()

ROITOSELECTION - Highlight the area under the selected ROI(s) in the Selection layer.

Syntax:
obj.roiToSelection()

Rasterises the currently selected ROI(s) into the Selection layer. With Shift held or the Apply segmentation in 3D checkbox enabled, the mask is propagated to all z-slices; otherwise only the current slice is updated. Respects Restrict to material and Restrict to mask flags.

Input Arguments:
  • obj - [controllers.MibRoi] the ROI panel controller

Return values: none

updatePlacementLine(axH)

UPDATEPLACEMENTLINE - Update polygon outline during custom Polyline placement.

Syntax:
obj.updatePlacementLine(axH)

Converts data-pixel vertices stored in obj.drawingROI.placementVertices to current axes coordinates and creates or updates the placement line object on the given axes.

Input Arguments:
  • axH - handle to the image axes (imViewAxes)

Output Arguments:

(none)