imagesplit.utils.utilities module

Utility files for splitting large images into subimages

Author: Tom Doel Copyright UCL 2017

imagesplit.utils.utilities.compute_bytes_per_voxel(element_type)[source]

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

imagesplit.utils.utilities.convert_to_array(scalar_or_list, parameter_name, num_dims)[source]

Converts a list or scalar to an array

imagesplit.utils.utilities.file_linear_byte_offset(image_size, bytes_per_voxel, start_coords)[source]

Return the file byte offset corresponding to the given coordinates. Files generally assumed to have the first dimension most rapidly changing

Assumes you have a stream of bytes representing a multi-dimensional image,

imagesplit.utils.utilities.get_block_coordinate_range(block_number, block_size, overlap_size, image_size)[source]

Returns the minimum and maximum coordinate values in one dimension for an image block, where the dimension length image_size is to be split into the number of blocks specified by block_size with an overlap of overlap_size voxels at each boundary, and the current block_number is specified. There is no overlap at the outer border of the image, and the length of the final block is reduced if necessary so there is no padding

imagesplit.utils.utilities.get_number_of_blocks(image_size, max_block_size)[source]

Returns a list containing the number of blocks in each dimension required to split the image into blocks that are subject to a maximum size limit

imagesplit.utils.utilities.get_numpy_datatype(element_type, byte_order_msb)[source]

Returns the numpy datatype corresponding to this ElementType

imagesplit.utils.utilities.get_suggested_block_size(image_size, number_of_blocks)[source]

Returns a recommended block size (a list of the number of blocks in each dimension) to allow the specified image_size to be split into the specified number of blocks in each dimension, with each block being roughly equal in size

imagesplit.utils.utilities.ranges_for_max_block_size(image_size, max_block_size, overlap_size)[source]

Returns a list of ranges, where each recommended block size (a list of the number of blocks in each dimension) is set such that no block exceeds the specified maximum size, and the specified image_size is split so that each block is roughly equal in size

imagesplit.utils.utilities.ranges_for_number_of_blocks(image_size, number_of_blocks, overlap_size)[source]

Returns a list of ranges, where each recommended block size (a list of the number of blocks in each dimension) is set to allow the specified image_size to be split into the specified number of blocks in each dimension, with each block being roughly equal in size

imagesplit.utils.utilities.rescale_image(data_type, image_line, rescale_limits)[source]

Rescale image to the limits of this datatype

imagesplit.utils.utilities.to_rgb(image_line)[source]

Convert greyscale array to RGB