ReconContext#
- class pulserver.recon.ReconContext[source]#
Bases:
objectScan context passed to every hook of a plugin.
The maps the series of an exam share are attributes of the context: a hook reads
b0_map,b1_mapandcoil_sensitivitiesfrom it and assigns to them what it measures, and a later series of the exam reads what was assigned, whichever proxy reconstructs it. Each isNoneuntil some series of the exam has measured it.Those three names are the whole vocabulary, so a misspelt one raises instead of being stored where nothing looks for it. A plugin carrying an artifact of its own puts it in
examunder a key it chooses.The calibration helpers keep the state of one stream on the context, empty when the stream starts and not shared with other series.
coil_mapsmaps a slice counter to theCoilSensitivitiesthe stream holds for it,noiseis the prewhitening aPrewhitenapplies andcoil_compressionthe basis aCoilCompressionapplies; the last two areNoneuntil the stream has them. A hook may assign them.The scan context itself does not change once built: assigning to
header,exam,configordeviceraises.- Parameters:
header (Any) – Parsed MRD XML header; offline,
Noneor any header-like object.exam (pulserver.recon.plugin.ExamCache) – Artifact cache shared by the series of the exam, for artifacts the three names do not cover.
config (Any) – Configuration payload the client sent with the stream.
device (str | None) – The GPU the proxy gave this series, as a torch device such as
"cuda:0";Noneon the host, and offline.
Examples
>>> import pulserver.recon as recon >>> context = recon.ReconContext.offline() >>> context.b1_map is None True >>> context.b1_map = [1.0, 0.9] >>> context.b1_map [1.0, 0.9] >>> context.exam[recon.B1_MAP] [1.0, 0.9] >>> context.b1_mpa = [1.0] Traceback (most recent call last): AttributeError: ReconContext has no attribute 'b1_mpa'
Methods
Attributes