MHD

IO interface to mhd / raw files.

Note

Using the function write_header_from_source() a mhd header for a numpy binary array can be created to enable loading the numpy file into imagej.

header_from_source(source, header=None)[source]

Create a mhd header file for a source file.

Arguments

sourceSource specification

Source file or class to create a mhd header file for.

filenamestr or None

Filename of the mhd file. If None, the source location with extension ‘mhd’ is used.

headerdict or None

Optional additional entries for the header file.

Returns

filenamestr

The filename of the mhd header.

write(filename, source, header=None, **kwargs)[source]

Write data into to raw/mhd file pair

Arguments

filenamestr

The file name of the raw/mhd file.

sourcesource specification

The source to write as mhd/raw file.

Returns

filenamestr

The filename of the mhd file.

write_header(filename, mhd_header)[source]

Write raw header mhd file.

Arguments

filenamestr

Filename of header.

mhd_headerdict

Dictionary of meta data.

Returns

filenamestr

The filename of the mhd header.

write_header_from_source(source, filename=None, header=None)[source]

Create a mhd header file for a source file.

Arguments

sourceSource specification

Source file or class to create a mhd header file for.

filenamestr or None

Filename of the mhd file. If None, the source location with extension ‘mhd’ is used.

headerdict or None

Optional additional entries for the header file.

Returns

filenamestr

The filename of the mhd header.

write_raw(filename, data)[source]

Write the data into a raw format file.

Arguments

filenamestr

The file name as regular expression.

dataarray

The data to write in to a raw file.

Returns

filename: str

The file name of raw file