io.tdf

Functions:

parse_metadata(f, xml_command) Fill the specified HDF5 file with metadata according to the DataExchange initiative.
read_tomo(dataset, index) Extract the tomographic projection at the specified relative index from the HDF5 dataset.
parse_metadata(f, xml_command) Fill the specified HDF5 file with metadata according to the DataExchange initiative.
read_sino(dataset, index) Extract the sinogram at the specified relative index from the HDF5 dataset.
write_tomo(dataset, index, im) Modify the tomographic projection at the specified relative index from the HDF5 dataset with the image passed as input.
write_sino(dataset, index, im) Modify the sinogram at the specified relative index from the HDF5 dataset with the image passed as input.
get_nr_projs(dataset) Get the number of projections of the input dataset.
get_nr_sinos(dataset) Get the number of sinograms (or slices) of the input dataset.
get_det_size(dataset) Get the width of the detector (nr of pixels) of the input dataset.
get_dset_shape(det_size, fov_height, nr_proj) Get the shape of the dataset by arranging the input parameters.
get_dset_chunks(det_size) Get a good chunk combination.
stp_core.io.tdf.get_det_size(dataset)[source]

Get the width of the detector (nr of pixels) of the input dataset.

Parameters:dataset (HDF5 dataset) – HDF5 dataset as returned by the h5py API.
stp_core.io.tdf.get_dset_chunks(det_size)[source]

Get a good chunk combination. This function needs improvement...

Parameters:det_size (int) – Width of the detector.
stp_core.io.tdf.get_dset_shape(det_size, fov_height, nr_proj)[source]

Get the shape of the dataset by arranging the input parameters.

Parameters:
  • det_size (int) – Width of the detector.
  • fov_height (int) – Height of the FOV, i.e. the number of sinograms (or slices) of the dataset.
  • nr_proj (int) – Number of collected projections.
stp_core.io.tdf.get_nr_projs(dataset)[source]

Get the number of projections of the input dataset.

Parameters:dataset (HDF5 dataset) – HDF5 dataset as returned by the h5py API.
stp_core.io.tdf.get_nr_sinos(dataset)[source]

Get the number of sinograms (or slices) of the input dataset.

Parameters:dataset (HDF5 dataset) – HDF5 dataset as returned by the h5py API.
stp_core.io.tdf.parse_metadata(f, xml_command)[source]

Fill the specified HDF5 file with metadata according to the DataExchange initiative. The metadata in input are described in a XML format.

Parameters:
  • f (HDF5 file) – HDF5 file open with h5py API
  • xml_command (string) – Immaginary part of the complex X-ray refraction index.
stp_core.io.tdf.read_sino(dataset, index)[source]

Extract the sinogram at the specified relative index from the HDF5 dataset.

Parameters:
  • dataset (HDF5 dataset) – HDF5 dataset as returned by the h5py API.
  • index (int) – Relative position of the sinogram within the dataset.
stp_core.io.tdf.read_tomo(dataset, index)[source]

Extract the tomographic projection at the specified relative index from the HDF5 dataset.

Parameters:
  • dataset (HDF5 dataset) – HDF5 dataset as returned by the h5py API.
  • index (int) – Relative position of the tomographic projection within the dataset.
stp_core.io.tdf.write_sino(dataset, index, im)[source]

Modify the sinogram at the specified relative index from the HDF5 dataset with the image passed as input.

Parameters:
  • dataset (HDF5 dataset) – HDF5 dataset as returned by the h5py API.
  • index (int) – Relative position of the sinogram within the dataset.
  • im (array_like) – Image data as numpy array.
stp_core.io.tdf.write_tomo(dataset, index, im)[source]

Modify the tomographic projection at the specified relative index from the HDF5 dataset with the image passed as input.

Parameters:
  • dataset (HDF5 dataset) – HDF5 dataset as returned by the h5py API.
  • index (int) – Relative position of the tomographic projection within the dataset.
  • im (array_like) – Image data as numpy array.