File Input/Output#

Sub-package containing reading/writing routines.

DeepMR provides reading and writing routines for common k-space (currently ISMRMRD, GEHC) and image space (DICOM, NIfTI) formats.

Image I/O routines#

deepmr.io.read_image

Read image data from file.

deepmr.io.write_image

Write image to disk.

K-Space I/O routines#

deepmr.io.read_rawdata

Read kspace data from file.

Header I/O routines#

deepmr.io.read_acqheader

Read acquisition header from file.

deepmr.io.write_acqheader

Write acquisition header to file.

Generic I/O routines#

DeepMR also contains generic I/O routines that can be used to write custom I/O functions for other formats. As a general rule, functions should have these signatures:

# Custom reading routines
image, head = read_custom_image(filepath, *args, head=None, **kwargs) # image
data, head = read_custom_rawdata(filepath, *args, head=None, **kwargs) # k-space
head = read_custom_acqheader(filepath, *args, **kwargs) # header

# Custom writing routines
write_custom_image(filepath, image, *args, **kwargs) # image
write_custom_rawdata(filepath, data, *args, **kwargs) # k-space
write_custom_acqheader(filepath, head, *args, **kwargs) # header

deepmr.io.read_matfile

Read matfile as a Python dictionary.

deepmr.io.read_hdf5

Read HDF5 file as a Python dictionary

deepmr.io.write_hdf5

Write a given dictionary to HDF5 file.