Reconstruction client#
The reconstruction client is the scanner-side program that streams the raw data of each series to the reconstruction proxy and returns the images to the console. It connects to the proxy’s TCP port (Services), sends one series per connection as MRD messages with the message identifiers of Gadgetron’s streaming protocol, and reads what the reconstruction returns on the same connection.
The proxy replaces the encoding counters, flags, encoding spaces and trajectory of the series with those the sequence states (MRD enrichment). Your client therefore sends what the scanner measured, the identifier of the design the series was played from and the reconstruction plugin to run, and leaves the Pulseq structure of the scan to the proxy.
Messages#
A series is sent in this order:
Message |
Identifier |
Content |
|---|---|---|
|
1 or 2 |
The reconstruction plugin: a config file message holding its name, or a config text holding a bare name or the path of its |
|
3 |
The MRD XML header, once |
|
1008 |
One per readout of the sequence chain, in play order |
|
1026 |
Optional, anywhere after the header: physiological waveforms, passed to the reconstruction unchanged |
|
4 |
The end of the series |
The design names no reconstruction, so the proxy refuses a series whose config
names none, or that sends no config, unless it forwards with a
--forward-config. A path ending in .py names the plugin by the file’s stem;
the proxy searches its own --plugins directories for that name, whatever the
path’s directory.
The client then reads until the proxy’s CLOSE: images (IMAGE, 1022), DICOM
datasets (DICOM_WITHNAME, 1018) and texts (TEXT, 5), in the order the
reconstruction produces them. Nothing is returned before the series has ended
whole, with the client’s CLOSE or a last acquisition flagged
LAST_IN_MEASUREMENT: a reconstruction may finish on the last readout, and
what it produces then is held until that end. A text beginning pulserver:
reports a series that failed. A refused series receives that text and a CLOSE
at once; the proxy then discards what the client still sends until it closes
the connection, so the client can finish sending and read the reason.
A client ends a scan the scanner stopped by shutting its side of the connection
for writing without a CLOSE, then reading the reply as usual. The series is
refused and nothing it produced is returned, even when every readout arrived.
Header#
Element |
Requirement |
Use |
|---|---|---|
|
Required |
The scan the design is stored for: the |
|
Required |
The identifier of the design the interpreter plays, from the |
|
Required by the MRD schema |
DICOM |
|
Optional |
The coil count of a reconstruction buffer laid out before its first acquisition |
|
Optional |
The exam; the series of one exam share its exam cache, and a series without one is an exam of its own |
|
Optional |
The position of the field-of-view centre, three millimetres along the logical readout, phase and slice axes separated by spaces; a difference from the offset the design was converted at is applied to the samples as a receive phase. Without it, the converted offset |
|
Optional |
Copied into the DICOM datasets; |
|
A non-negative integer when |
The DICOM series number on a GE system: of the first series the reconstruction returns, and |
|
Optional |
A DICOM attribute of every image (DICOM attributes) |
|
Optional |
Replaced by one encoding space per subsequence, and one more for the navigator readouts of a subsequence that has them. The reconstruction space is the sequence’s matrix size and field of view, one slice deep for a stack of 2D slices; the encoded space of a Cartesian space has the readout widened to the full echo, oversampling included, and its field of view in proportion. The encoding limits are the extremes of the counters the readouts reach, centred on the k-space centre line and partition the sequence defines. A matrix size or field of view the sequence does not define is kept from the client’s encoding at the same index |
|
Optional |
TR, TE, TI and flip angles replaced by those the main sequence, the last of the chain, defines, a parameter it does not state taken over the whole chain; TR and TE it does not define are measured by pypulseqpp’s |
A header that the ISMRMRD schema does not accept, or that names no design the store holds for its scan, is refused before any acquisition is read.
DICOM attributes#
A client states the DICOM attributes the MRD header has no element for as
userParameterString entries named dicom:<attribute>. The DICOM builder
reads them once, with the rest of the header, into the attributes every image
of the series starts from; an entry whose value names a quantity of the image
is filled in for each image instead. An image’s own meta attributes take
precedence over both. <attribute> is one of:
Form |
Example |
Resolved by |
|---|---|---|
A keyword of the DICOM standard |
|
pydicom’s dictionary |
An explicit tag and value representation |
|
Itself; a private group’s creator is one more entry, |
A keyword of a private dictionary |
|
The file |
A value separates multiple values with \ and may name, in braces, a quantity
of the image it is written into; {{ and }} are literal braces:
Name |
Value |
|---|---|
|
The image centre along the plane normal, in mm: the |
|
The image centre’s coordinate on the patient axis the normal lies closest to, in mm, positive towards right, anterior or superior; an oblique plane is located on that axis too |
|
The side |
|
The image’s |
|
Either number plus or minus the integer |
An attribute that resolves to no tag, for want of the dictionary, is logged and
left out. pulserver replay --dicom-dictionary names another dictionary for a
series replayed where the header’s is not.
Acquisitions#
The proxy matches acquisitions to readouts by their position in the stream, so your client sends every readout the sequence chain plays, those of dummy scans, noise scans and navigators included, and no other.
Field |
Client |
Proxy |
|---|---|---|
|
The sample count of the readout’s ADC event |
Checked |
|
The samples, demodulated by each ADC’s frequency and phase offsets |
Multiplied by the phase a field-of-view offset adds to a readout under a moving gradient, by the phase that centres the reconstruction grid (below), and by any phase modulation the sequence file stores |
|
0 on every acquisition, or increasing by one from any start |
Checked |
|
None, or |
Replaced |
|
Any value |
Replaced |
|
Any value |
Replaced, except on a readout whose k-space location does not change |
|
Any value |
Replaced on a readout whose k-space location changes, in 1/m along the sequence’s gradient axes |
|
The prescribed field-of-view centre, in mm from isocentre |
Moved along |
|
The scanner’s values, as MRD defines them |
Passed on unchanged; an image takes them from its reference acquisition |
The reconstruction grid is centred on the field of view: the voxel centres of
an axis of n voxels lie symmetrically about the prescribed centre, at
(i - (n - 1) / 2) voxels from it. An FFT puts the centre on voxel n // 2
instead, half a voxel off along an axis of even n, so each acquisition’s
position is moved by FOV / (2 n) along each such axis of its encoding
space’s matrix, and its samples are given the phase of the same shift of the
field of view. Voxel n // 2 of the reconstruction, which MRD’s position
locates, then lies half a voxel past the prescribed centre, and the content
moves with it.
A series is refused, and its reconstruction stopped, when an acquisition has a
sample count other than its readout’s, when the scan counters skip or repeat
one, when an acquisition before the last is flagged LAST_IN_MEASUREMENT,
when the stream carries more or fewer acquisitions than the chain plays, or
when it ends without a CLOSE or a last acquisition flagged
LAST_IN_MEASUREMENT.
See also#
Services: starting the proxy.
MRD enrichment: MRD enrichment.
Reconstruction session: the messages, workers and forwarding.
Architecture: the design store and the identifier of a design.
ReconProxy: the proxy.