src.imagedata package

Subpackages

Submodules

src.imagedata.axis module

src.imagedata.cmdline module

src.imagedata.collections module

src.imagedata.header module

src.imagedata.image_data module

src.imagedata.list_plugins module

src.imagedata.readdata module

Read/Write image files, calling appropriate transport, archive and format plugins

exception src.imagedata.readdata.NoArchiveError[source]

Bases: Exception

exception src.imagedata.readdata.NoTransportError[source]

Bases: Exception

exception src.imagedata.readdata.UnknownOptionType[source]

Bases: Exception

src.imagedata.readdata.read(urls, order=None, opts=None, input_format=None)[source]

Read image data, calling appropriate transport, archive and format plugins

Parameters:
  • urls – list of urls or url to read (list of str, or str)

  • order – determine how to sort the images (default: auto-detect)

  • opts – input options (argparse.Namespace or dict)

  • input_format – specify a particular input format (default: auto-detect)

Returns:

tuple of
  • hdr: header instance

  • si[tag,slice,rows,columns]: numpy array

Raises:
  • ValueError – When no sources are given.

  • UnknownOptionType – When opts cannot be made into a dict.

  • FileNotFoundError – When specified URL cannot be opened.

  • UnknownInputError – When the input format could not be determined.

  • CannotSort – When input data cannot be sorted.

src.imagedata.readdata.sorted_plugins_dicom_first(plugins, input_format)[source]

Sort plugins such that any Nifti plugin is used early.

src.imagedata.readdata.str_to_dtype(s)[source]

Convert dtype string to numpy dtype.

src.imagedata.readdata.write(si, url, opts=None, formats=None)[source]

Write image data, calling appropriate format plugins

Parameters:
  • si[tag – Series array

  • slice – Series array

  • rows – Series array

  • columns] – Series array

  • url – output destination url

  • opts – Output options (argparse.Namespace or dict)

  • formats – list of output formats, overriding opts.output_format (list or str)

Raises:
  • UnknownOptionType – When opts cannot be made into a dict.

  • TypeError – List of output format is not list().

  • ValueError – Wrong number of destinations given, or no way to write multidimensional image.

  • imagedata.formats.WriteNotImplemented – Cannot write this image format.

src.imagedata.series module

src.imagedata.viewer module

Module contents