I/O¶
See I/O and format support for the reader
contract, the full format-support table, and exactly what ISMRMRDReader
does and does not handle yet.
Dispatch¶
Read a raw-data file into :class:MRIData, choosing the reader automatically.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
UnsupportedFormatError
|
If no registered reader recognises the file. |
Bases: ABC
Base class for all raw-data readers.
can_read(path)
abstractmethod
¶
Return True if this reader recognises path.
Implementations should be cheap: check the extension and, if needed, sniff a few magic bytes. Do not parse the whole file here.
read(path, **options)
abstractmethod
¶
Parse path and return a validated :class:MRIData.
Implementations must call .validate() on the result and record a
provenance step describing the read.
Register a :class:Reader instance for use by :func:read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reader
|
Reader
|
The reader instance. |
required |
prepend
|
bool
|
If |
False
|
Readers¶
ISMRMRDReader is the only reader with a real read() today (wraps the
ismrmrd package; needs pip install "unimri[ismrmrd]"). HDF5Reader and
TwixReader are registered (so can_read/format-detection works) but their
read() still raises NotImplementedError — see the
roadmap.
Bases: Reader
Read a single Cartesian encoding space from an ISMRMRD file.
Wraps the reference ismrmrd package (pip install "unimri[ismrmrd]").
Scope (Milestone 1, see docs/roadmap.md): exactly one slice / average /
contrast / repetition / set / segment. Multi-dimensional acquisitions and
non-Cartesian ISMRMRD trajectories raise a clear
:class:~unimri.exceptions.ReaderError naming what isn't supported,
rather than silently mishandling the data -- see
docs/io-format-support.md for the full scope. Noise-measurement
acquisitions (ACQ_IS_NOISE_MEASUREMENT) are skipped; pre-whitening is
not yet applied. ISMRMRD's header has no standard nucleus field, so
:attr:~unimri.data.AcquisitionInfo.nucleus stays at its "1H"
default -- set it manually for multinuclear files.
read(path, **options)
¶
Read an ISMRMRD file.