PyNutil.Section#

class PyNutil.Section(section_number, filename='', image=None, path=None)[source]#

A single section, identified by number and backed by an image.

Either image or path must be provided. When only path is given the image is loaded lazily the first time it is needed by the pipeline.

Parameters:
  • section_number (int) – Numeric identifier that must match a section in the alignment JSON.

  • filename (str) – Display name used in section_filenames. Defaults to path when not set explicitly.

  • image (Optional[ndarray]) – Pre-loaded image array (2-D or 3-D numpy array). Provide this when you have already loaded or generated the image data yourself.

  • path (Optional[str]) – Path to the image file on disk. The image is loaded on demand by the configured segmentation adapter when the section is processed.

get_image(adapter)[source]#

Return the image array, loading from path if not pre-loaded.

Parameters:

adapter – A SegmentationAdapter used to load the file when image is None.

Return type:

ndarray