7.1.1. algotom.io.converter
Module for converting data type:
Convert a list of tif files to a hdf/nxs file.
Extract tif images from a hdf/nxs file.
Functions:
|
Convert a folder of tif files to a hdf/nxs file. |
|
Extract tif images from a hdf/nxs file. |
- algotom.io.converter.convert_tif_to_hdf(input_path, output_path, key_path='entry/data', crop=(0, 0, 0, 0), pattern=None, **options)[source]
Convert a folder of tif files to a hdf/nxs file.
- Parameters
input_path (str) – Folder path to the tif files.
output_path (str) – Path to the hdf/nxs file.
key_path (str, optional) – Key path to the dataset.
crop (tuple of int, optional) – Crop the images from the edges, i.e. crop = (crop_top, crop_bottom, crop_left, crop_right).
pattern (str, optional) – Used to find tif files with names matching the pattern.
options (dict, optional) – Add metadata. E.g options={“entry/angles”: angles, “entry/energy”: 53}.
- Returns
str – Path to the hdf/nxs file.
- algotom.io.converter.extract_tif_from_hdf(input_path, output_path, key_path, index=(0, -1, 1), axis=0, crop=(0, 0, 0, 0), prefix='img')[source]
Extract tif images from a hdf/nxs file.
- Parameters
input_path (str) – Path to the hdf/nxs file.
output_path (str) – Output folder.
key_path (str) – Key path to the dataset in the hdf/nxs file.
index (tuple of int or int.) – Indices of extracted images. A tuple corresponds to (start,stop,step).
axis (int) – Axis which the images are extracted.
crop (tuple of int, optional) – Crop the images from the edges, i.e. crop = (crop_top, crop_bottom, crop_left, crop_right).
prefix (str, optional) – Prefix of names of tif files.
- Returns
str – Folder path to the tif files.