nabu.pipeline.writer module

class nabu.pipeline.writer.WriterManager(output_dir, file_prefix, file_format='hdf5', overwrite=False, start_index=0, logger=None, metadata=None, histogram=False, extra_options=None)[source]

Bases: object

This class is a wrapper on top of all “writers”. It will create the right “writer” with all the necessary options, and the histogram writer.

The layout is the following.

  • Single-big-file volume formats (big-tiff, .vol):
    • no start index

    • everything is increasingly written in one file

  • Multiple-frames per file (HDF5 + master-file):
    • needs a start index (change file_prefix) for each partial file

    • needs a subdirectory for partial files

  • One-file-per-frame (tiff, edf, jp2)
    • start_index

When saving intermediate steps (eg. sinogram): HDF5 format is always used.

Create a Writer from a set of parameters.

Parameters:
  • output_dir (str) – Directory where the file(s) will be written.

  • file_prefix (str) – File prefix (without leading path)

  • start_index (int, optional) – Index to start the files numbering (filename_0123.ext). Default is 0. Ignored for HDF5 extension.

  • logger (nabu.resources.logger.Logger, optional) – Logger object

  • metadata (dict, optional) – Metadata, eg. information on various processing steps. For HDF5, it will go to “configuration”

  • histogram (bool, optional) – Whether to also write a histogram of data. If set to True, it will configure an additional “writer”.

  • extra_options (dict, optional) – Other advanced options to pass to Writer class.

static get_first_fname(vol_writer)[source]
static get_fname(vol_writer)[source]
write_histogram(data, config=None, processing_index=1)[source]
write_data(data)[source]