MibSegmentation

class controllers.MibSegmentation

MIBSEGMENTATION - controller for methods of the Segmentation panel in MIB.

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

MIBSEGMENTATION - Constructor for the Segmentation panel controller.

Syntax:
obj = MibSegmentation(mainCtrl, view, guiHandles, model)

Initializes the controller for the Segmentation panel, which provides a comprehensive suite of image segmentation tools. Sets up callbacks for all segmentation tools, materials table management, color schemes, and utility functions.

Input Arguments:
  • mainCtrl - [controllers.MibController] handle to main MIB controller

  • view - [MibView] handle to main application view

  • guiHandles - [views.components.Segmentation] handle to Segmentation panel GUI component

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

Output Arguments:
  • obj - [MibSegmentation] initialized controller instance

Initialization sequence:
  1. Stores references to main controller, view, model, and GUI handles

  2. Caches panel-specific handles for efficient access

  3. Initializes lasso/object picker mode tracking (UserData storage)

  4. Updates segmentation widgets from current model state

  5. Renders the materials table

  6. Wires callbacks for color wheel button (color scheme selection)

  7. Wires callbacks for materials table operations (show, rename, color, quantify)

  8. Wires callbacks for materials management (add, insert, swap, reorder, export, remove)

  9. Wires callbacks for layer movement (materials ↔ selection, materials ↔ mask, mask ↔ materials in 2D/3D/4D)

  10. Wires callbacks for rendering operations (MIB, Fiji)

  11. Wires callbacks for segmentation tools (brush, 3D ball, spot, lasso, magic wand, threshold, drag-and-drop, membrane, SAM, annotations, 3D lines)

  12. Adds listener for panel region changes (left, right, bottom docking)

  13. Sets ThemeChangedFcn of the panel figure to repaint the materials table

Supported segmentation tools:
  • Brush, 3D Ball, Spot (radius, eraser factor, clustering)

  • Lasso, Object Picker (manual/automatic selection)

  • Magic Wand (range, radius, connectivity)

  • Black and White Thresholding (adaptive/global, low/high values)

  • Membrane Click Tracker (scale, width, signal type)

  • Segment Anything Model (SAM/SAM2, various segmentation modes)

  • Annotations (list, precision, display options)

  • 3D Lines (interactive line drawing)

  • Drag and Drop Materials (move objects between layers)

See also

colorWheel_ContextMenu, materialsTable_ContextMenu, segmentationTool_Callback, updateMaterialsTable

Property Summary
UIFigure

handle to underlying UIFigure

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

thresholdSliderStep

step for threshold slider context menu (Default/Set step…)

view

MibView (full app view)

Method Summary
annotationsPanel_Callback(hWidget, hData)

ANNOTATIONSPANEL_CALLBACK - Callback for annotations tool widgets.

Syntax:
obj.annotationsPanel_Callback(hWidget, hData)

Handles callbacks for annotations segmentation tool widgets in the Segmentation panel. Supports annotation list management, visualization options, and precision control.

Input Arguments:
  • hWidget - [matlab.ui.control.Button | matlab.ui.control.CheckBox | matlab.ui.control.Spinner | matlab.ui.control.DropDown] pressed widget; operation identified via hWidget.Tag:

    • 'annAnnotationList' - open annotation list management window

    • 'annShowPrompt' - show/hide prompt when adding new annotations

    • 'annFocusOnValue' - focus on value field when showing prompt

    • 'annPrecision' - set floating-point precision for annotation values

    • 'annDeleteAll' - delete all annotations from dataset

    • 'annDisplayAs' - select annotation visualization mode

  • hData - [matlab.ui.eventdata.ButtonPushedData | matlab.ui.eventdata.ValueChangedData] event data from widget

Output Arguments:

None

brushPanel_Callback(hWidget, hData, mode)

BRUSHPANEL_CALLBACK - Callback for brush, 3D ball, and spot tool widgets.

Syntax:
obj.brushPanel_Callback(hWidget, hData, mode)

Handles callbacks for brush, 3D ball, and spot segmentation tool widgets in the Segmentation panel. Supports brush size, eraser factor, clustering mode, and interpolation settings configuration.

Input Arguments:
  • hWidget - [matlab.ui.control.Button | matlab.ui.control.CheckBox | matlab.ui.control.Spinner | matlab.ui.control.DropDown] pressed widget; operation identified via hWidget.Tag (when provided):

    • 'brushRadius' - adjust brush size/radius

    • 'brushFixToScreen' - toggle fixed screen-pixel brush size

    • 'eraserFactor' - set eraser magnification factor

    • 'interpolationSettings' - open interpolation settings dialog

    • 'brushUseClustering' - enable/select clustering mode

    • 'clustersPar1' - set clustering mode parameter 1

    • 'clustersPar2' - set clustering mode parameter 2

  • hData - [matlab.ui.eventdata.ValueChangedData] event data from widget

  • mode - (optional) [char] widget identifier; when provided, hWidget and hData are ignored

Output Arguments:

None

Example - set brush clustering mode via direct call:

obj.brushPanel_Callback([], [], obj.handles.brushUseClustering.SelectedObject.Text)
colorWheel_ContextMenu(menuEntry, selectedData)

COLORWHEEL_CONTEXTMENU - Callback for color scheme selection context menu.

Syntax:
obj.colorWheel_ContextMenu(menuEntry, selectedData)

Handles color scheme selection from the color wheel button context menu (obj.handles.colorWheel). Supports predefined color schemes (default, distinct, random, qualitative, diverging, sequential) and MATLAB colormaps (Jet, HSV).

Input Arguments:
  • menuEntry - [matlab.ui.container.Menu] handle to the pressed context menu entry; scheme identifier from menuEntry.Tag

  • selectedData - [matlab.ui.eventdata.MenuSelectedData] event data containing the source button object (selectedData.ContextObject)

Output Arguments:

None

Available color schemes (menuEntry.Tag):
  • 'colorWheelContextSchemeDef' - default 6-color scheme

  • 'colorWheelContextSchemeDist' - distinct colors (20 colors)

  • 'colorWheelContextSchemeRandom' - random color generation

  • 'colorWheelContextSchemeSwap' - swap current colors

  • 'colorWheelContextSchemeQMC' - qualitative, Monte Carlo Half-Baked (3-12 colors)

  • 'colorWheelContextSchemeDDD' - diverging, Deep Bronze → Deep Teal (3-11 colors)

  • 'colorWheelContextSchemeDRK' - diverging, Ripe Plum → Kaitoke Green (3-11 colors)

  • 'colorWheelContextSchemeDBG' - diverging, Bordeaux → Green Vogue (3-11 colors)

  • 'colorWheelContextSchemeDCB' - diverging, Carmine → Bay of Many (3-11 colors)

  • 'colorWheelContextSchemeSKG' - sequential, Kaitoke Green (3-9 colors)

  • 'colorWheelContextSchemeSCB' - sequential, Catalina Blue (3-9 colors)

  • 'colorWheelContextSchemeSM' - sequential, Maroon (3-9 colors)

  • 'colorWheelContextSchemeSAB' - sequential, Astronaut Blue (3-9 colors)

  • 'colorWheelContextSchemeSD' - sequential, Downriver (3-9 colors)

  • 'colorWheelContextSchemeMJ' - MATLAB colormap: Jet

  • 'colorWheelContextSchemeMH' - MATLAB colormap: HSV

  • 'colorWheelContextSchemeSetDef' - set current scheme as default

  • 'colorWheelContextSchemeUpdate' - update colors from default scheme

dragPanel_Callback(hWidget, hData)

DRAGPANEL_CALLBACK - Callback for drag-and-drop materials tool widgets.

Syntax:
obj.dragPanel_Callback(hWidget, hData)

Handles callbacks for drag-and-drop material movement tool widgets in the Segmentation panel. Supports layer selection, offset configuration, and directional material shifting.

Input Arguments:
  • hWidget - [matlab.ui.control.Button | matlab.ui.control.NumericEditField | matlab.ui.control.DropDown] pressed widget; operation identified via hWidget.Tag:

    • 'dragLayer' - select target layer for drag-and-drop operation

    • 'dragValue' - set pixel offset for material shifting

    • 'dragUp' - shift layer upward (negative Y direction)

    • 'dragRight' - shift layer rightward (positive X direction)

    • 'dragLeft' - shift layer leftward (negative X direction)

    • 'dragDown' - shift layer downward (positive Y direction)

  • hData - [matlab.ui.eventdata.ButtonPushedData | matlab.ui.eventdata.ValueChangedData] event data from widget

Output Arguments:

None

favTool_Callback(hWidget, hData)

FAVTOOL_CALLBACK - callbacks for press of obj.handles.panels.segmentation.handles.favoriteTool in.

Syntax:
obj.favTool_Callback(hWidget, hData)

obj.handles.panels.segmentation panel. Select the current tool as favorite, the favorite tools available upon press of the ‘D’ keyboard shortcut key

Input Arguments:
  • hWidget - handle to the pressed widget

  • hData - handle to supporting data class

gui_Callbacks(hWidget, hData)

GUI_CALLBACKS - Callback for general segmentation panel widgets.

Syntax:
obj.gui_Callbacks(hWidget, hData)

Handles callbacks for general segmentation panel widgets including model creation/loading, material management, color scheme control, and visualization settings.

Input Arguments:
  • hWidget - [matlab.ui.control.Button | matlab.ui.control.CheckBox] pressed widget; operation identified via hWidget.Tag:

    • 'createModel' - create a new segmentation model

    • 'loadModel' - load model from file

    • 'addMaterial' - add material to model

    • 'removeMaterial' - remove material from model

    • 'colorWheel' - generate random colors for materials; the random seed is requested in a dialog, unless the button was clicked with Ctrl held down, in which case the generator is seeded from the system clock without a dialog

    • 'viewSettings' - open visualization settings dialog for model/mask

  • hData - [matlab.ui.eventdata.ButtonPushedData | matlab.ui.eventdata.ValueChangedData] event data from widget

Output Arguments:

None

lassoPanel_Callback(hWidget, hData)

LASSOPANEL_CALLBACK - Callback for lasso and object picker tool widgets.

Syntax:
obj.lassoPanel_Callback(hWidget, hData)

Handles callbacks for lasso and object picker segmentation tool widgets in the Segmentation panel. Supports tool selection, mode switching (add/remove), manual placement, and object property recalculation.

Input Arguments:
  • hWidget - [matlab.ui.control.Button | matlab.ui.control.CheckBox | matlab.ui.control.NumericEditField | matlab.ui.control.DropDown] pressed widget; operation identified via hWidget.Tag:

    • 'lassoType' - select lasso tool type (Lasso/Object Picker)

    • 'lassoMode' - set add/remove/replace mode for lasso selection

    • 'lassoManually' - enable/disable manual lasso area placement

    • 'lassoSelect' - execute selection with current lasso parameters

    • 'lassoX1' - set minimum X coordinate for manual placement

    • 'lassoY1' - set minimum Y coordinate for manual placement

    • 'lassoWidth' - set width for manual lasso placement

    • 'lassoHeight' - set height for manual lasso placement

    • 'objectRecalculate' - recalculate 3D object properties from 2D selection

  • hData - [matlab.ui.eventdata.ButtonPushedData | matlab.ui.eventdata.ValueChangedData] event data from widget

Output Arguments:

None

lines3DPanel_Callback(hWidget, hData)

LINES3DPANEL_CALLBACK - Callback for 3D lines tool widgets.

Syntax:
obj.lines3DPanel_Callback(hWidget, hData)

Handles callbacks for 3D line drawing and editing tool widgets in the Segmentation panel. Supports line visualization, table management, and mouse interaction mode configuration.

Input Arguments:
  • hWidget - [matlab.ui.control.Button | matlab.ui.control.CheckBox | matlab.ui.control.DropDown] pressed widget; operation identified via hWidget.Tag:

    • 'linesTableView' - open line vertices and edges table dialog

    • 'linesShowLines' - toggle 3D lines visibility in image

    • 'linesClick' - set action for left-click (add node, delete, etc.)

    • 'linesShiftClick' - set action for Shift+left-click

    • 'linesCtrlClick' - set action for Ctrl+left-click

    • 'linesAltClick' - set action for Alt+left-click

  • hData - [matlab.ui.eventdata.ButtonPushedData | matlab.ui.eventdata.ValueChangedData] event data from widget

Output Arguments:

None

listener_updatePanelPosition(src, evtData)

LISTENER_UPDATEPANELPOSITION - Listener callback to adapt Segmentation panel layout when docked position changes.

Syntax:
obj.listener_updatePanelPosition(src, evtData)

Dynamically reconfigures the panel’s grid layout and widget positions when the Segmentation panel is docked to different regions (left, right, or bottom) of the AppContainer. Optimizes widget arrangement for each docking orientation.

Input Arguments:
  • src - [matlab.ui.container.Panel] the panel object whose Region property changed

  • evtData - [matlab.ui.eventdata.PropertyChangedData] property change event data

Output Arguments:

None

Layout configurations:

The Segmentation panel uses a mainGridLayout with 4 rows/columns:

Left / Right docking - vertical, 4-row layout:
  • RowHeight = {26, '1x', 54, 187}

  • ColumnWidth = {'1x'}

  • topGridLayout (row 1): horizontal arrangement with ColumnWidth = {45, 45, 22, 22, '1x', 22, 22, 20}

  • middleGridLayout (row 3): 2-column × 2-row grid with ColumnWidth = {'1x', '1x'}, RowHeight = {'1x', '1x'}

Bottom docking - horizontal, 4-column layout:
  • ColumnWidth = {60, 260, '1x', 260}

  • RowHeight = {'1x'}

  • topGridLayout (column 1): vertical arrangement with RowHeight = {22, 22, 22, 22, '1x', '1x', 22, 22}

  • middleGridLayout (column 3): 1-column × 4-row grid with ColumnWidth = {'1x'}, RowHeight = {'1x', '1x', '1x', '1x'}

magicwandPanel_Callback(hWidget, hData)

MAGICWANDPANEL_CALLBACK - Callback for magic wand segmentation tool widgets.

Syntax:
obj.magicwandPanel_Callback(hWidget, hData)

Handles callbacks for magic wand and region growing tool widgets in the Segmentation panel. Supports method selection, range/radius configuration, and connectivity control.

Input Arguments:
  • hWidget - [matlab.ui.control.Spinner | matlab.ui.container.ButtonGroup | matlab.ui.control.NumericEditField | matlab.ui.control.DropDown] pressed widget; operation identified via hWidget.Tag:

    • 'magicMethod' - select Magic Wand or Region Growing segmentation method

    • 'magicRange1' - set first intensity range parameter

    • 'magicRange2' - set second intensity range parameter

    • 'magicRadius' - set effective radius for magic wand detection

    • 'magicConnect' - select object connectivity (4-connected or 8-connected)

  • hData - [matlab.ui.eventdata.ValueChangedData | matlab.ui.eventdata.SelectionChangedData] event data from widget

Output Arguments:

None

materialsTable_CellSelectionCallback(cellIndices)

MATERIALSTABLE_CELLSELECTIONCALLBACK - Handle cell selection in materials table (obj.handles.materialsTable).

Syntax:
obj.materialsTable_CellSelectionCallback(cellIndices)
materialsTable_ContextMenu(menuEntry, selectedData)

MATERIALSTABLE_CONTEXTMENU - Callback for materials table context menu operations.

Syntax:
obj.materialsTable_ContextMenu(menuEntry, selectedData)

Handles context menu operations on the materials table (obj.handles.materialsTable). Supports material visualization, renaming, color selection, quantification, and unlinking.

Input Arguments:
  • menuEntry - [matlab.ui.container.Menu] handle to the pressed context menu entry; operation identified via menuEntry.Tag

  • selectedData - [matlab.ui.eventdata.MenuSelectedData] event data containing the table object (selectedData.ContextObject)

Output Arguments:

None

Supported menu operations (menuEntry.Tag):
  • 'materialsTableContextShowSelected' - show only the selected material in view

  • 'materialsTableContextRename' - rename the selected material

  • 'materialsTableContextSetColor' - open color picker to change material color

  • 'materialsTableContextQuant' - open quantification dialog for selected material

  • 'materialsTableContextUnlink' - unlink material from “Add to” reference material

materialsTable_applyRowStyle(rowIndex, isHighlighted, columnIndex, fontColor, highlightColor)

MATERIALSTABLE_APPLYROWSTYLE - Apply highlighting style to material row.

Syntax:
obj.materialsTable_applyRowStyle(rowIndex, isHighlighted, columnIndex, fontColor, highlightColor)
Input Arguments:

obj - Controller object rowIndex - Row index to style (1-based) isHighlighted - true to highlight, false to restore original color columnIndex - specific column(s) to style fontColor - Font color to use highlightColor - Background color for highlighting (empty for the plain cell color)

materialsTable_moveLayers(obj_type_from, obj_type_to, layers_id, action_type)

MATERIALSTABLE_MOVELAYERS - callbacks for the context menu of the segmentation table to move layers (obj.handles.panels.segmentation.handles.materialsTableContextM2S):.

Syntax:
obj.materialsTable_moveLayers(obj_type_from, obj_type_to, layers_id, action_type)

-> Material to Selection -> Material to Mask -> Mask to Material

Input Arguments:
  • obj_type_from - [char] the source layer (‘selection’, ‘mask’, ‘labels’)

  • obj_type_to - [char] the destination layer (‘selection’, ‘mask’, ‘labels’)

  • layers_id - [char] identifier of the dataset (‘2D, Slice’, ‘3D, Stack’, ‘4D, Dataset’)

  • action_type - [char] what to do (‘replace’, ‘add’, ‘remove’)

membranePanel_Callback(hWidget, hData)

MEMBRANEPANEL_CALLBACK - Callback for membrane click tracker tool widgets.

Syntax:
obj.membranePanel_Callback(hWidget, hData)

Handles callbacks for membrane click tracker segmentation tool widgets in the Segmentation panel. Supports tracking parameter configuration, signal type selection, and visualization control.

Input Arguments:
  • hWidget - [matlab.ui.control.CheckBox | matlab.ui.control.Spinner] pressed widget; operation identified via hWidget.Tag:

    • 'membraneScale' - set scale parameter for membrane tracking sensitivity

    • 'membraneWidth' - set detected membrane thickness/width

    • 'membraneStraightLine' - enable/disable straight line mode (vs. tracked membrane)

    • 'membraneBlackSignal' - select signal type (black-on-white vs. white-on-black)

    • 'membraneRecenterView' - enable/disable automatic view recentering after point placement

  • hData - [matlab.ui.eventdata.ValueChangedData] event data from widget

Output Arguments:

None

objects3D_Callback()

OBJECTS3D_CALLBACK - Set whether the objects of an instance model are 2D or 3D.

Syntax:
obj.objects3D_Callback()

Callback of obj.handles.objects3D, the “3D objects” checkbox of the Segmentation panel. Writes the checkbox state to labels.objects3D of the active dataset (see core.MibLabels.objects3D):

  • checked - each index names one object through the whole volume, as in a stitched model. Next empty index (the addMaterial button of these models) takes the index above the highest in the model; Squeeze (the removeMaterial button) renumbers the whole model

  • unchecked - the numbering restarts on every slice. Next empty index takes the index above the highest on the shown slice and reads only that slice; Squeeze renumbers only the shown slice

The checkbox is enabled only for 65535 and 4294967295 models (updateMaterialsTable keeps it in step with the dataset). The setting is saved with the model in the .model format.

refreshThresholdSliderUpdateMode()

REFRESHTHRESHOLDSLIDERUPDATEMODE - Switch threshold sliders between interactive and on-release updates.

Syntax:
obj.refreshThresholdSliderUpdateMode()

Wires the low/high threshold sliders (thresholdLow, thresholdHigh) of the Segmentation panel->Black and white thresholding tool to the appropriate callback type based on the threshold3D/threshold4D checkbox state:

  • 2D mode (both checkboxes off) - thresholding is fast, so the result is updated interactively while dragging the slider (ValueChangingFcn).

  • 3D/4D mode (either checkbox on) - thresholding is slow, so the result is updated only once the slider is released (ValueChangedFcn).

Call this whenever the threshold3D/threshold4D checkbox state changes, including programmatic changes (e.g. when applying a preset or refreshing widgets).

Input Arguments:

(none)

Output Arguments:

(none)

renderIsosurface()

RENDERISOSURFACE - Render the currently selected material(s) as MATLAB isosurfaces.

Syntax:
obj.renderIsosurface()

Prompts the user for mesh generation parameters (volume reduction, smoothing, face limit, orthoslice) and renders the selected material - or all materials when showAllMaterials is active - as a 3-D isosurface mesh in a dedicated MATLAB figure. Delegates mesh computation to utils.isosurfaceMibRendering.

Entry points:
  • Context menu: materialsTable_ContextMenu → 'materialsTableContextRenMat'

  • Ribbon: model_Callbacks → 'MATLAB isosurface'

Input Arguments:

(none beyond obj)

Output Arguments:

None

restrictMask_Callback()

RESTRICTMASK_CALLBACK - callbacks for press of obj.handles.restrictMask in.

Syntax:
obj.restrictMask_Callback()

obj.handles.panels.segmentation panel. Restrict selection to the mask layer

restrictMaterial_Callback()

RESTRICTMATERIAL_CALLBACK - callbacks for press of obj.handles.panels.segmentation.handles.restrictMaterial in.

Syntax:
obj.restrictMaterial_Callback()

obj.handles.panels.segmentation panel. Restrict selection to the selected material in obj.handles.panels.segmentation.handles.materialsTable

Input Arguments:

samPanel_Callback(hWidget, hData)

SAMPANEL_CALLBACK - Callback for Segment Anything Model (SAM) tool widgets.

Syntax:
obj.samPanel_Callback(hWidget, hData)

Handles callbacks for Segment Anything Model segmentation tool widgets in the Segmentation panel. Supports SAM version selection, segmentation method, prompt management, and result layer configuration.

Input Arguments:
  • hWidget - [matlab.ui.control.Button | matlab.ui.control.CheckBox | matlab.ui.control.DropDown] pressed widget; operation identified via hWidget.Tag:

    • 'samMethod' - select SAM usage method (interactive, automatic, landmark)

    • 'samVersion' - select SAM version (SAM 1 or SAM 2)

    • 'samDataset' - select dataset type to apply segmentation

    • 'samDestination' - select destination layer for segmentation results

    • 'samMode' - set segmentation mode (replace, add, or subtract)

    • 'samSettings' - open SAM configuration dialog

    • 'samList' - show list of annotation points for landmark mode

    • 'samClear' - clear all annotation points/prompts

    • 'samSegment' - execute SAM segmentation

  • hData - [matlab.ui.eventdata.ButtonPushedData | matlab.ui.eventdata.ValueChangedData] event data from widget

Output Arguments:

None

segmentationTool_Callback(segmToolIndex)

SEGMENTATIONTOOL_CALLBACK - callbacks for press of obj.handles.panels.segmentation.handles.segmTool dropdown in.

Syntax:
obj.segmentationTool_Callback(segmToolIndex)

obj.handles.panels.segmentation panel. Select segmentation tool

Input Arguments:
  • segmToolIndex - [optional] index of the segmentation tool to select, when not provided, takes currently selected value in obj.view.handles.panels.segmentation.handles.segmTool.ValueIndex

thresholdSlider_ContextMenu(menuEntry, selectedData)

THRESHOLDSLIDER_CONTEXTMENU - Callbacks for the context menu of the threshold Low/High sliders.

Syntax:
obj.thresholdSlider_ContextMenu(menuEntry, selectedData)

(obj.handles.thresholdLow, obj.handles.thresholdHigh)

Input Arguments:
  • menuEntry - handle to the pressed context menu entry, ‘matlab.ui.container.Menu’ class

  • selectedData - handle to ‘matlab.ui.eventdata.MenuSelectedData’ class; selectedData.ContextObject identifies the slider that was right-clicked

Available menu options from ‘menuEntry.Tag’:
  • ‘thresholdSliderContextDefault’ - reset slider step to default (1)

  • ‘thresholdSliderContextSetStep’ - set custom slider step via dialog

Usage:

Example 1:

obj.thresholdSlider_ContextMenu(menuEntry, selectedData);  // called from context menu
thresholdingPanel_Callback(hWidget, hData)

THRESHOLDINGPANEL_CALLBACK - Callback for black and white thresholding tool widgets.

Syntax:
obj.thresholdingPanel_Callback(hWidget, hData)

Handles callbacks for black and white thresholding segmentation tool widgets in the Segmentation panel. Supports adaptive and global thresholding modes, threshold value adjustment, and multi-dimensional processing.

Input Arguments:
  • hWidget - [matlab.ui.control.Button | matlab.ui.control.CheckBox | matlab.ui.control.Spinner | matlab.ui.container.ButtonGroup | matlab.ui.control.NumericEditField | matlab.ui.control.DropDown | matlab.ui.control.Slider] pressed widget; operation identified via hWidget.Tag:

    • 'thresholdAdaptive' - enable/disable adaptive thresholding mode

    • 'thresholdType' - select thresholding algorithm (global, adaptive, etc.)

    • 'thresholdInvert' - invert image before thresholding in adaptive mode

    • 'threshold3D' - apply thresholding to all Z slices (3D mode)

    • 'threshold4D' - apply thresholding to all Z and T dimensions (4D mode)

    • 'thresholdLow' - adjust low threshold value using slider

    • 'thresholdHigh' - adjust high threshold value using slider

    • 'thresholdLowValue' - set low threshold value numerically

    • 'thresholdHighValue' - set high threshold value numerically

    • 'threshold' - execute the thresholding operation

  • hData - [matlab.ui.eventdata.ButtonPushedData | matlab.ui.eventdata.ValueChangedData | matlab.ui.eventdata.ValueChangingData | matlab.ui.eventdata.SelectionChangedData] event data from widget

Output Arguments:

None

updateCheckboxes(BatchOptIn)

UPDATECHECKBOXES - Batch function to tweak the state of checkboxes in the Segmentation panel.

Syntax:
obj.updateCheckboxes()
obj.updateCheckboxes(BatchOptIn)
Input Arguments:
  • BatchOptIn - (optional) [struct] batch processing structure; when NaN returns default options via SyncBatch event. Fields:

    • .FixSelectionToMaterial - [cell] restrict selection to material: 'Unchanged', 'Checked', 'Unchecked'

    • .MaskedArea - [cell] restrict selection to masked area: 'Unchanged', 'Checked', 'Unchecked'

    • .BrushWatershed - [cell] use brush with watershed clustering: 'Unchanged', 'Checked', 'Unchecked'

    • .BrushSlic - [cell] use brush with SLIC clustering: 'Unchanged', 'Checked', 'Unchecked'

    • .Objects3D - [cell] the “3D objects” checkbox, 'Unchanged', 'Checked', 'Unchecked'; sets labels.objects3D of 65535/4294967295 models and is ignored for smaller types

    • .SelectedMaterial - [string] index of the selected material; '-1' = mask, '0' = exterior, '1'/'2'… = model materials; leave empty to keep unchanged

    • .SelectedAddToMaterial - [string] index of the add-to material; same conventions as .SelectedMaterial

    • .UnlinkMaterialFromAddTo - [logical] unlink selected material from the AddTo material

Example 1 - check the Fix Selection To Material checkbox:

BatchOptIn.FixSelectionToMaterial = {'Checked'};
obj.mibController.cSegmentation.updateCheckboxes(BatchOptIn);
updateInterpolationSettings()

UPDATEINTERPOLATIONSETTINGS - Show a dialog to modify the selection interpolation settings for the brush tool.

Syntax:
obj.updateInterpolationSettings()

Presents an input dialog (via utils.dlgs.inputUniversalDlg) allowing the user to choose the interpolation type (‘Shape’ or ‘Line’), the number of interpolation points, and the line width (used only in line-interpolation mode). After confirmation the validated values are stored in obj.mibModel.preferences.SegmTools.Interpolation and the interpolation button in the Selection ribbon is refreshed via obj.mibController.updateInterpolationMode(true).

Input Arguments:

(none beyond implicit obj)

Output Arguments:

(none) - returns early when the user cancels the dialog or when a validated value is out of range.

Usage:

Example 1:

obj.cSegmentation.updateInterpolationSettings();  // called from MibController
updateMaterialsTable(position)

UPDATEMATERIALSTABLE - Update materials table rendering with colors and styling.

Syntax:
obj.updateMaterialsTable(position)

Updates the materials table (obj.handles.materialsTable) with current model data. Applies material colors as backgrounds, sets font colors based on selection state, manages visibility checkboxes, and formats special rows (Mask, Exterior).

Input Arguments:
  • position - (optional) [empty | numeric | Inf] scroll position control (default: []):

    • [] - keep current scroll position

    • numeric value - scroll to specific row index

    • Inf - scroll to end of table (last material)

Output Arguments:

None

Example 1 - update table and keep current position:

obj.updateMaterialsTable([])

Example 2 - update table and scroll to row 5:

obj.updateMaterialsTable(5)

Example 3 - update table and scroll to bottom:

obj.updateMaterialsTable(Inf)
updateSamSettings()

UPDATESAMSETTINGS - Open SAM settings dialog for configuring SAM1 or SAM2 parameters.

Syntax:
obj.updateSamSettings()

the SAM tool is implemented in @MibImageDocument class

update_fromModel()

UPDATE_FROMMODEL - update widgets of the Segmentation panel from obj.mibModel.

Syntax:
obj.update_fromModel()