MibActiveDataset

class controllers.MibActiveDataset

MIBACTIVEDATASET - Controller for the Datasets panel in MIB.

This class manages the Datasets panel UI, which handles:
  • Selection and switching between dataset buffers (10 available)

  • Dataset set operations (add new sets, rename, sort, remove)

  • Dataset type selection (Standard, Virtual, BigData)

  • Buffer synchronization (XY, XYZ, XYZT dimensions)

  • Linked view management across buffers

  • Context menu operations for buffer management

The controller maintains references to the main MIB controller, view, model, and panel GUI handles. It synchronizes the UI state with the model via event listeners and propagates user actions back to the model for processing.

See also

MibController, MibModel, models.MibModel.buffers_Callback, models.MibModel.setsOps_Callbacks

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

MIBACTIVEDATASET - Constructor for the Datasets panel controller.

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

Initializes the controller for the Datasets panel, which manages dataset/buffer selection, set operations, and dataset type changes. Sets up all GUI callbacks for buffer buttons, context menus, dropdown controls, and model event listeners.

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

  • view - [MibView] handle to main application view

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

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

Output Arguments:
  • obj - [MibActiveDataset] 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. Updates widgets from current model state (update_fromModel)

  4. Wires callbacks for 10 buffer buttons (buffer1-buffer10)

  5. Wires callbacks for dataset set operations (add, rename, sort, remove)

  6. Wires callbacks for dataset type dropdown

  7. Wires context menus for buffer operations (duplicate, sync, link, close)

  8. Adds listener for DatasetsPanelUpdate events from model

  9. Sets ThemeChangedFcn of the panel figure to repaint the buffer buttons after a light/dark theme switch (R2025a or newer), see paintBufferButton

Supported buffer operations:
  • 'duplicate' - duplicate selected buffer

  • 'sync_xy' - synchronize XY dimensions across buffers

  • 'sync_xyz' - synchronize XYZ dimensions across buffers

  • 'sync_xyzt' - synchronize all dimensions and time across buffers

  • 'link_views' - link view state across buffers

  • 'close' - close selected buffer

  • 'closeSet' - close entire dataset set

See also

buffers_Callback, setsOps_Callbacks, buffers_ContextMenu, update_fromModel

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

view

MibView (full app view)

Method Summary
buffers_Callback(hWidget, hData, buttonId)

BUFFERS_CALLBACK - buffers_Callback(obj, hWidget, hData).

Syntax:
obj.buffers_Callback(hWidget, hData, buttonId)

callbacks for press obj.handles.panels.activeDataset.handles.buffer1 buttons, selects the dataset stored in a buffer defined by the pressed button

Handles the following widgets: - obj.handles.panels.activeDataset.handles.bufferN, where N is number 1 to 10,

Input Arguments:
  • obj - controllers.MibActiveDataset

  • hWidget - handle to the pressed widget (matlab.ui.control.Button)

  • hData - handle to supporting ButtonPushedData class (matlab.ui.eventdata.ButtonPushedData)

  • buttonId - [optional] index of dataset in MibModel (the shown one is obj.mibModel.id), when omitted a generic callback on the buffer button press is executed

buffers_ContextMenu(parameter, buttonID, BatchOptIn)

BUFFERS_CONTEXTMENU - Callback for context menu operations on dataset buffers.

Syntax:
obj.buffers_ContextMenu(parameter, buttonID, BatchOptIn)

Handles context menu operations for the buffer buttons (buffer1 through buffer10) in the Datasets panel. Supports both interactive mode (via right-click menu) and batch processing mode. Batch-compatible.

Input Arguments:
  • parameter - [char] action to perform:

    • 'duplicate' - duplicate selected buffer to another buffer

    • 'sync_xy' - synchronize XY view parameters across buffers

    • 'sync_xyz' - synchronize XYZ view parameters across buffers

    • 'sync_xyzt' - synchronize all dimensions and time across buffers

    • 'link_views' - link or unlink views between two buffers

    • 'close' - close the current dataset in the buffer

    • 'closeSet' - close all datasets in the current set

  • buttonID - [numeric] local buffer index (1-10), or NaN when called from batch mode without a physical button press

  • BatchOptIn - (optional) [struct] batch processing mode options; when NaN, returns default structure via 'SyncBatch' event

Output Arguments:

None

Example 1 - duplicate buffer interactively:

obj.buffers_ContextMenu('duplicate', 2)

Example 2 - duplicate dataset in batch mode:

BatchOpt.Source = {'Container 1'};
BatchOpt.Destination = {'Container 3'};
BatchOpt.showWaitbar = false;
obj.buffers_ContextMenu('duplicate', NaN, BatchOpt)
datasetTypeChange_Callback(hWidget, hData)

DATASETTYPECHANGE_CALLBACK - callback for selection of entry in Datasets.datasetType dropdown to choose the type of the dataset stored.

Syntax:
obj.datasetTypeChange_Callback(hWidget, hData)

in the selected buffer/container. Available options - Standard standard MIB dataset, loaded completely into memory - Virtual the virtual mode, when the data is loaded from disk on demand - BigData to work with pyramidal/chunked data formats [for future development]

Input Arguments:
  • hWidget - handle to the pressed widget

  • hData - handle to supporting data class

paintBufferButton(buttonHandle, state)

PAINTBUFFERBUTTON - set the background color of a buffer button of the Datasets panel.

Syntax:
obj.paintBufferButton(buttonHandle, state)

Single place that defines the colors of the buffer buttons (obj.handles.buffer1 … obj.handles.buffer10), so that all code paths (update_fromModel, buffers_Callback, buffers_ContextMenu) paint them identically in the light and dark themes.

The colors come from the buffer... fields of utils.themeColors for the theme of obj.UIFigure (Theme.BaseColorStyle): pastels in the light theme, darker tones of the same hues in the dark theme.

The font color is never set and stays on auto, so it always follows the theme. An empty buffer gets BackgroundColorMode = 'auto' rather than a color, so it follows the theme on its own. The other states are explicit colors, which MATLAB does not remap on a theme switch; obj.UIFigure.ThemeChangedFcn therefore repaints the buttons via update_fromModel. Releases without the figure Theme property (before R2025a) always get the light palette.

Input Arguments:
  • buttonHandle - [matlab.ui.control.Button] handle of the buffer button

  • state - [char] state of the dataset stored in the buffer: 'empty' - placeholder, no data loaded; 'inMemory' - data present, but no file on disk (e.g. loaded from Examples); 'fileBacked' - data loaded from a file; 'selected' - the currently shown buffer, overrides the other states

Usage:
obj.paintBufferButton(obj.handles.buffer2, 'fileBacked');
setsOps_Callbacks(hWidget, hData, mode)

SETSOPS_CALLBACKS - Callback for dataset set operations (add, rename, remove, select).

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

Handles dataset set operations triggered by the sets dropdown and context menu items in the Datasets panel. Supports add, rename, remove, select, and sort operations.

Input Arguments:
  • hWidget - [matlab.ui.container.Menu | matlab.ui.control.DropDown | matlab.ui.control.Button] handle to the widget that triggered the callback

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

  • mode - (optional) [char] operation mode identifier; when empty or missing, hWidget.Tag is used:

    • 'sets' - change the active dataset set

    • 'setsContextAdd' - add a new dataset set

    • 'setsContextRename' - rename the currently active set

    • 'setsContextSort' - sort dataset sets

    • 'setsContextRemove' - remove the currently active set

Output Arguments:

None

See also

models.MibModel.datasetsSetsOps

update_fromModel(src, evtData)

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

Syntax:
obj.update_fromModel(src, evtData)

This function is triggered either as a controllers.MibActiveDataset.listener to MibModel->DatasetsPanelUpdate event or as a method of controllers.MibActiveDataset.datasetsPanelUpdate() to update widgets of the Datasets panel (obj.view.handles.panels.activeDataset / obj.handles)

Input Arguments:
  • src - handle to MibModel when called as a listener, from controllers.MibActiveDataset it is not provided

  • evtData - event data information, when called as a listener, from controllers.MibActiveDataset it is not provided

Usage:

Example 1:

obj.update_fromModel(); // call from controllers.MibActiveDataset, update widgets of the Datasets panel using MibModel values

Example 2:

notify(obj, 'DatasetsPanelUpdate'); // call from MibModel, update widgets of the Datasets panel using MibModel values