ClearMap.IO#

This module handels data reading and writing in ClearMap via sources and sinks.

The base class for IO is a Source that automatically detects file type and gathers some basic infomration about the file.

The IO module is the main module organizing all the IO functionailty.

>>> import numpy as np
>>> import ClearMap.IO.IO as io
>>> x = np.random.rand(30,40,50);
>>> s = io.as_source(x);
>>> print(s);
Numpy-Source(30, 40, 50)[float64]|C|

The first tuple is the shape of the array, the next list contains the datype or data structure, the |.| bracket denotes the order of this array, which can be |C| for c-contigous, |F| for Fortran contigous or ‘’ if the array is non-contigous.

File sources contain further information about the location of the files etc.

The FileList source allows to turn a list of files into a sinlge source, e.g. for microscope data in which each imageing plane comes in a separate file.

Supported source types include:

Format

Module

Description

tif

TIF

tif images and stacks

raw / mhd

MHD

raw image files with optional mhd header file

nrrd

NRRD

nearly raw raster data files

csv

CSV

text files as comma separated values

npy

NPY

numpy binary file

gt

GT

graph tool file

file list

FileList

folder, file list or file expression for a list source files

MMP

memory mapped file

SMA

shared memory array

Note

Sources can be sliced as numpy arrays using the Slice module.

Note

All sources can be made virtual, containing only pointers to data in order to use them in parallel processing via the as_virtual function.


Sub-packages and modules#

ClearMap.IO.CSV

Interface to read and write csv files.

ClearMap.IO.FileList

Module to handle sources distributed over a list of files.

ClearMap.IO.FileUtils

This module provides utilities for file management used by various IO modules.

ClearMap.IO.GT

Interface to read and write graph tool files.

ClearMap.IO.IO

IO interface to read files as sources.

ClearMap.IO.MHD

IO interface to mhd / raw files.

ClearMap.IO.MMP

Interface to numpy memmaps

ClearMap.IO.NPY

IO interface to numpy arrays.

ClearMap.IO.NRRD

IO interface to NRRD volumetric image data files.

ClearMap.IO.SMA

Shared memory arrays for parallel processing.

ClearMap.IO.Slice

This module provides basic handling of slicing of sources.

ClearMap.IO.Source

This module provides the base class for data sources and sinks.

ClearMap.IO.TIF

TIF module provides interface to read and write tif image files.

ClearMap.IO.Temporary

Utility functions to create temporary files.

ClearMap.IO.Workspace

The Workspace module keeps track of the data files of a project.

ClearMap.IO.assets_constants

ClearMap.IO.elastix_config

ClearMap.IO.metadata