Preferences

class controllers.Preferences

Bases: handle

PREFERENCES - Controller for the preferences dialog - displays MIB3 settings.

Syntax:
obj.startController('Preferences');
Constructor Summary
Preferences(mibModel, varargin)

PREFERENCES - Constructor - create a Preferences controller and open its GUI window.

Syntax:
obj = Preferences(mibModel, mibController)

Creates a Preferences controller instance, initializes the AppDesigner view, loads preferences from the model, positions the window in the center of the main MIB window, updates all GUI widgets, and registers a listener for model updates. The preferences dialog allows users to configure MIB3 settings across multiple panels: User Interface, Colors and Styles, Backup and Undo, External Directories, Keyboard Shortcuts, and Segmentation Tools.

Input Arguments:
  • mibModel - handle to the application MibModel instance

  • varargin{1} - handle to the parent MibController

Output Arguments:
  • obj - handle to the created Preferences controller instance

Example - open the preferences dialog:

obj = Preferences(mibModel, mibController);
Property Summary
duplicateEntries

local copy of MIB preferences

javaAppliedPath
listener

handle to the view / mibPreferencesAppGUI

mibController
mibModel

a handle to mibController class

oldPreferences

a tag of the shown panel

preferences

stored old preferences

renderedPanels

array with duplicate key shortcut entries

shownPanelTag

a cell array with handles to listeners

view

handles to mibModel

Method Summary
ApplyButtonPushedCallback()

APPLYBUTTONPUSHEDCALLBACK - apply preferences to MIB.

Syntax:
status = obj.ApplyButtonPushedCallback()
Output Arguments:
  • status - [numeric] 1 if successful, 0 if failed

Example - apply and validate preferences:

status = obj.ApplyButtonPushedCallback();
BackupAndUndoPanelCallbacks(event)

BACKUPANDUNDOPANELCALLBACKS - callbacks for modification of the Undo and backup panel.

Syntax:
obj.BackupAndUndoPanelCallbacks(event)
Input Arguments:
  • event - [struct] event data from the GUI element that triggered callback

Calculate()

CALCULATE - start main calculation of the plugin.

Syntax:
obj.Calculate()

Example - trigger calculation:

obj.Calculate();
CategoriesTreeSelectionChanged(selectedNodes)

CATEGORIESTREESELECTIONCHANGED - callback for change of nodes of CategoriesTree.

Syntax:
obj.CategoriesTreeSelectionChanged(selectedNodes)
Input Arguments:
  • selectedNodes - [handle] handle to the selected tree node

ColorPanelCallbacks(event)

COLORPANELCALLBACKS - callbacks for modification of the Colors panel.

Syntax:
obj.ColorPanelCallbacks(event)
Input Arguments:
  • event - [struct] event data from the GUI element that triggered callback

ExternalDirPathChange(event)

EXTERNALDIRPATHCHANGE - update of external directories.

Syntax:
obj.ExternalDirPathChange(event)
Input Arguments:
  • event - [struct] event data from the directory path field

Example - validate and update directory path:

obj.ExternalDirPathChange(event);
ExternalDirSelect(event)

EXTERNALDIRSELECT - callback for press of select directory button.

Syntax:
obj.ExternalDirSelect(event)
Input Arguments:
  • event - [struct] event data from the button press

Example - handle directory selection:

obj.ExternalDirSelect(event);
ExternalDirectoriesPanelCallbacks(event)

EXTERNALDIRECTORIESPANELCALLBACKS - callbacks for the External directories panel widgets.

Handles widgets on the External directories panel that are not the path text fields / select buttons (those use ExternalDirPathChange and ExternalDirSelect). Currently the Python execution mode dropdown.

Syntax:
obj.ExternalDirectoriesPanelCallbacks(event)
Input Arguments:
  • event - [struct] event data from the GUI element that triggered callback

InputOutputPanelCallbacks(event)

INPUTOUTPUTPANELCALLBACKS - callbacks for modification of the input / output panel.

Syntax:
obj.InputOutputPanelCallbacks(event)
Input Arguments:
  • event - [struct] event data from the GUI element that triggered callback

JavaConfigureBtnPushed()

JAVACONFIGUREBTNPUSHED - connect MATLAB / MATLAB Runtime to the Java in the Java field.

With an empty field the search dialog (JavaFindBtnPushed) is shown first. The folder is written with utils.JavaSetup.apply (jenv in MATLAB, matlab_jenv of MATLAB Runtime in the standalone) and, on success, also stored in the MIB preferences right away, so it is kept even when the Preferences dialog is then closed with Cancel.

Syntax:
obj.JavaConfigureBtnPushed()
JavaFindBtnPushed()

JAVAFINDBTNPUSHED - search for installed Java and put the chosen folder into the Java field.

Opens utils.JavaSetup.selectJava (list of the Java installations found in the usual folders, Download Java, manual selection). Nothing is written to MATLAB here: that happens with Configure Java… or, for a changed path, on Apply/OK.

Syntax:
obj.JavaFindBtnPushed()
KeyboardShortcutsPanelCallbacks(event)

KEYBOARDSHORTCUTSPANELCALLBACKS - callbacks for modification of the Keyboard shortcuts panel.

Syntax:
obj.KeyboardShortcutsPanelCallbacks(event)
Input Arguments:
  • event - [struct] event data from the GUI element that triggered callback

ModelsColorsTableContextMenuCallbacks(event)

MODELSCOLORSTABLECONTEXTMENUCALLBACKS - callbacks for the context menu of ModelsColorsTable.

Syntax:
obj.ModelsColorsTableContextMenuCallbacks(event)

Paramters: event: a handle to the event structure

OKButtonPushedCallback()

OKBUTTONPUSHEDCALLBACK - apply preferences and close the preferences window.

Syntax:
obj.OKButtonPushedCallback()

Example - confirm and apply preferences:

obj.OKButtonPushedCallback();
RescaleGUIButtonPushed()

RESCALEGUIBUTTONPUSHED - rescale user interface of MIB.

Updates the scalingGUI global from the System preferences. The widgets of the already open AppDesigner windows are not rescaled live - the new scaling is applied to the windows created after the change; MIB has to be restarted to rescale the main window.

Syntax:
obj.RescaleGUIButtonPushed()

Example - rescale the MIB GUI:

obj.RescaleGUIButtonPushed();
SegmentationPanelCallbacks(event)

SEGMENTATIONPANELCALLBACKS - callbacks for modification of the Segmentation tools panel.

Syntax:
obj.SegmentationPanelCallbacks(event)
Input Arguments:
  • event - [struct] event data from the GUI element that triggered callback

TableCellEditCallback(event)

TABLECELLEDITCALLBACK - callback for modification of cells in tables.

Syntax:
obj.TableCellEditCallback(event)

Parameters: event: a handle to the event structure

TableCellSelectionCallback(event)

TABLECELLSELECTIONCALLBACK - callback for selection of a cell in ModelsColorsTable.

Syntax:
obj.TableCellSelectionCallback(event)
Input Arguments:
  • event - [struct] event data from the table cell selection

UserInterfacePanelCallbacks(event)

USERINTERFACEPANELCALLBACKS - callbacks for modification of the User Interface panel.

Syntax:
obj.UserInterfacePanelCallbacks(event)
Input Arguments:
  • event - [struct] event data from the GUI element that triggered callback

static allocateLabelsLayer(dataset)

ALLOCATELABELSLAYER - allocate the 63-material labels layer of a dataset that carries an empty one.

Syntax:
controllers.Preferences.allocateLabelsLayer(dataset)

Called from the Apply and OK handlers when the user switches System.EnableSelection back on. A dataset opened while the preference was off carries an empty labels container - see core.MibDataset.initialize, which skips the allocation to keep a browse-only dataset down to the cost of the image alone - so the layer has to be built from the dataset dimensions here.

initialize is used rather than a bare dataset.labels.data assignment because it also sets exists and the height/width/depth/time/dataClass bookkeeping that core.MibLabels63.setData63 and core.MibImage.clearLayer clip their coordinates against. Assigning data alone leaves those at the class defaults, which silently truncates every later write to the layer.

Input Arguments:
  • dataset - [core.MibDataset] dataset whose labels layer to allocate

bioFormatsLibraryDescription(~, value)

BIOFORMATSLIBRARYDESCRIPTION - one-line description of a BioFormats reader backend.

bioFormatsLibraryItem(~, items, canon)

BIOFORMATSLIBRARYITEM - pick the dropdown item matching a canonical backend name (‘mib’|’matlab’), case-insensitively (the dropdown shows ‘MIB’/’MATLAB’). Falls back to the first item if no match.

checkBm3dFolder(folderName)

CHECKBM3DFOLDER - resolve and validate the folder selected for BM3D.

The BMxD filter (utils.doImageFiltering) calls BM3D 4.x as BM3D(z, sigma, profile). In the downloaded package (bm3d_4.x.x) the MATLAB files sit in its bm3d subfolder, so when the package root is given, that subfolder is returned. Versions 1-3 have an incompatible BM3D(y, z, sigma, profile) syntax and no BM3DProfile.m; for them, and for a folder without BM3D, an alert is shown and empty is returned, so the caller keeps the previous value. The same BM3DProfile.m test decides whether the filter is listed in Image Filters and Batch processing.

Syntax:
folderName = obj.checkBm3dFolder(folderName)
Input Arguments:
  • folderName - [char] folder selected or typed by the user

Output Arguments:
  • folderName - [char] folder with BM3D.m of BM3D 4.x, or '' when it was not found

Example - validate a selected folder:

folderName = obj.checkBm3dFolder('C:\BM3D\bm3d_4.0.3');
% returns 'C:\BM3D\bm3d_4.0.3\bm3d'
closeWindow()

CLOSEWINDOW - closing Preferences window.

Syntax:
obj.closeWindow()

Example - close the preferences window:

obj.closeWindow();
static defaultBrowserExecutable()

DEFAULTBROWSEREXECUTABLE - Path of the default browser, Windows only.

Syntax:
browserPath = controllers.Preferences.defaultBrowserExecutable()

Reads the user’s http handler rather than assuming a browser, so this follows whatever they actually set as default.

Output Arguments:
  • browserPath - [char] full path of the executable, or '' when it cannot be determined; callers must cope with ''

helpBtnCallback()

HELPBTNCALLBACK - Open the docs at the section for the selected category.

Syntax:
obj.helpBtnCallback()

Jumps to the heading matching the category the user is looking at, rather than dropping them at the top of a long page. Prefers the copy shipped with MIB and falls back to the website when this is a source checkout with no built docs/html.

static openInSystemBrowser(url)

OPENINSYSTEMBROWSER - Open a URL in the browser, #section intact.

Syntax:
controllers.Preferences.openInSystemBrowser(url)

Why not simply web(url, ‘-browser’). A file:// URL carrying a #section cannot be opened through the Windows file association: the shell resolves the URL to a path, opens the file and throws the fragment away. Measured with a probe page that printed location.hash - both start "url" and rundll32 url.dll,FileProtocolHandler reported no fragment, which is why the Help button always landed at the top of the page.

Naming the browser executable and passing the URL as its argument keeps the fragment, because the browser parses the URL rather than the shell. Still launched through start so this returns at once; calling the executable directly would block MATLAB until the browser exits, whenever no instance is already running.

Input Arguments:
  • url - [char] fully formed URL, with its fragment if any

static releaseSegmentationLayers(dataset)

RELEASESEGMENTATIONLAYERS - drop the model, mask and selection layers of a dataset.

Syntax:
controllers.Preferences.releaseSegmentationLayers(dataset)

Called from the Apply and OK handlers when the user switches System.EnableSelection off, having confirmed the warning that says the Model and Mask layers will be deleted. The dataset is left in the state core.MibDataset.initialize produces for a browse-only open, so the re-enable path (allocateLabelsLayer) can rebuild from it.

The labels handle is replaced rather than emptied in place, which is what actually deletes a 255+ material model: emptying the existing core.MibLabels would leave maxMaterials at 255, and re-enabling then takes the selection branch, which cannot rebuild a model layer. createModel and convertModel swap these handles the same way.

Input Arguments:
  • dataset - [core.MibDataset] dataset whose segmentation layers to drop

updateColorPalette()

UPDATECOLORPALETTE - generate default colors for the selected palette.

Syntax:
obj.updateColorPalette()

Example - update the color palette:

obj.updateColorPalette();
updateColorsTables(ColorTableTag, options)

UPDATECOLORSTABLES - update color tables: ModelsColorsTable or LUTColorsTable.

Syntax:
obj.updateColorsTables(ColorTableTag, options)
Input Arguments:
  • ColorTableTag - [char] tag of the table: 'ModelsColorsTable' or 'LUTColorsTable'

  • options (optional) - [struct] structure with additional parameters:

    • .updateDataOnly - [logical] update data only without redrawing styles (default: false)

    • .rowId - [integer] index of row to update; when empty, update full table (default: [])

updateKeyShortcut(eventdata)

UPDATEKEYSHORTCUT - callback for change of key shortcuts in the table.

Syntax:
obj.updateKeyShortcut(eventdata)
Input Arguments:
  • eventdata - [struct] event data from the shortcuts table cell edit

Example - update a keyboard shortcut:

obj.updateKeyShortcut(eventdata);
updateWidgets(panelId)

UPDATEWIDGETS - update widgets of this window.

Syntax:
obj.updateWidgets()
obj.updateWidgets(panelId)
Input Arguments:
  • panelId (optional) - [char] tag of panel to update; when missing, all panels are updated

static viewListner_Callback(src, evnt)
zarrLibraryDescription(~, value)

ZARRLIBRARYDESCRIPTION - one-line description of a zarr3 I/O backend.