Transports API Reference — imagedata 1.3.6 documentation

# Transports API Reference

## Module imagedata.transports.abstracttransport

Abstract class for image transports.

Defines generic functions.

class `imagedata.transports.abstracttransport.` `AbstractTransport`(name, description, authors, version, url, schemes)

  Abstract base class definition for imagedata transport plugins. Plugins must be a subclass of AbstractPlugin and must define the attributes set in __init__() and the following methods:

  open() method isfile() method walk() method

  property `authors`

    Plugin authors

    Multi-line string naming the author(s) of the plugin.

  abstract `close`()

    Close the transport

  property `description`

    Plugin description

    Single line string describing the transport method.

  abstract `info`(path) → str

    Return info describing the object

    Parameters

      path (str) – object path

    Returns

      Preferably a one-line string describing the object

    Return type

      description (str)

  abstract `isfile`(path)

    Return True if path is an existing regular file.

  property `name`

    Plugin name

    Single word string describing the image format. Typical names: file, dicom, xnat

  abstract `open`(path, mode='r')

    Extract a member from the archive as a file-like object.

  property `schemes`

    List of transport schemes supported by self plugin.

    List of strings.

  property `url`

    Plugin URL

    URL string to the site of the plugin or the author(s).

  property `version`

    Plugin version

    String giving the plugin version. Version scheme: 1.0.0

  abstract `walk`(top)

    Generate the file names in a directory tree by walking the tree. Input: - top: starting point for walk (str) Return: - tuples of (root, dirs, files)

exception `imagedata.transports.abstracttransport.` `NoOtherInstance`

## Module imagedata.transports.dicomtransport

Transfer DICOM images to and from DICOM Storage SCP

exception `imagedata.transports.dicomtransport.` `AssociationFailed`

exception `imagedata.transports.dicomtransport.` `AssociationNotEstablished`

class `imagedata.transports.dicomtransport.` `DicomTransport`(netloc=None, root=None, mode='r', read_directory_only=False, opts=None)

  Send DICOM images to DICOM Storage SCP

  `close`()

    Close the DICOM association transport

  `info`(path) → str

    Return info describing the object

    Parameters

      path (str) – object path

    Returns

      Preferably a one-line string describing the object

    Return type

      description (str)

  `isfile`(path)

    Return True if path is an existing regular file.

  `open`(path, mode='r')

    Extract a member from the archive as a file-like object.

  `store`(ds)

    Store DICOM dataset using DICOM Storage SCU protocol.

  `walk`(top)

    Generate the file names in a directory tree by walking the tree. Input: - top: starting point for walk (str) Return: - tuples of (root, dirs, files)

## Module imagedata.transports.filetransport

Read/Write local image files

class `imagedata.transports.filetransport.` `FileTransport`(netloc=None, root=None, mode='r', read_directory_only=False, opts=None)

  Read/write local files.

  `close`()

    Close the transport

  `info`(path) → str

    Return info describing the object

    Parameters

      path (str) – object path

    Returns

      Preferably a one-line string describing the object

    Return type

      description (str)

  `isfile`(path)

    Return True if path is an existing regular file.

  `open`(path, mode='r')

    Extract a member from the archive as a file-like object.

  `walk`(top)

    Generate the file names in a directory tree by walking the tree. Input: - top: starting point for walk (str) Return: - tuples of (root, dirs, files)

## Module imagedata.transports.xnattransport

Read/write files in xnat database

class `imagedata.transports.xnattransport.` `XnatTransport`(netloc=None, root=None, mode='r', read_directory_only=False, opts=None)

  Read/write files in xnat database.

  `close`()

    Close the transport

  `info`(path) → str

    Return info describing the object

    Parameters

      path (str) – object path

    Returns

      Preferably a one-line string describing the object

    Return type

      description (str)

  `isfile`(path)

    Return True if path is an existing regular file.

  `open`(path, mode='r')

    Extract a member from the archive as a file-like object.

  `walk`(top)

    Generate the file names in a directory tree by walking the tree. Input: - top: starting point for walk (str) Return: - tuples of (root, dirs, files)