5. Input/Output (processor.utilities.io)
- processor.utilities.io.array_to_tiff(array, filename)[source]
Save array to imageJ compatible tiff stack.
- Args:
array (np.array): array to save. 2D,3D or 4D filename (str): full path and name of file to save.
- processor.utilities.io.res_to_xarray(res, binNames, binAxes, metadata=None)[source]
creates a BinnedArray (xarray subclass) out of the given np.array
- Parameters:
- res: np.array
nd array of binned data
binNames (list): list of names of the binned axes binAxes (list): list of np.arrays with the values of the axes
- Returns:
- ba: BinnedArray (xarray)
an xarray-like container with binned data, axis, and all available metadata
- processor.utilities.io.save_binned(data, file_name, format='h5', path=None, mode='w')[source]
Save a binned numpy array to h5 file. The file includes the axes (taken from the scheduled bins) and the delay stage histogram, if it exists.
- Parameters:
- file_name: str
Name of the saved file. The extension ‘.h5’ is automatically added.
- path: str | None
File path.
- mode: str | ‘w’
Write mode of h5 file (‘w’ = write).
- processor.utilities.io.to_tiff(data, filename, axis_dict=None)[source]
save array to imagej tiff sack.
- processor.utilities.io.xarray_to_h5(data, faddr, mode='w')[source]
Save xarray formatted data to hdf5
- Args:
data (xarray.DataArray): input data faddr (str): complete file name (including path) mode (str): hdf5 read/write mode
Returns:
- processor.utilities.io.xarray_to_tiff(data, filename, axis_dict=None)[source]
Save data to tiff file.
- Args:
- data: xarray.DataArray
data to be saved. ImageJ likes tiff files with axis order as TZCYXS. Therefore, best axis order in input should be: Time, Energy, posY, posX. The channels ‘C’ and ‘S’ are automatically added and can be ignored.
- filename: str
full path and name of file to save.
- axis_dict: dict
name pairs for correct axis ordering. Keys should be any of T,Z,C,Y,X,S. The Corresponding value will be searched among the dimensions of the xarray, and placed in the right order for imagej stacks metadata.
- units: bool
Not implemented. Will be used to set units in the tif stack TODO: expand imagej metadata to include physical units