imagesplit.file.vol_reader module

Utility for reading and writing data to vol files

Author: Tom Doel Copyright UCL 2017

class imagesplit.file.vol_reader.VolFile(local_image_size, header_filename, file_handle_factory)[source]

Bases: imagesplit.file.image_file_reader.LinearImageFileReader

A class for reading or writing 3D imaging data from vge/vol file pair

close()[source]

Close the files associated with this image, if they are not already closed.

close_file()[source]

Close file

static create_read_file(subimage_descriptor, file_handle_factory)[source]

Create a MetaIoFile class for writing

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 load_and_parse_header(filename)[source]

Load vge header file and parse into FileImageDescriptor

read_line(start_coords, num_voxels_to_read)[source]

Read consecutive voxels of image data from the raw binary file starting at the specified coordinates.

write_line(start_coords, image_line, rescale_limits)[source]

Write consecutive voxels to the raw binary file.

imagesplit.file.vol_reader.compute_bytes_per_voxel(file_data_type)[source]

Returns number of bytes required to store one voxel for the given ElementType

imagesplit.file.vol_reader.dim_order_from_header(header)[source]

Return the order in which dimensions are stored in the global system. The first element in the array contains the index of the global dimension which is represented by the first dimension in the file, and so on

imagesplit.file.vol_reader.get_numpy_datatype(element_type, endian)[source]

Returns the numpy datatype corresponding to this ElementType

imagesplit.file.vol_reader.load_vge_header(filename)[source]

Load vge as an ini file

imagesplit.file.vol_reader.parse_vge(header)[source]

Parse vge header file