Application defaults (utils.defaults)¶
- utils.defaults.addToJavaClasspath(classpath, directory)¶
ADDTOJAVACLASSPATH - Add JAR files from a directory to the MATLAB Java classpath.
- Syntax:
addToJavaClasspath(classpath, directory)
Scans
directoryfor*.jarfiles and appends any that are not already inclasspathusingjavaaddpath.- Input Arguments:
classpath - [cell of char] current Java classpath entries (from
javaclasspath)directory - [char] full path to the directory containing JAR files
Usage:
Example 1 - add BioFormats JARs during MIB startup
addToJavaClasspath(javaclasspath, fullfile(mibPath, 'jars'));
- utils.defaults.generateDefaultPalette(paletteName, colorsNo, randomSeed)¶
GENERATEDEFAULTPALETTE - Generate a colour palette by name and number of colours.
- Syntax:
palette = generateDefaultPalette(paletteName, colorsNo) palette = generateDefaultPalette(paletteName, colorsNo, randomSeed) [palette, cancelled] = generateDefaultPalette(paletteName, colorsNo, randomSeed)- Input Arguments:
paletteName - [char] name of the palette to generate; supported values:
'Default, 6 colors''Distinct colors, 20 colors''Qualitative (Monte Carlo->Half Baked), 3-12 colors''Diverging (Merlot->Chardonnay), 3-11 colors''Grayscale'… and others defined in the function body
colorsNo - [numeric] number of required colour channels (default:
6)randomSeed - (optional) seed for the
'Random Colors'palette; when omitted or empty a dialog asking for the seed is displayed. Provide a numeric value for a reproducible palette, or'shuffle'to seed the generator from the system clock without showing the dialog
- Output Arguments:
palette - [numeric] matrix
[colorId, [R G B]]with values in range 0-1; empty when the palette could not be generated, i.e. whencolorsNoexceeds what the named scheme provides, or when the seed dialog was cancelledcancelled - [logical] true only when the user dismissed the random seed dialog. Callers must test this before reporting an empty
paletteas a failure, otherwise a plain cancel is shown as an error
Usage:
Example 1 - generate a 3-colour default palette
palette = utils.defaults.generateDefaultPalette('Default, 6 colors', 3);Example 2 - generate 10 random colours without the seed dialog
palette = utils.defaults.generateDefaultPalette('Random Colors', 10, 'shuffle');
- utils.defaults.generateKeyShortcuts()¶
GENERATEKEYSHORTCUTS - Generate KeyShortcuts structure with default key shortcuts.
- Syntax:
KeyShortcuts = generateKeyShortcuts()- Output Arguments:
KeyShortcuts - structure with default keyboard shortcut bindings used by MIB
Usage:
Example 1 - generate default key shortcuts
KeyShortcuts = utils.defaults.generateKeyShortcuts();
- utils.defaults.generateLUT(noColorChannels)¶
GENERATELUT - Generate default LUT table for color channels.
- Syntax:
lut = generateLUT(noColorChannels)
The first 3 color channels are Red, Green, Blue; others are generated using Hue shifts.
- Input Arguments:
noColorChannels - [numeric] required number of color channels; pass
[]to get 3 colors (Red, Green, Blue)
- Output Arguments:
lut - [numeric] matrix with default LUT for color channels,
lut(colorChannel, [R G B])in range 0-1
Usage:
Example 1 - get the default colour scheme for 5 colour channels
lut = utils.defaults.generateLUT(5);
- utils.defaults.generatePreferences()¶
GENERATEPREFERENCES - Generate the default MIB preferences structure.
- Syntax:
Prefs = generatePreferences()- Output Arguments:
Prefs - struct containing all MIB application preferences
These defaults are also the reference for the JSON override file: its values are coerced back to the class and shape of the default here, see
models.MibModel.initializePreferences(). When adding a setting with a restricted set of values, describe it inpreferenceCommentsofmodels.MibModel.saveOverridePreferences(), which writes the_commententries of that file.Usage:
Example 1 - initialise preferences at startup
obj.mibModel.preferences = utils.defaults.generatePreferences();
- utils.defaults.generateSessionSettings()¶
GENERATESESSIONSETTINGS - Generate the default MIB session settings structure.
- Syntax:
sessionSettings = generateSessionSettings()- Input Arguments:
mibPath - path to MIB installation directory
- Output Arguments:
sessionSettings - struct with default session settings for MIB
Usage:
Example 1 - initialise session settings at startup
obj.mibModel.sessionSettings = utils.defaults.generateSessionSettings();
- utils.defaults.initializePixSize(~)¶
INITIALIZEPIXSIZE - Initialize the pixSize structure with default voxel dimensions.
- Syntax:
pixSize = initializePixSize()
Physical units default to micrometres; temporal units to seconds.
- Output Arguments:
pixSize - struct with default voxel dimensions:
.x- [numeric] pixel width (default:1).y- [numeric] pixel height (default:1).z- [numeric] slice thickness (default:1).units- [char] physical units (default:'um').t- [numeric] time between frames (default:1).tunits- [char] time units (default:'s')
Usage:
Example 1 - create and customise a pixSize struct
pixSize = utils.defaults.initializePixSize(); pixSize.x = 0.065; pixSize.units = 'um';