AmiraMeshLoader

class io.loaders.AmiraMeshLoader

Bases: io.loaders.BaseImageLoader

AMIRAMESHLOADER - Loader for Amira Mesh (.am) files, based on io.loaders.BaseImageLoader base class.

This loader implements the legacy Amira Mesh reader from getImageMetadata.m and getImages.m as a standalone loader class.

It uses the existing helper functions: - getAmiraMeshHeader.m - amiraMesh2bitmap.m - ib_amiraImportGui.m (optional, used for custom binning / section selection)

Constructor Summary
AmiraMeshLoader(options)

AMIRAMESHLOADER - Constructor for AmiraMeshLoader class.

Syntax:
loader = io.loaders.AmiraMeshLoader(options)
Input Arguments:
  • options - (optional) struct with fields:

    • waitbar - [logical] show or not the waitbar; default: false

    • mibPath - [char] path to MIB directory

    • customSections - [logical] load custom sections only; default: false

    • customSectionsSettings - [struct] custom section parameters

    • imgStretch - [logical] stretch uint32 images to uint16; default: false

    • silentMode - [logical] do not ask user questions; default: false

    • verbose - [logical] show timing information; default: false

    • Font - [struct] font settings for dialogs

    • ParentFigure - handle of the main MIB window (parent for uiprogressdlg)

Output Arguments:
  • obj - instance of the AmiraMeshLoader class

Example 1 - create loader with default options:

loader = io.loaders.AmiraMeshLoader();
Method Summary
loadImages(files, imginfo, options)

LOADIMAGES - Load image data from Amira Mesh files.

Syntax:
[img, imginfo] = obj.loadImages(files, imginfo, options)

This method calls amiraMesh2bitmap() and stores the returned data into the MIB image array.

Input Arguments:
  • files - structure array from loadMetadata

  • imginfo - dictionary with image metadata containing fields:

    • Height - image height in pixels

    • Width - image width in pixels

    • Colors - number of color channels

    • Depth - number of z-slices

    • Time - number of time points

    • imgClass - image class (uint8, uint16, etc.)

    • ColorType - 'grayscale', 'truecolor', or 'indexed'

    • ImageDescription - description with BoundingBox info

    • Format - HDF5 format type ('matlab.hdf5' or 'bdv.hdf5')

    • Levels - number of pyramid levels (for BDV only)

    • ReturnedLevel - selected pyramid level (for BDV only)

    • pixSize - struct with pixel sizes: .x, .y, .z, .t, .units, .tunits

    • other format-specific metadata fields

  • options - (optional) struct for image loading

Output Arguments:
  • img - loaded image dataset

  • imginfo - updated dictionary

Example 1 - load images from Amira Mesh file:

loader = io.loaders.AmiraMeshLoader();
[imginfo, files] = loader.loadMetadata({'dataset.am'}, options);
[img, imginfo] = loader.loadImages(files, imginfo, options);
loadMetadata(filenames, options)

LOADMETADATA - Load metadata for Amira Mesh files.

Syntax:
[imginfo, files] = obj.loadMetadata(filenames, options)

This method reads the Amira Mesh header and populates: - files structure array (dimensions, class, binning options) - imginfo dictionary (format metadata) - pixSize structure (voxel sizes)

Input Arguments:
  • filenames - cell array with filenames of Amira Mesh files

  • options - (optional) struct with fields:

    • waitbar - [logical] show or not the waitbar; default: false

    • customSections - [logical] load part of the dataset; default: false

    • Font - [struct] font settings for dialogs

    • ParentFigure - parent figure handle for uiprogressdlg

Output Arguments:
  • imginfo - dictionary with image metadata, including pixSize structure

  • files - structure array with file information

Example 1 - load metadata from Amira Mesh file:

loader = io.loaders.AmiraMeshLoader();
filenames = {'dataset.am'};
[imginfo, files] = loader.loadMetadata(filenames, options);