SciFiReaders.readers.microscopy.em.tem.emd_reader.EMDReader#

class SciFiReaders.readers.microscopy.em.tem.emd_reader.EMDReader(file_path: str, sum_frames: bool = False, no_eds: bool = False, eds_stream: bool = False)[source]#

Bases: Reader

Creates an instance of EMDReader which can read one or more HDF5 datasets formatted in the FEI Velox style EDM file

We can read Images, and SpectrumStreams (SpectrumImages and Spectra). Please note that all original metadata are retained in each sidpy dataset.

Parameters:

file_path (str) – Path to a HDF5 file

Returns:

datasets – dictionary of sidpy.Datasets

Return type:

dict

Initialize an EMDReader instance.

Parameters:
  • file_path (str) – Path to the HDF5 (.emd) file to be read.

  • sum_frames (bool, optional) – If True, sum all frames in the dataset. Defaults to False.

  • no_eds (bool, optional) – If True, disables EDS (Energy Dispersive Spectroscopy)

  • False. (data handling. Defaults to)

_h5_file#

The opened HDF5 file object.

Type:

h5py.File

datasets#

Dictionary to store dataset references.

Type:

dict

channel_number#

The current channel number (default is 0).

Type:

int

key#

Formatted string key for the current channel.

Type:

str

data_array#

Array to hold data from the file.

Type:

ndarray or None

metadata#

Metadata extracted from the file.

Type:

dict or None

label_dict#

Dictionary for label mapping.

Type:

dict

no_eds#

Indicates if EDS data handling is disabled.

Type:

bool

sum_frames#

Indicates if frames should be summed.

Type:

bool

number_of_frames#

Number of frames in the dataset (default is 1).

Type:

int

Methods

can_read

Checks whether or not this Reader can read the provided file

close

Close the h5 file.

extract_crucial_metadata

Extract some crucial metadata from the original metadata.

get_data

Get the image data and metadata from the file.

get_eds

Get the EDS data from the file.

get_eds_spectrum

Get the EDS spectrum.

get_image

Get the image data.

read

Reads all available datasets in FEI Velox style hdf5 files with .edm

can_read()[source]#

Checks whether or not this Reader can read the provided file

Returns:

True if this Reader can read the provided file Else, False

Return type:

bool

close()[source]#

Close the h5 file.

extract_crucial_metadata(key)[source]#

Extract some crucial metadata from the original metadata.

get_data(image_key)[source]#

Get the image data and metadata from the file.

get_eds(eds_stream=False)[source]#

Get the EDS data from the file.

get_eds_spectrum() ndarray[source]#

Get the EDS spectrum.

get_image()[source]#

Get the image data.

read(eds_stream: bool = False, bin_xy: int = 2)[source]#

Reads all available datasets in FEI Velox style hdf5 files with .edm

Parameters:
  • eds_stream (boolean) – switch to return spectrum image (default - False) or original spectrum stream (True)

  • bin_xy (int) – binning factor for EDS spectrum size reduction

Returns:

datasets – Datasets present in the provided file

Return type:

list of sidpy.Dataset objects