spheres
tit.analyzer.spheres ¶
Parsing of spherical ROI specifications.
The GUI collects spheres as "x,y,z,r" rows. Parsing lives here rather than
in the tab so it is exercised without PyQt5, which is absent from the test
environment.
See Also¶
tit.analyzer.analyzer.Analyzer.analyze_sphere : Consumes one parsed sphere.
parse_sphere_row ¶
Parse a single "x,y,z,r" row.
Parameters¶
text : str Comma-separated centre and radius.
Returns¶
tuple of float
(x, y, z, r).
Raises¶
ValueError If text is empty, does not hold exactly four values, holds a non-numeric value, or gives a non-positive radius.
Source code in tit/analyzer/spheres.py
parse_sphere_rows ¶
Parse several "x,y,z,r" rows.
A one-element sequence reproduces single-sphere behaviour exactly, including its error messages -- the row number is only prefixed when there is more than one row, so a single malformed sphere reads the way it always did.
Parameters¶
texts : sequence of str
One "x,y,z,r" string per sphere.
Returns¶
list of tuple of float
One (x, y, z, r) per input row, in order.
Raises¶
ValueError If texts is empty or any row is malformed.