MibController¶
- class controllers.MibController¶
Bases:
handleMIBCONTROLLER - % main controller for MIB.
- Constructor Summary
- MibController(mibModel, mibVersion)¶
MIBCONTROLLER - MibController class constructor.
- Syntax:
obj = MibController(mibModel, mibVersion)
Constructor for the MibController class. Create a new instance of the class with default parameters
- Input Arguments:
mibModel - a handle to mibModel class
mibVersion - a string with the current version of MIB
- Property Summary
- cActiveDataset¶
GUI controllers for the main MIB GUI panels and ribbons
- cDirContents¶
Controller for the Datasets panel
- cFiji¶
Controller for the top ribbon panel
- cImageDoc¶
Controller for the Dir contents panel
- cQuickAccessBar¶
Image document controllers (cell array for multiple documents)
- cRibbon¶
Controller for the Selection and View settings panel
- cRoi¶
Controller for the Fiji Connect panel
- cSegmentation¶
Controller for the ROI panel
- cSelection¶
Controller for the Quick Access Bar
- cStatus¶
Controller for the Segmentation panel
- childControllers¶
Controller for the Status bar
- childControllersIds¶
list of opened sub-controllers
- currentModifier¶
a cell array with names of initialized child controllers
- dndBridgeButton¶
single-shot timer that runs deferredStartupTasks (parallel limit warm-up, check-for-update) shortly after startup, so the slow parcluster query and the network request never block the GUI
- fastPanningMode¶
optional takeover of a few keyboard shortcuts by a child controller: struct with .owner (the controller handle, checked with isvalid so a window that has gone cannot keep the keys) and .fcn, called as fcn(key, modifier) and returning true when it has consumed the key. Set by controllers.InstanceEditor.setShortcutMode; empty otherwise, and then gui_WindowKeyPressFcn behaves exactly as it always did.
- globalResizeTimer¶
true while showImage is recursively rendering a linked-partner panel; prevents infinite mutual propagation between two linked datasets
- Type:¶
guard flag
- keyPressOverride¶
cell array of modifier keys currently held (e.g. {‘shift’}, {‘alt’,’shift’}). Updated by gui_WindowKeyPressFcn and cleared by gui_WindowKeyReleaseFcn. Use this property (via obj.mibController.currentModifier) instead of UIFigure.CurrentModifier inside button callbacks - UIFigure.CurrentModifier is only updated by keyboard events on that specific sub-figure, so it returns {} when a Selection-panel button is clicked with a modifier held.
- listeners¶
global timer for proper resizing of panels (used in MibImageDocument.gui_SizeChangedFcn)
- matlabVersion¶
a cell array with handles to listeners
- mibModel¶
version of Matlab
- mibPath¶
handles to the model
- mibVersion¶
path to MIB installation directory, also available in MibModel
- mibVersionNumeric¶
version of MIB
- mibWebWindow¶
version of MIB in numerical form
- propagatingLinkedView¶
use the fast panning mode, defined in qab by pressing on obj.view.handles.qab.fastpan
- updateCheckTimer¶
handle of the underlying matlab.internal.webwindow class window (used for drag-and-drop of files
- view¶
hidden uibutton returned by utils.attachFileDnD; state for the drag-and-drop bridge lives in its UserData
- Method Summary
- addGuiControllers()¶
ADDGUICONTROLLERS - add GUI components (panels, ribbons) to the main view obj.view.
- Syntax:
obj.addGuiControllers()
- checkForUpdate()¶
CHECKFORUPDATE - Check the MIB website for availability of a newer version.
- Syntax:
obj.checkForUpdate()
Fetches the latest released version number from mib.helsinki.fi and offers to start the update procedure when a newer version is available. The check is only performed when more days than
preferences.System.Update.RecheckPeriodhave passed since the last check.Executed from the single-shot
obj.updateCheckTimerstarted at the end ofMibController.initialize, so the network request never blocks the GUI during startup. The version file is read over HTTPS and, when that fails, once more over plain HTTP; each attempt has a 4 s timeout.- Output Arguments:
(none)
- datasetSlices(parameter)¶
DATASETSLICES - Dispatcher for Menu -> Dataset -> Slice operations.
- Syntax:
obj.datasetSlices(parameter)
Routes slice-related menu actions to the corresponding
MibModelmethods. Checks for virtual-stacking mode and returns early with a warning when applicable.- Input Arguments:
parameter - string identifying the requested action:
'copySlice'- copy a slice from one position to another'swapSlice'- swap two or more slices'insertSlice'- insert empty slice(s)'deleteSlice'- delete a depth (z) slice'deleteFrame'- delete a time-frame'reslice'- stride-reslice the dataset
- Usage:
Example 1
obj.datasetSlices('deleteSlice');Example 2
obj.datasetSlices('reslice');
- deferredStartupTasks()¶
DEFERREDSTARTUPTASKS - Run startup tasks that were deferred to keep startup fast.
- Syntax:
obj.deferredStartupTasks()
Executed once from the single-shot
obj.updateCheckTimera few seconds after the main window becomes visible. Performs work that would otherwise block the startup:warms up
MibModel.cpuParallelLimitMax(the lazy getter queries the parallel cluster profile, ~250 ms, and clampspreferences.System.cpuParallelLimitto the available workers)checks the MIB website for availability of a newer version
- Output Arguments:
(none)
- deleteImageDocument(docIndex)¶
DELETEIMAGEDOCUMENT - Delete an image document and reindex remaining documents.
- Syntax:
obj.deleteImageDocument(docIndex)
Removes the image document at the specified index, properly cleans up all associated resources (FigureDocument, ImageViewDocument, brush cursor), and updates the setOfDatasetsIndex property of all subsequent documents to maintain consistency with their array positions.
The method performs these operations: 1. Validates the document index 2. Calls the document’s delete() method for cleanup 3. Removes the document from the cImageDoc array 4. Reindexes all documents after the deleted position
- Input Arguments:
docIndex - double, index of the document to delete (1-based)
- Output Arguments:
(none)
Example 1 - delete the image document at index 3:
obj.mibController.deleteImageDocument(3);Example 2 - delete all documents (cleanup loop):
while ~isempty(obj.mibController.cImageDoc) obj.mibController.deleteImageDocument(1); end
- dragNdrop_Callback(parameterIn)¶
DRAGNDROP_CALLBACK - Callback for filename drag-and-drop operations into MIB.
- Syntax:
status = obj.dragNdrop_Callback(parameterIn)
Callback for filename drag-and-drop operation in MIB.
- Input Arguments:
parameterIn - cell array, where
the first element is a handle to the webWindow that was the target for the drag-and-drop operation
the second element is a filename that was dragged into MIB
- Output Arguments:
status - logical;
trueon success,falseif the file could not be loaded
- exitProgram(target)¶
EXITPROGRAM - Close MIB, release resources, and signal the AppContainer to exit.
- Syntax:
result = obj.exitProgram(target)
Closes all child controller windows, terminates any active Python session (to free GPU memory), and unloads the OMERO library if present. Registered as
AppContainer.ExitFcnin MibController.initialize.- Input Arguments:
target -
matlab.ui.container.internal.AppContainerhandle to the main application container
- Output Arguments:
result - always
true; reserved for future cancel-on-close support
- findChildId(childName)¶
FINDCHILDID - find id of a child controller.
- Syntax:
id = obj.findChildId(childName)
the child controllers of MIB are stored in obj.childControllersIds cell array. This function look for index that matches with childName string. If it is in the list the function returns its index, otherwise it adds it to the list as a new element
- Input Arguments:
childName - name of a child controller
- Output Arguments:
id - index of the requested child controller or empty if it is not open
Example 1 - find the index of an open child controller:
id = obj.findChildId('mibImageAdjController');
- findMaterialUnderCursor()¶
FINDMATERIALUNDERCURSOR - select the material located under the mouse cursor.
Callback for the ‘Find material under cursor’ keyboard shortcut (default
Ctrl + F). Reads the cursor position from the status-bar pixel label, looks up the model material at that point and selects it in the segmentation materials table. Converted from MIB2@mibController/mibFindMaterialUnderCursor.m.- Syntax:
obj.findMaterialUnderCursor()- Input Arguments:
(none)
- Output Arguments:
(none)
- globalTabGroup_SelectionCallback(hWidget)¶
GLOBALTABGROUP_SELECTIONCALLBACK - Callback for selection of a tab in the top ribbon of MIB.
- Syntax:
obj.globalTabGroup_SelectionCallback() obj.globalTabGroup_SelectionCallback(hWidget)
used to apply lazy loading of the tabs upon the first selection
used as a callback upon selection of tabs in the ribbon: obj.view.handles.ribbon.global.SelectedTabChangedFcn = @(~, ~)obj.globalTabGroup_SelectionCallback;
- Input Arguments:
hWidget - char, tab title to select/initialize, e.g.
'Dataset','Image','Model'; matchesobj.view.handles.ribbon.global.SelectedTab.Title
- Output Arguments:
(none)
Example - check and initialize the Image ribbon tab:
obj.globalTabGroup_SelectionCallback('Image');
- gui_WindowKeyPressFcn(hWidget, hData)¶
GUI_WINDOWKEYPRESSFCN - Callback for a key press in MIB.
- Syntax:
obj.gui_WindowKeyPressFcn(hWidget, hData)
Linked via: obj.UIFigure.WindowKeyPressFcn = @(~, ~)obj.gui_WindowKeyPressFcn();
- Input Arguments:
hWidget - handle to the UIFigure that received the key event
hData -
matlab.ui.eventdata.KeyDataevent data; usehData.KeyandhData.Modifierto identify the pressed key and modifier state
- Output Arguments:
(none)
- gui_WindowKeyReleaseFcn(~, ~)¶
GUI_WINDOWKEYRELEASEFCN - Callback for key release in MIB.
- Syntax:
obj.gui_WindowKeyReleaseFcn(src, evtData)
Restores the brush radius enlarged by the Ctrl-key eraser mode and resets obj.view.ctrlPressed to 0. Registered as WindowKeyReleaseFcn on every ImageViewDocument UIFigure (see MibImageDocument.setupCallbacks).
- Input Arguments:
src - event source UIFigure (unused, indicated by
~in the signature)evtData - key-release event data (unused, indicated by
~in the signature)
- Output Arguments:
(none)
Example - registered automatically in MibImageDocument.setupCallbacks:
obj.UIFigure.WindowKeyReleaseFcn = @(h,d)obj.mibController.gui_WindowKeyReleaseFcn(h,d);
- helpButtons_Callback(hWidget, hData)¶
HELPBUTTONS_CALLBACK - callback for click on the Help buttons in various panels of MIB.
- Syntax:
obj.helpButtons_Callback(hWidget, hData)
The function is triggered by clicks on - obj.handles.panels.dirContents.handles.help
- Input Arguments:
hWidget - handle to the pressed widget
hData - handle to supporting data class
- Output Arguments:
(none)
- initializeLibraries(initList)¶
INITIALIZELIBRARIES - Initialize external libraries and Java paths.
- Syntax:
obj.initializeLibraries() obj.initializeLibraries(initList)
Thin wrapper around
utils.ensureJavaLibrariesthat supplies the MIB installation path andpreferences.ExternalDirs. During startup only the cheap non-Java libraries are requested (seeMibController.initialize); Java libraries (Bio-Formats, Fiji, Imaris, …) are initialized lazily on their first use viautils.ensureJavaLibraries.- Input Arguments:
initList - (optional) cell array of library identifiers to initialize. When empty or missing, all libraries are initialized. Valid identifiers:
'bm3d','omero','mij.jar','bioformats','imageselection','fiji','poi','imaris'
- Output Arguments:
(none)
Example 1 - initialize all libraries:
obj.initializeLibraries();Example 2 - initialize only specific libraries:
obj.initializeLibraries({'mij.jar', 'bioformats'});
- listener_appStateChanged(src, evtData)¶
LISTENER_APPSTATECHANGED - Listener for property changes in the AppContainer document group.
- Syntax:
obj.listener_appStateChanged(src, evtData)
Listener for property change in obj.view.handles.imageViewDocGroup. At the moment used to catch selection of the figure-document in the Image View panel. The selected document is taken from
src.LastSelected(the document group), becauseAppContainer.LastSelectedDocumentis not updated for undocked documents and can name a different set when an undocked document is docked back.- Input Arguments:
src -
matlab.ui.internal.FigureDocumentGrouphandle to the document groupevtData -
matlab.ui.container.internal.appcontainer.PropertyChangedEventData;evtData.PropertyNameidentifies the changed property
- Output Arguments:
(none)
- listener_newDataset(src, evtData)¶
LISTENER_NEWDATASET - Update obj.I (MibDataset) by resizing it to fit on the screen.
- Syntax:
obj.listener_newDataset(src, evtData)
executed upon catch of MibModel->”NewDataset” event
- Input Arguments:
src - handle to MibModel
evtData - event data, an instance of
core.ToggleEventData;evtData.Parametersis a structure with the following fields:.index- (optional) index of obj.I to update;[]updates the currently selected dataset
- Output Arguments:
(none)
Example 1 - update the current dataset (resize to fit screen):
notify(obj.mibModel, 'NewDataset');Example 2 - update dataset 8 specifically:
Options.index = 8; eventdata = core.ToggleEventData(Options); notify(obj.mibModel, 'NewDataset', eventdata);
- listener_showErrorDialog(src, evtData)¶
LISTENER_SHOWERRORDIALOG - Listener callback to show the error dialog.
- Syntax:
obj.listener_showErrorDialog(src, evtData)
Executed upon catch of MibModel
ShowErrorDialogevent.- Input Arguments:
src - handle to MibModel
evtData - event data;
evtData.Parametersis a structure with the following fields:.winTitle- title for the dialog (default:'Error').optionalPrefix- char with the prefix text for the dialog.optionalSuffix- char with the suffix text for the dialog.guiHandle- handle of the parent window (default:obj.view.gui).err- a structure generated by MATLAB when an error is triggered, with.identifier,.message,.causefields.WindowHeight- (optional) height of the dialog in pixels
- Output Arguments:
(none)
Example - fire a ShowErrorDialog event from MibModel:
ErrorDlgOpt.winTitle = 'Error in MibModel.datasetsSetsOps'; ErrorDlgOpt.optionalPrefix = sprintf('!!! Ops !!!\n\nThe last set can not be removed!'); ErrorDlgOpt.err = 'Error text!'; ErrorDlgOpt.WindowHeight = 150; eventdata = core.ToggleEventData(ErrorDlgOpt); notify(obj, 'ShowErrorDialog', eventdata);
- listener_showImage(~, evtData)¶
LISTENER_SHOWIMAGE - Call for render image in the Image View panel.
- Syntax:
obj.listener_showImage(src, evtData)
executed upon catch of MibModel->”ShowImage” event, MIB2 is using ‘plotImage’ event
- Input Arguments:
src - handle to MibModel
evtData - event data, an instance of
core.ToggleEventData;evtData.Parametersis a structure with the following fields:.resizeToMagnification- logical;false(default) keeps current view settings,trueresizes the image to fit the screen.setOfDatasetsIndex- (optional) numerical id of the set to display;[]uses the currently selected set
- Output Arguments:
(none)
- listener_updateDatasetAxes(src, evtData)¶
LISTENER_UPDATEDATASETAXES - Update obj.I (MibDataset).axesX and obj.I (MibDataset).axesY during fit screen, resize, or new dataset drawing.
- Syntax:
obj.listener_updateDatasetAxes(src, evtData)
executed upon catch of MibModel->”UpdateDatasetAxes” event
- Input Arguments:
src - handle to MibModel
evtData - event data, an instance of
core.ToggleEventData;evtData.Parametersis a structure with the following fields:.mode- update mode; one of'resize'(default, keep magFactor, adjust FOV),'fitToScreen'(fit entire image to axes), or'zoom'(scale during zoom).index- (optional) index of obj.I to update;[]for the currently selected dataset.newMagFactor- new magnification factor ('zoom'mode only)
- Output Arguments:
(none)
Example 1 - update axes using a new magnification value for dataset 1:
Options.mode = 'zoom'; Options.newMagFactor = 2; Options.index = 1; eventdata = core.ToggleEventData(Options); notify(obj.mibModel, 'UpdateDatasetAxes', eventdata);Example 2 - resize axes to fit the current panel:
Options.mode = 'resize'; eventdata = core.ToggleEventData(Options); notify(obj.mibModel, 'UpdateDatasetAxes', eventdata);Example 3 - update using the default resize mode:
notify(obj.mibModel, 'UpdateDatasetAxes');
- listener_updateGuiWidgets(~, evtData)¶
LISTENER_UPDATEGUIWIDGETS - Listener callback for the MibModel ‘UpdateGuiWidgets’ event.
- Syntax:
obj.listener_updateGuiWidgets(src, evtData)
Delegates to obj.updateGuiWidgets(), optionally restricting the update to a specific subset of panels when the caller supplies panel names via core.ToggleEventData.Parameters. When Parameters is absent or empty all panels are refreshed.
- Input Arguments:
src - handle to MibModel (unused, indicated by ~ in the signature)
evtData - event data; an instance of
core.ToggleEventDataor a plainevent.EventDatawhen no panel filtering is required.evtData.Parameters: (optional) char or cell array of panel name strings; when omitted or empty, all panels are updated. Valid values:'ribbonImage'- Image ribbon tab (bit depth, color type)'ribbonModel'- Model ribbon tab (model type radio buttons)'QuickAccessBar'- Orientation buttons, ROI, block-mode toggle'depthSlider'- Z-slice number slider and edit field'timeSlider'- Time-frame slider and edit field'checkboxes'- Show mask / model checkboxes, restrict controls'imView'- Image view panel title'activeDataset'- Dataset buffer buttons in the Datasets panel'dirContentsDataset'- Directory contents file list and filter'panelThresholding'- Black/white threshold sliders'selectionPanel'- LUT checkbox and colour table'statusBar'- Status bar current-directory field
- Output Arguments:
(none)
Example 1 - update ALL panels (fire and forget - no event data needed):
notify(obj.mibModel, 'UpdateGuiWidgets');Example 2 - update only the Model ribbon tab and the checkboxes panel:
eventdata = core.ToggleEventData({'ribbonModel', 'checkboxes'}); notify(obj.mibModel, 'UpdateGuiWidgets', eventdata);
- listener_updateToolbar(src, evtData)¶
LISTENER_UPDATETOOLBAR - Update buttons in MIB toolbar.
- Syntax:
obj.listener_updateToolbar(src, evtData)
executed upon catch of MibModel->”UpdateToolbar” event
- Input Arguments:
src - handle to MibModel
evtData - event data, an instance of core.ToggleEventData class with the following fields: .Parameters field containing a structure with the .evtData.Parameters.button - [char] handle of the button in the toolbar, e.g. “fastpan”, .evtData.Parameters.state - [logical] state of the button true->pressed, false->depressed .Source handle to MibModel .EventName string with the event name that triggered the callback see example in MibModel.datasetsSetsOps-> ‘Add set’
- Output Arguments:
(none)
Example 1 - update the state of the fastpan button:
Options.button = 'fastpan'; Options.state = true; eventdata = core.ToggleEventData(Options); notify(obj, 'UpdateToolbar', eventdata);
- listner_ModelEvent(model, evnt)¶
LISTNER_MODELEVENT - Listener callback for generic MibModel events dispatched via
modelNotify.- Syntax:
obj.listner_ModelEvent(model, evnt)
Requires making the eventdata instance of the
core.ToggleEventDataclass.- Input Arguments:
model - handle to MibModel (event source)
evnt - instance of
core.ToggleEventData;evnt.EventNameidentifies the event andevnt.Parameterscarries event-specific payload
- Output Arguments:
(none)
Example 1 - fire a generic model notification:
notifyEvent.Name = "updateSegmentationTable"; eventdata = core.ToggleEventData(notifyEvent); notify(obj, "modelNotify", eventdata);Example 2 - forward key presses from a child controller figure to MIB shortcuts (wire in the child controller’s
addCallbacks, definefigureKeyPressas a method):% in addCallbacks: obj.view.gui.KeyPressFcn = @(~,e) obj.figureKeyPress(e); % method: function figureKeyPress(obj, event) if isempty(event.Character); return; end eventData = struct(); eventData.eventdata = event; eventData = core.ToggleEventData(eventData); notify(obj.mibModel, 'KeyPressEvent', eventData); end
- listner_Standard(model, evnt)¶
LISTNER_STANDARD - Standard listener callback dispatched by evnt.EventName.
- Syntax:
obj.listner_Standard(model, evnt)- Input Arguments:
model - event source (object that fired the event)
evnt - event data;
evnt.EventNameidentifies the event type
- Output Arguments:
(none)
- loadLayout(mode, layoutFilename)¶
LOADLAYOUT - Restore MIB layout from a JSON file.
- Syntax:
status = obj.loadLayout() status = obj.loadLayout(mode) status = obj.loadLayout(mode, layoutFilename)- Input Arguments:
mode - (optional) char, default:
'localDefault''localDefault'- restore the local default layout fromutils.getPrefDir/mibDefaultLayout.json'custom'- restore a custom layout fromutils.getPrefDir'globalDefault'- restore the bundled default layout fromMIB/assets/defaultLayout.json
layoutFilename - (optional) char with the full path to a JSON layout file generated by the
saveLayoutfunction
- Output Arguments:
status - logical;
trueon success,falseif layout could not be restored
- Important note:
Setting
PanelLayoutmoves the panels but does not update theirRegionproperty and does not firePropertyChanged. After the layout is applied,Regionof each docked panel (matlab.ui.internal.FigurePanelinobj.view.handles.panels, matched to the layout byTag) is set to its side in the loaded layout whenever the two differ. That assignment firesPropertyChanged, solistener_updatePanelPositionof the panel controllers rearranges their grids for the new side.PanelLayoutalso does not restore which panel of a stacked (tabbed) group is on top: the last panel of the group ends up showing. Panels whose layout entry has"showing": truegetShowing = trueafter theRegionsync.Showingis set tofalsefirst: the property is not synced afterPanelLayouteither, and when it still holdstruefrom before, assigningtrueagain does not reach the window.
Example 1 - restore the default layout:
status = obj.loadLayout();Example 2 - restore a custom layout from file:
status = obj.loadLayout('custom', 'c:\temp\mibLayout.json');
- measureLength(type)¶
MEASURELENGTH - Quick measurement tool: open the Measure Tool or interactively measure a.
- Syntax:
obj.measureLength(type)
straight-line or freehand path length on the currently displayed image. Converted from MIB2 @mibController/menuToolsMeasure_Callback.m
- Input Arguments:
type - a string selecting the measurement mode - ‘tool’ - open the full interactive Measure Tool controller - ‘line’ - draw a straight line and report its length - ‘freehand’ - draw a freehand path and report its length
- Output Arguments:
(none)
- static purgeControllers(src, evnt)¶
PURGECONTROLLERS - remove child controller.
- Syntax:
function purgeControllers(obj, src, evnt)
- saveLayout(mode)¶
SAVELAYOUT - Store the current layout of panels to disk.
- Syntax:
outputPath = obj.saveLayout() outputPath = obj.saveLayout(mode)- Input Arguments:
mode - (optional) char, default:
'localDefault''localDefault'- save toutils.getPrefDir/mibDefaultLayout.json'custom'- save toutils.getPrefDirusing a custom name'globalDefault'- overwrite the bundled default inMIB/assets/defaultLayout.json
- Output Arguments:
outputPath - char with the full path to the saved layout JSON file; the file can be restored with
loadLayout
Example - save the current layout as the local default:
outputPath = obj.saveLayout();
- scaleBarCalibration()¶
SCALEBARCALIBRATION - Calibrate pixel size using a scale bar drawn on the image.
- Syntax:
obj.scaleBarCalibration()
Guides the user to draw a line over a known-length scale bar visible in the image, then sets
pixSize.x/y/zandpixSize.unitsof the active dataset so that one pixel corresponds to the measured physical length.Interactive drawing replicates the
controllers.MeasureTool.drawROI()line-draw flow - blockingwait(),cRoi.drawingROIregistration, andMovingROI/ROIMovedlisteners - so the ruler line stays anchored to the image during pan and zoom. No MeasureTool window is opened and nothing is written tocore.Measurements.
- showImage(resizeToMagnification, setOfDatasetsIndex, sImgIn)¶
SHOWIMAGE - Display image in the main image axes.
- Syntax:
obj.showImage() obj.showImage(resizeToMagnification) obj.showImage(resizeToMagnification, setOfDatasetsIndex) obj.showImage(resizeToMagnification, setOfDatasetsIndex, sImgIn)
Main visualization function that renders the RGB image with all layers (image, model, mask, selection, annotations) to the image axes panel.
- Input Arguments:
resizeToMagnification - (optional) logical, default:
truetrue- resize image to current magnificationfalse- display in original 100% resolution
setOfDatasetsIndex - (optional) double, id of the dataset set to display; when empty, uses the currently selected set
sImgIn - (optional) custom 2D RGB image array
[height, width, colors]to display instead of the dataset image
- Output Arguments:
(none)
Example 1 - standard call to redraw the image via event:
notify(obj.mibModel, 'ShowImage');Example 2 - request resize-to-magnification via event:
Options.resizeToMagnification = true; eventdata = core.ToggleEventData(Options); notify(obj, 'ShowImage', eventdata);Example 3 - direct call from MibController:
obj.showImage();
- showSplashScreen(titleText, initText)¶
SHOWSPLASHSCREEN - Show MIB splash screen while loading.
- Syntax:
[hSplashScreen, hSplashAxes, hLabel] = obj.showSplashScreen() [hSplashScreen, hSplashAxes, hLabel] = obj.showSplashScreen(titleText, initText)- Input Arguments:
titleText - char with the window title
initText - char with the initial status text
- Output Arguments:
hSplashScreen - handle to the splash screen
figurehSplashAxes - handle to the
axesused to display the splash imagehLabel - handle to the status text
uicontrol
- startController(controllerName, varargin)¶
STARTCONTROLLER - launch a child controller by class name.
- Syntax:
obj.startController(controllerName) obj.startController(controllerName, [], BatchOpt)
Delegates to utils.startController, which provides the full implementation. Use utils.startController directly when calling from a plugin controller that has no access to MibController.
- Behaviour:
If the child window is already open, it is brought to the front and its widgets are refreshed.
If a BatchOpt struct is supplied (varargin{2}), the child runs in batch mode (no GUI) and returns immediately.
Lifecycle is managed automatically: a CloseEvent listener is wired on the child and calls utils.purgeChildController on close.
- Input Arguments:
controllerName - char - fully-qualified child controller class name, e.g. ‘controllers.ResampleDataset’
varargin{1} - (optional) placeholder argument, pass [] when supplying BatchOpt
varargin{2} - (optional) BatchOpt struct to run in batch mode, or NaN to trigger returnBatchOpt
- Output Arguments:
(none)
Example 1 - open a child controller GUI (interactive):
obj.startController('controllers.ResampleDataset');Example 2 - run a child controller in batch mode (no GUI):
BatchOpt.ResamplingMode = {'Dimensions'}; BatchOpt.DimensionX = '256'; BatchOpt.DimensionY = '256'; obj.startController('controllers.ResampleDataset', [], BatchOpt);Example 3 - same call from a plugin controller without MibController handle:
utils.startController(obj, 'controllers.ResampleDataset', [], BatchOpt);
- updateFrameNumber(BatchOptIn)¶
UPDATEFRAMENUMBER - Change the currently displayed time frame in the active image document.
- Syntax:
obj.updateFrameNumber() obj.updateFrameNumber(BatchOpt)
Wrapper that exposes time-frame navigation to the MIB batch processing system. Validates the requested frame number (clamping it to the valid range) and then delegates to the active MibImageDocument’s frameNumber_Callback, which updates the slider and redraws the image.
- Input Arguments:
BatchOptIn - (optional) structure for batch processing mode; when NaN, returns default options via the “SyncBatch” event
.FrameNumber- [char, default'1'] frame/time number to display as a string; use'0'to jump to the last time point of the dataset
- Output Arguments:
(none)
Example 1 - interactive call (reads from the frame-number widget):
obj.updateFrameNumber();Example 2 - batch call: jump to frame 3:
BatchOpt.FrameNumber = '3'; obj.updateFrameNumber(BatchOpt);Example 3 - batch call: jump to the last frame:
BatchOpt.FrameNumber = '0'; obj.updateFrameNumber(BatchOpt);
- updateGuiWidgets(updatePanels)¶
UPDATEGUIWIDGETS - Update user interface widgets based on the properties of the currently open dataset.
- Syntax:
obj.updateGuiWidgets() obj.updateGuiWidgets(updatePanels)
Refreshes the named subsets of the GUI; when called with no arguments (or an empty cell array) every panel is refreshed. Callers that know which panel changed should pass the relevant name(s) to avoid unnecessary work.
- Input Arguments:
updatePanels - (optional) char or cell array of chars identifying the panel(s) to refresh. Pass
{}or omit to refresh everything. Valid name strings:'ribbonImage'- Image ribbon tab (bit depth, color type)'ribbonModel'- Model ribbon tab (model type radio buttons)'QuickAccessBar'- Orientation buttons, ROI, block-mode toggle'depthSlider'- Z-slice number slider and edit field'timeSlider'- Time-frame slider and edit field'checkboxes'- Show mask / model checkboxes, restrict controls'imView'- Image view panel title'activeDataset'- Dataset buffer buttons in the Datasets panel'dirContentsDataset'- Directory contents file list and filter'panelThresholding'- Black/white threshold sliders'roi'- ROI related items'selectionPanel'- LUT checkbox and colour table'statusBar'- Status bar current-directory field
- Output Arguments:
(none)
Example 1 - refresh ALL panels (e.g. after loading a new dataset):
obj.updateGuiWidgets();Example 2 - refresh only the Model ribbon tab and the checkboxes panel:
obj.updateGuiWidgets({'ribbonModel', 'checkboxes'});Example 3 - trigger a full refresh via the MibModel event bus:
notify(obj.mibModel, 'UpdateGuiWidgets');Example 4 - trigger a selective refresh via the MibModel event bus:
eventdata = core.ToggleEventData({'ribbonModel', 'checkboxes'}); notify(obj.mibModel, 'UpdateGuiWidgets', eventdata);
- updateInterpolationMode(keepCurrent)¶
UPDATEINTERPOLATIONMODE - Function to set the state of the interpolation button in the Selection ribbon.
- Syntax:
obj.updateInterpolationMode() obj.updateInterpolationMode(keepCurrent)
When
keepCurrentis omitted the function works as a standard callback and swaps the interpolation type betweenshapeandline. WhenkeepCurrentistruethe button state is synced to the currently selected type without swapping.- Input Arguments:
keepCurrent - (optional) logical, default:
falsetrue- sync the button icon to the currently selected interpolation type (obj.mibModel.preferences.SegmTools.Interpolation.Type) without swappingfalse- swap the interpolation type
- Output Arguments:
(none)
Example 1 - sync the button icon to the current type (no swap):
obj.mibController.updateInterpolationMode(true);Example 2 - swap the interpolation type:
obj.mibController.updateInterpolationMode();
- updateSliceNumber(BatchOptIn)¶
UPDATESLICENUMBER - Change the currently displayed slice number in the active image document.
- Syntax:
obj.updateSliceNumber() obj.updateSliceNumber(BatchOpt)
Wrapper that exposes slice navigation to the MIB batch processing system. Validates the requested slice number (clamping it to the valid range) and then delegates to the active MibImageDocument’s sliceNumber_Callback, which updates the slider and redraws the image.
- Input Arguments:
BatchOptIn - (optional) structure for batch processing mode; when NaN, returns default options via the “SyncBatch” event
.SliceNumber- [char, default'1'] slice number to display as a string; use'0'to jump to the last slice of the dataset
- Output Arguments:
(none)
Example 1 - interactive call (reads from the slice-number widget):
obj.updateSliceNumber();Example 2 - batch call: jump to slice 5:
BatchOpt.SliceNumber = '5'; obj.updateSliceNumber(BatchOpt);Example 3 - batch call: jump to the last slice:
BatchOpt.SliceNumber = '0'; obj.updateSliceNumber(BatchOpt);
- updateVisualizationMode(mode)¶
UPDATEVISUALIZATIONMODE - Function to set type of image interpolation for the visualization (from Image Ribbon).
- Syntax:
obj.updateVisualizationMode() obj.updateVisualizationMode(mode)
When
modeis omitted the function cycles throughbicubic,nearest, andautomaticinterpolation modes. Whenmodeis specified the provided mode is applied directly.- Input Arguments:
mode - (optional) char, default:
''(cycle/toggle)''or not provided - cycle:bicubic→nearest→automatic'keepcurrent'- sync the button icon to the mode stored inobj.mibModel.preferences.System.ImageResizeMethodwithout changing it'bicubic'- set bicubic interpolation'nearest'- set nearest-neighbor interpolation'auto'- set automatic mode (bicubic for zoom-out, nearest for zoom-in)
- Output Arguments:
(none)
Example 1 - cycle to the next visualization mode:
obj.updateVisualizationMode();Example 2 - sync the button icon without changing the mode:
obj.updateVisualizationMode('keepcurrent');Example 3 - select bicubic interpolation:
obj.updateVisualizationMode('bicubic');