imagesplit.file.metaio_reader module¶
Utility for reading and writing data to metaio (mhd/mha) files
Author: Tom Doel Copyright UCL 2017
-
class
imagesplit.file.metaio_reader.
MetaIoFile
(local_file_size, header_filename, file_handle_factory, header_template)[source]¶ Bases:
imagesplit.file.image_file_reader.LinearImageFileReader
A class for reading or writing 3D imaging data to/from a MetaIO file pair (.mhd and .raw).
-
classmethod
create_read_file
(subimage_descriptor, file_handle_factory)[source]¶ Create a MetaIoFile class for writing
-
classmethod
create_write_file
(subimage_descriptor, file_handle_factory)[source]¶ Create a MetaIoFile class for this filename and template
-
get_bytes_per_voxel
()[source]¶ Return the number of bytes used to represent a single voxel in this image.
-
get_dimension_ordering
()[source]¶ Return the preferred dimension ordering for writing data.
Returns an array of 3 element, where each element represents a dimension in the global coordinate system numbered from 1 to 3 and is positive if data are to be written in ascending coordinates (in the global system) or negative if to be written in descending global coordinates along that dimension
-
classmethod
-
imagesplit.file.metaio_reader.
anatomical_to_cosine
(anatomical_orientation_char)[source]¶ Get Dicom direction cosine for this orientation string
-
imagesplit.file.metaio_reader.
anatomical_to_permutation
(anatomical_orientation_string)[source]¶ Dimension permutation vector corresponding to this orientation string
-
imagesplit.file.metaio_reader.
condensed_to_cosine
(condensed_format)[source]¶ Get mhd direction cosine for this condensed format axis
-
imagesplit.file.metaio_reader.
dimensions_from_orientations
(orientation_vector_1, orientation_vector_2)[source]¶ Get dimension permutation vectors for these orientation vectors
-
imagesplit.file.metaio_reader.
get_condensed_dim_order
(header)[source]¶ Return the condensed dimension order and flip string for this header
-
imagesplit.file.metaio_reader.
get_default_metadata
()[source]¶ Return an OrderedDict containing default mhd file metadata
-
imagesplit.file.metaio_reader.
get_flip_from_orientations
(orientation_1, orientation_2, orientation_3, dimension_1, dimension_2, dimension_3)[source]¶ Get dimension flip vectors for these orientation vectors
-
imagesplit.file.metaio_reader.
load_mhd_header
(filename)[source]¶ Return an OrderedDict containing metadata loaded from an mhd file.
-
imagesplit.file.metaio_reader.
mhd_cosines_to_permutation
(direction_cosine_1, direction_cosine_2, direction_cosine_3)[source]¶ Get dimension permutation vectors for these mhd direction cosines
-
imagesplit.file.metaio_reader.
parse_mhd
(header)[source]¶ Read a metaheader and returns a FileImageDescriptor
-
imagesplit.file.metaio_reader.
permutation_from_orientations
(orientation_1, orientation_2)[source]¶ Get dimension permutation vectors for these orientation vectors