convert_to_images#
- class ImageType(value)[source]#
Image conversion types.
- FULL = (False, False, False, False)#
Image with TCZYX dimensions.
- FULL_BINARY = (True, False, False, False)#
Binary image with TCZYX dimensions.
- FULL_BY_FRAME = (False, True, False, False)#
Image with TCZYX dimensions separated by frame.
- FULL_BINARY_BY_FRAME = (True, True, False, False)#
Binary image with TCZYX dimensions separated by frame.
- FLAT_BY_FRAME = (False, True, True, False)#
Image array flattened to YX dimensions separated by frame.
- FLAT_BINARY_BY_FRAME = (True, True, True, False)#
Binary array flattened to YX dimensions separated by frame.
- FLAT_RGBA_BY_FRAME = (False, True, True, True)#
RGBA array flattened to YX dimensions separated by frame .
- convert_to_images(series_key: str, locations_tar: tarfile.TarFile, frame_spec: tuple[int, int, int], regions: list[str], box: tuple[int, int, int], chunk_size: int, image_type: ImageType) list[tuple[int, int, np.ndarray, int | None]] [source]#
Convert data to image arrays.
Images are extracted from lists of voxels. The initial converted image has dimensions in TCZYX order, such that T encodes the specified frames and C encodes the regions. The initial converted image is then further processed based on selected image type.
- Parameters:
series_key – Simulation series key.
locations_tar – Archive of location data.
frame_spec – Specification for image frames.
regions – List of region channels.
box – Size of bounding box.
chunk_size – Size of each image chunk.
image_type – Image conversion type.
- Returns:
List of image chunks, chunk indices, and frames.
- split_array_chunks(array: ndarray, chunk_size: int) list[tuple[int, int, numpy.ndarray]] [source]#
Split arrays into smaller chunks.
- Parameters:
array – Image array (dimensions in TCZYX order).
chunk_size – Size of each image chunk.
- Returns:
List of array chunks and their relative indices.
- flatten_array_chunk(array: ndarray, image_type: ImageType) ndarray [source]#
Flatten array chunk along z axis.
When flattening to an RGBA array, each object is encoded as a unique color such that the object ID = R + G*256 + B*256*256 - 1 and background pixels are black (R = 0, G = 0, B = 0).
- Parameters:
array – Image array (dimensions in TCZYX order).
image_type – Image conversion type.
- Returns:
Flattened image array.