DatasetInfo

class controllers.DatasetInfo

Bases: handle

DATASETINFO - Controller for the Dataset Information window.

Displays metadata of the currently active dataset in a tree view. Allows inserting, modifying, deleting, and searching metadata entries. Available via the Info button of the Path panel.

The metadata dictionary is obtained from obj.mibModel.I{id}.image.getMeta() and written back via obj.mibModel.I{id}.image.setMeta(meta). Standard keys (Filename, Height, Width, …) are always present; format-specific keys added by loaders appear under the Extras node.

Usage:
obj.mibController.startController('controllers.DatasetInfo');
Constructor Summary
DatasetInfo(mibModel)

DATASETINFO - Construct the dataset information controller.

Input Arguments:
Property Summary
allTreeNodes

flat cell array of rendered tree nodes for tree navigation

foundNodeIndex

index of the last found entry during search (into metaSearchList)

listener

cell array of listener handles

metaSearchList

flat cell array of all metadata entries for search

mibModel

handle to MibModel

selectedNodeText

key name of the currently selected tree node

view

handle to DatasetInfoGUI (set by core.ChildView)

Method Summary
static ViewListner_Callback2(~, evnt)

VIEWLISTNER_CALLBACK2 - Static guarded listener callback.

addCallbacks()

ADDCALLBACKS - Wire every widget to the central gui_Callbacks dispatcher.

buildCustomMetaPath(~, node)

BUILDCUSTOMMETAPATH - Walk from a customMeta tree node up to the customMeta root, building a substruct path suitable for subsref / subsasgn.

Returns a struct array with type (. or {}) and subs fields, e.g. [.Instrument, {2}, .Laser, {2}] for customMeta.Instrument{2}.Laser{2}.

buildMetaSearchList()

BUILDMETASEARCHLIST - Build a flat searchable list of all metadata entries.

Scans the metadata dictionary directly (not the visible tree) so that every entry is reachable regardless of which sections are currently expanded. The returned list is used by searchEdit_Callback() to drive forward/backward search.

Each element of the returned cell array is a struct with:

  • text - display text exactly as it appears in the tree node

  • sectionKey - NodeData.key of the deferred section node to expand before navigating; '' when already visible

  • sectionPopulationType - NodeData.populationType of that section node

closeWindow()

CLOSEWINDOW - Close the dialog and release listeners.

deleteButton_Callback()

DELETEBUTTON_CALLBACK - Delete the highlighted tree nodes.

Directly removes tree nodes (preserving expand state) and updates the underlying data. After deletion the tree scrolls to the node above the first deleted item.

Handles all node depths:

  • Top-level key - removes the key from the dictionary (standard keys are protected).

  • Struct field (e.g. pixSize.x) - removes the field.

  • Cell element (e.g. SliceName{3}) - removes the element and updates sibling indices.

  • Matrix row (e.g. lutColors row 2) - removes the row and updates sibling indices.

  • customMeta cell (e.g. Instrument (2)) - removes only that cell element, not the whole field.

  • Parent with children - removes the key or its children depending on context.

findSectionNode(sectionKey, sectionPopulationType)

FINDSECTIONNODE - Locate a deferred section node by its NodeData key and populationType in the current allTreeNodes list.

flattenTreeNodes(rootNode)

#ok<INUSL> FLATTENTREENODES - Build a flat cell array of all tree nodes (depth-first). Uses an iterative stack to avoid O(N^2) cell-array concatenation that the recursive version incurs when merging sub-lists.

static formatBlockShape(blockShape, pyramid)

FORMATBLOCKSHAPE - Chunk or shard shape as Y×X×Z text for the pyramid rows.

The level rows print image sizes as width x height, but a block shape is printed Y, X, Z so its depth is visible - that depth is what a single-slice read over-fetches.

Syntax:
pyramid = obj.mibModel.I{id}.image.pyramid;
shapeText = controllers.DatasetInfo.formatBlockShape(pyramid.chunkSizes{1}, pyramid)
% returns '128×128×128' for a 'zyx' store chunked [128 128 128]
Input Arguments:
  • blockShape - [numeric vector] one entry of pyramid.chunkSizes or pyramid.shardSizes, in the store’s own axis order

  • pyramid - [struct] MibImage.pyramid; its axisOrder (e.g. 'zyx', 'tczyx', or 'yxz' for BigData stores written by MIB) maps the shape. Not every pyramid carries the field; when it is missing, empty or not the same length as blockShape, the axes are taken as the trailing axes of 'tczyx', the OME-Zarr order

Output Arguments:
  • shapeText - [char] 'Y×X×Z', or 'Y×X' when the store has no z axis

getSelectedNodeListIndex()

GETSELECTEDNODELISTINDEX - Return the metaSearchList index that corresponds to the currently selected tree node, or 0 if none.

gui_Callbacks(source, event)

#ok<INUSD> GUI_CALLBACKS - Dispatcher for every DatasetInfo widget callback.

Syntax:
obj.gui_Callbacks(source, event)

Routes by source.Tag to the appropriate action method.

Input Arguments:
  • obj - controllers.DatasetInfo instance.

  • source - widget handle that fired the event.

  • event - event data (unused).

insertButton_Callback()

INSERTBUTTON_CALLBACK - Insert a new metadata entry at the depth of the selected node.

  • If a struct field is selected (e.g. pixSize.x), the new entry is added as a field of that struct.

  • If a cell/matrix sub-element is selected, a new element is appended to the parent array.

  • Otherwise a new top-level key is added to the dictionary.

keyPress_Callback(eventdata)

KEYPRESS_CALLBACK - Forward key presses to the main MIB key handler.

modifyButton_Callback()

MODIFYBUTTON_CALLBACK - Modify the selected metadata entry.

navigateToMetaEntry(entry)

NAVIGATETOMETAENTRY - Expand the relevant section and select the tree node that corresponds to a metadata search list entry.

If the entry lives inside a deferred (lazy-loaded) section that still holds a 'Loading...' placeholder, the section is populated first. After expanding, the flat node list is refreshed and the matching node is selected and scrolled to.

removeDictKey(~, inputDict, keyToRemove)

REMOVEDICTKEY - Return a copy of inputDict without keyToRemove.

Portable across MATLAB versions: rebuilds the dictionary instead of relying on remove() which requires R2023b+.

resolveCustomMetaPath(~, customMetaValue, subsPath)

RESOLVECUSTOMMETAPATH - Resolve a tree-derived substruct path against the actual customMeta struct, handling inlined Attributes transparently.

First tries the direct path. If that fails, inserts .Attributes before the last .field segment (covers fields inlined from XML Attributes sub-structs).

searchEdit_Callback(parameter)

SEARCHEDIT_CALLBACK - Search for text across all metadata entries.

Searches the underlying metadata dictionary directly so that entries in collapsed (not yet expanded) sections are found too. When a match is located inside a deferred section, that section is expanded automatically before selecting the tree node.

Input Arguments:
  • parameter - 'new' to start a forward search from the beginning, 'next' to find the next match, 'previous' to find the previous match.

simplifyButton_Callback()

SIMPLIFYBUTTON_CALLBACK - Remove non-standard metadata entries.

treeNodeExpanded_Callback(~, event)

TREENODEEXPANDED_CALLBACK - Populate a deferred tree node on first expand.

Syntax:
tree.NodeExpandedFcn = @obj.treeNodeExpanded_Callback

Fired by uitree.NodeExpandedFcn. When a section was created with a 'Loading...' placeholder child (deferred by updateWidgets()), this callback removes the placeholder and inserts real child nodes from the active dataset metadata. After populating, the node is kept expanded and the flat search index is refreshed.

treeNodeSelected_Callback()

TREENODESELECTED_CALLBACK - Update selectedParameterLabel when a tree node is selected.

updateSiblingIndices(~, deletedNode, deletedIndex)

UPDATESIBLINGINDICES - Decrement numeric subIndex of siblings above the deleted index so that subsequent deletions stay correct.

updateWidgets()

UPDATEWIDGETS - Build the metadata tree skeleton from the active dataset.

Syntax:
obj.updateWidgets()

Builds only the first-level skeleton: scalar leaf nodes are rendered immediately; any section that would contain multiple child nodes (pixSize, SliceName, Colormap, Extras, customMeta, …) gets a single 'Loading…' placeholder child instead. Real children are populated on demand by treeNodeExpanded_Callback() when the user expands a section. This makes every dataset-switch update nearly instantaneous regardless of dataset size.