@@ -10,11 +10,39 @@ def make_label(label: str, type: str, value: Union[bool, float, int]) -> SimpleN
1010
1111 Parameters
1212 ----------
13- type : str
14- Label type. Must be one of 'SET' or 'INC'.
1513 label : str
16- Must be one of 'SLC', 'SEG', 'REP', 'AVG', 'SET', 'ECO', 'PHS', 'LIN', 'PAR', 'NAV', 'REV', or 'SMS'.
17- value : bool, float or int
14+ Must be one of the following:
15+
16+ - 'SLC' (counter): slice counter (or slab counter for 3D multi-slab sequences).
17+ - 'SEG' (counter): segment counter e.g. for segmented FLASH or EPI.
18+ - 'REP' (counter): repetition counter.
19+ - 'AVG' (counter): averaging counter.
20+ - 'SET' (counter): flexible counter without firm assignment.
21+ - 'ECO' (counter): echo counter in multi-echo sequences.
22+ - 'PHS' (counter): cardiac phase counter.
23+ - 'LIN' (counter): line counter in 2D and 3D acquisitions.
24+ - 'PAR' (counter): partition counter; itt counts phase encoding steps in the 2nd (through-slab) phase encoding direction in 3D sequences.
25+ - 'ACQ' (counter): spectroscopic acquisition counter.
26+ - 'NAV' (flag): navigator data flag.
27+ - 'REV' (flag): flag indicating that the readout direction is reversed.
28+ - 'SMS' (flag): simultaneous multi-slice (SMS) acquisition.
29+ _ 'REF' (flag): parallel imaging flag indicating reference / auto-calibration data.
30+ - 'IMA' (flag): parallel imaging flag indicating imaging data within the ACS region.
31+ - 'NOISE' (flag): noise adjust scan, for iPAT acceleration.
32+ - 'PMC' (flag): for MoCo/PMC Pulseq version to recognize blocks that can be prospectively corrected for motion.
33+ - 'NOROT' (flag): instruct the interpreter to ignore the rotation of the FOV specified on the UI.
34+ - 'NOPOS' (flag): instruct the interpreter to ignore the position of the FOV specified on the UI.
35+ - 'NOSCL' (flag): instruct the interpreter to ignore the scaling of the FOV specified on the UI.
36+ - 'ONCE' (flag): a 3-state flag that instructs the interpreter as follows:
37+
38+ * `ONCE == 0` blocks are executed on every repetition;
39+ * `ONCE == 1`: only the first repetition of the block is executed;
40+ * `ONCE == 2`: only the last repetition of the block is executed.
41+
42+ -'TRID' (counter): marks the beginning of a repeatable module in the sequence (e.g. TR).
43+
44+ Label type. Must be one of 'SET' or 'INC' (not compatible with flags).
45+ value : bool, float or int
1846 Label value.
1947
2048 Returns
@@ -25,18 +53,15 @@ def make_label(label: str, type: str, value: Union[bool, float, int]) -> SimpleN
2553 Raises
2654 ------
2755 ValueError
28- If a valid `label` was not passed. Must be one of 'SLC', 'SEG', 'REP', 'AVG', 'SET', 'ECO', 'PHS', 'LIN', 'PAR',
29- NAV', 'REV', or 'SMS'.
56+ If a valid `label` was not passed. Must be one of 'pypulseq.get_supported_labels()'.
3057 If a valid `type` was not passed. Must be one of 'SET' or 'INC'.
3158 If `value` was not a valid numerical or logical value.
3259 """
3360 arr_supported_labels = get_supported_labels ()
61+ arr_flags = arr_supported_labels [10 :- 1 ]
3462
3563 if label not in arr_supported_labels :
36- raise ValueError (
37- "Invalid label. Must be one of 'SLC', 'SEG', 'REP', 'AVG', 'SET', 'ECO', 'PHS', 'LIN', 'PAR', "
38- "NAV', 'REV', or 'SMS'."
39- )
64+ raise ValueError (f'Invalid label. Must be one of { arr_supported_labels } .' )
4065 if type not in ['SET' , 'INC' ]:
4166 raise ValueError ("Invalid type. Must be one of 'SET' or 'INC'." )
4267 if not isinstance (value , (bool , float , int )):
@@ -46,6 +71,8 @@ def make_label(label: str, type: str, value: Union[bool, float, int]) -> SimpleN
4671 if type == 'SET' :
4772 out .type = 'labelset'
4873 elif type == 'INC' :
74+ if label in arr_flags :
75+ raise ValueError (f'As per Pulseq specification, labelinc is not compatible with flags: { arr_flags } .' )
4976 out .type = 'labelinc'
5077
5178 out .label = label
0 commit comments