Transports API Reference
Module imagedata.transports.abstracttransport
Abstract class for image transports.
Defines generic functions.
- class imagedata.transports.abstracttransport.AbstractTransport(name: str, description: str, authors: str, version: str, url: str, schemes: List[str] | None = None)[source]
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: str
Plugin authors
Multi-line string naming the author(s) of the plugin.
- property description: str
Plugin description
Single line string describing the transport method.
- abstract info(path) str [source]
Return info describing the object
- Parameters:
path (str) – object path
- Returns:
Preferably a one-line string describing the object
- Return type:
description (str)
- property name: str
Plugin name
Single word string describing the image format. Typical names: file, dicom, xnat
- abstract open(path: str, mode: str = 'r') IOBase [source]
Extract a member from the archive as a file-like object.
- property schemes: List[str]
List of transport schemes supported by this plugin.
List of strings.
- property url: str
Plugin URL
URL string to the site of the plugin or the author(s).
- property version: str
Plugin version
String giving the plugin version. Version scheme: 1.0.0
Module imagedata.transports.dicomtransport
Transfer DICOM images to and from DICOM Storage SCP
- class imagedata.transports.dicomtransport.DicomTransport(netloc: str | None = None, root: str | None = None, mode: str | None = 'r', read_directory_only: bool | None = False, opts: dict | None = None)[source]
Send DICOM images to DICOM Storage SCP
Module imagedata.transports.filetransport
Read/Write local files
- class imagedata.transports.filetransport.FileTransport(netloc: str | None = None, root: str | None = None, mode: str | None = 'r', read_directory_only: bool | None = False, opts: dict | None = None)[source]
Read/write local files.
- Parameters:
netloc (str) – Not used.
root (str) – Root path.
mode (str) – Filesystem access mode.
read_directory_only (bool) – Whether root should refer to a directory.
opts (dict) – Options
- Returns:
FileTransport instance
- Raises:
RootIsNotDirectory – when the root is not a directory when read_directory_only is True.
FileNotFoundError – Specified root does not exist.
AssertionError – When root is None.
- info(path) str [source]
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)[source]
Check whether path refers to an existing regular file.
- Parameters:
path – Path to file.
- Returns:
Existense of regular file (bool)
Module imagedata.transports.xnattransport
Read/write files in xnat database
- class imagedata.transports.xnattransport.XnatTransport(netloc: str | None = None, root: str | None = None, mode: str | None = 'r', read_directory_only: bool | None = False, opts: dict | None = None)[source]
Read/write files in xnat database.