Skip to content

Commit 400464a

Browse files
authored
Merge pull request #31 from isi-nmr/dev_JV
Optimizations of jcampdx readin, faster file transfer, Support for rawdata, fix EPSI and dtiEPI fids bump version
2 parents ffb375d + de4f0cd commit 400464a

13 files changed

Lines changed: 250 additions & 139 deletions

README.rst

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -164,54 +164,7 @@ Compatible pulse sequences for **fid** data sets:
164164
* STEAM.ppg
165165
* igFLASH.ppg
166166

167-
ParaVision v6.0.1
168-
"""""""""""""""""
169-
Compatible data set types:
170-
171-
* **fid**
172-
* **2dseq**
173-
* **rawdata.job0**
174-
* **rawdata.Navigator**
175-
176-
Compatible pulse sequences for **fid** data sets:
177-
178-
* FLASH.ppg,
179-
* FLASHAngio.ppg
180-
* IgFLASH.ppg
181-
* MGE.ppg
182-
* MSME.ppg
183-
* RARE.ppg
184-
* FAIR_RARE.ppg
185-
* RAREVTR.ppg
186-
* RAREst.ppg
187-
* MDEFT.ppg
188-
* FISP.ppg
189-
* FLOWMAP.ppg
190-
* DtiStandard.ppg
191-
* EPI.ppg
192-
* FAIR_EPI.ppg
193-
* CASL_EPI.ppg
194-
* DtiEpi.ppg
195-
* T1_EPI.ppg
196-
* T2_EPI.ppg
197-
* T2S_EPI.ppg
198-
* SPIRAL.ppg
199-
* DtiSpiral.ppg
200-
* UTE.ppg
201-
* UTE3D.ppg
202-
* ZTE.ppg
203-
* CSI.ppg
204-
* FieldMap.ppg
205-
* SINGLEPULSE.ppg
206-
* NSPECT.ppg
207-
* EPSI.ppg
208-
* PRESS.ppg
209-
* STEAM.ppg
210-
* ISIS.ppg
211-
* CPMG.ppg
212-
* RfProfile.ppg
213-
214-
ParaVision v7.0.0
167+
ParaVision v6.0.1 and v7.0.0
215168
"""""""""""""""""
216169
Compatible data set types:
217170

@@ -259,8 +212,9 @@ Compatible pulse sequences for **fid** data sets:
259212
* RfProfile.ppg
260213

261214

262-
ParaVision v360
215+
ParaVision 360 v1.1 v3.0-v3.7
263216
"""""""""""""""
217+
Reading rawdata is supported only in a basic form, no reshaping into k-space is supported at the moment.
264218
Compatible data set types:
265219

266220
* **2dseq**

brukerapi/config/properties_fid_core.json

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@
223223
["#PULPROG[1:-1]",
224224
[
225225
"EPI.ppg",
226-
"DtiEpi.ppg",
227226
"navigatorEPI_OM.ppg",
228-
"EPSI.ppg",
229227
"FAIR_EPI.ppg",
230228
"CASL_EPI.ppg",
231229
"T1_EPI.ppg",
@@ -236,6 +234,18 @@
236234
"#ACQ_sw_version in ['<PV 5.1>', '<PV 6.0>', '<PV 6.0.1>', '<PV-7.0.0>']"
237235
]
238236
},
237+
{
238+
"cmd": "'dEPI'" ,
239+
"conditions": [
240+
["#PULPROG[1:-1]",
241+
[
242+
"DtiEpi.ppg",
243+
"EPSI.ppg"
244+
]
245+
],
246+
"#ACQ_sw_version in ['<PV 5.1>', '<PV 6.0>', '<PV 6.0.1>', '<PV-7.0.0>']"
247+
]
248+
},
239249
{
240250
"cmd": "'SPECTROSCOPY'" ,
241251
"conditions": [
@@ -322,7 +332,13 @@
322332
]
323333
},
324334
{
325-
"cmd": "#NR",
335+
"cmd": "#NSegments*#NI*#NR*(#ACQ_size[2] if len(#ACQ_size)>2 else 1)",
336+
"conditions": [
337+
"@scheme_id=='dEPI'"
338+
]
339+
},
340+
{
341+
"cmd": "#NR*#NI",
326342
"conditions": [
327343
"@scheme_id=='SPECTROSCOPY'"
328344
]
@@ -430,9 +446,23 @@
430446
"@scheme_id=='EPI'"
431447
]
432448
},
449+
{
450+
"cmd": [
451+
"#PVM_EncMatrix[0] * #PVM_EncMatrix[1] // #NSegments",
452+
"#PVM_EncNReceivers",
453+
"#NSegments",
454+
"#NI",
455+
"#NR",
456+
"#ACQ_size[2] if len(#ACQ_size)>2 else 1"
457+
],
458+
"conditions": [
459+
"@scheme_id=='dEPI'"
460+
]
461+
},
433462
{
434463
"cmd": [
435464
"#ACQ_size.tuple[0] // 2",
465+
"#NI",
436466
"#NR"
437467
],
438468
"conditions": [
@@ -527,11 +557,24 @@
527557
{
528558
"cmd": [0,2,3,4,1],
529559
"conditions": [
530-
"@scheme_id in ['EPI', 'SPIRAL']"
560+
"@scheme_id in ['SPIRAL']"
561+
]
562+
},
563+
{
564+
"cmd": [0,2,3,4,1],
565+
"conditions": [
566+
"@scheme_id in ['EPI']"
567+
]
568+
},
569+
{
570+
"cmd": [0,2,3,4,1,5],
571+
"conditions": [
572+
"@scheme_id in ['dEPI']"
531573
]
532574
},
575+
533576
{
534-
"cmd": [0,1],
577+
"cmd": [0,1,2],
535578
"conditions": [
536579
"@scheme_id=='SPECTROSCOPY'"
537580
]
@@ -604,9 +647,23 @@
604647
"@scheme_id=='EPI'"
605648
]
606649
},
650+
{
651+
"cmd": [
652+
"#PVM_EncMatrix[0]",
653+
"#PVM_EncMatrix[1]",
654+
"#NI",
655+
"#NR",
656+
"#PVM_EncNReceivers",
657+
"#ACQ_size[2] if len(#ACQ_size)>2 else 1"
658+
],
659+
"conditions": [
660+
"@scheme_id=='dEPI'"
661+
]
662+
},
607663
{
608664
"cmd": [
609665
"#ACQ_size.tuple[0] // 2",
666+
"#NI",
610667
"#NR"
611668
],
612669
"conditions": [
@@ -701,7 +758,7 @@
701758
"'channel'"
702759
],
703760
"conditions": [
704-
["@scheme_id",["CART_2D","RADIAL","EPI","SPIRAL","ZTE"]]
761+
["@scheme_id",["CART_2D","RADIAL","EPI","dEPI","SPIRAL","ZTE"]]
705762
]
706763
},
707764
{

brukerapi/config/properties_rawdata_core.json

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,72 @@
55
"conditions": [
66
"#GO_raw_data_format=='GO_32BIT_SGN_INT'",
77
"#BYTORDA=='little'",
8-
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
8+
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
99
]
1010
},
1111
{
1212
"cmd": "np.dtype('int16').newbyteorder('<')",
1313
"conditions": [
1414
"#GO_raw_data_format=='GO_16BIT_SGN_INT'",
1515
"#BYTORDA=='little'",
16-
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
16+
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
1717
]
1818
},
1919
{
2020
"cmd": "np.dtype('float32').newbyteorder('<')",
2121
"conditions": [
2222
"#GO_raw_data_format=='GO_32BIT_FLOAT'",
2323
"#BYTORDA=='little'",
24-
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
24+
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
2525
]
2626
},
2727
{
2828
"cmd": "np.dtype('int32').newbyteorder('>')",
2929
"conditions": [
3030
"#GO_raw_data_format=='GO_32BIT_SGN_INT'",
3131
"#BYTORDA=='big'",
32-
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
32+
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
3333
]
3434
},
3535
{
3636
"cmd": "np.dtype('int16').newbyteorder('>')",
3737
"conditions": [
3838
"#GO_raw_data_format=='GO_16BIT_SGN_INT'",
3939
"#BYTORDA=='big'",
40-
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
40+
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
4141
]
4242
},
4343
{
4444
"cmd": "np.dtype('float32').newbyteorder('>')",
4545
"conditions": [
4646
"#GO_raw_data_format=='GO_32BIT_FLOAT'",
4747
"#BYTORDA=='big'",
48-
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
48+
["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
4949
]
5050
},
5151
{
5252
"cmd": "np.dtype('i4').newbyteorder('<')",
5353
"conditions": [
5454
"#ACQ_word_size=='_32_BIT'",
5555
"#BYTORDA=='little'",
56-
["#ACQ_sw_version",["<PV-360.1.1>"]]
56+
["#ACQ_sw_version",["<PV-360.1.1>","<PV-360.3.0>","<PV-360.3.1>","<PV-360.3.2>","<PV-360.3.3>","<PV-360.3.4>","<PV-360.3.5>","<PV-360.3.6>","<PV-360.3.7>"]]
5757
]
5858
}
5959
],
6060
"job_desc": [
6161
{
6262
"cmd": "#ACQ_jobs.primed_dict(7)['<{}>'.format(@subtype)]",
6363
"conditions": [
64-
"#ACQ_sw_version in ['<PV-360.1.1>']"
64+
["#ACQ_sw_version",["<PV-360.1.1>"]]
6565
]
6666
},
67+
{
68+
"cmd": "[v for v in #ACQ_jobs.nested if v[-1] == '<{}>'.format(@subtype)][0]",
69+
"conditions": [
70+
["#ACQ_sw_version",["<PV-360.3.0>","<PV-360.3.1>","<PV-360.3.2>","<PV-360.3.3>","<PV-360.3.4>","<PV-360.3.5>","<PV-360.3.6>","<PV-360.3.7>"]]
71+
]
72+
},
73+
6774
{
6875
"cmd": "#ACQ_jobs.nested[0]",
6976
"conditions": [
@@ -88,7 +95,7 @@
8895
],
8996
"shape_storage": [
9097
{
91-
"cmd": "(@job_desc[0],) + (@job_desc[3],)",
98+
"cmd": "(@job_desc[0],) + (#PVM_EncNReceivers,) + (@job_desc[3],)",
9299
"conditions": []
93100
}
94101
]
Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,65 @@
1-
{}
1+
{
2+
"subj_id": [
3+
{
4+
"cmd": "#SUBJECT_id[1:-1]",
5+
"conditions": [
6+
7+
]
8+
},
9+
{
10+
"cmd": "''",
11+
"conditions": [
12+
13+
]
14+
}
15+
],
16+
"study_id": [
17+
{
18+
"cmd": "str(#SUBJECT_study_nr)",
19+
"conditions": [
20+
21+
]
22+
},
23+
{
24+
"cmd": "''",
25+
"conditions": [
26+
27+
]
28+
}
29+
],
30+
"exp_id": [
31+
{
32+
"cmd": "@path.parent.name",
33+
"conditions": [
34+
35+
]
36+
},
37+
{
38+
"cmd": "''",
39+
"conditions": [
40+
41+
]
42+
}
43+
],
44+
"id": [
45+
{
46+
"cmd": "f'RawData_{@subtype}_{@exp_id}_{@subj_id}_{@study_id}'",
47+
"conditions": [
48+
]
49+
}
50+
],
51+
"TR": [
52+
{
53+
"cmd": "#PVM_RepetitionTime",
54+
"conditions": [],
55+
"unit": "ms"
56+
}
57+
],
58+
"TE": [
59+
{
60+
"cmd": "#PVM_EchoTime",
61+
"conditions": [],
62+
"unit": "ms"
63+
}
64+
]
65+
}

brukerapi/dataset.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,10 @@ def _read_binary_file(self, path, dtype, shape):
546546
1D ndarray containing the full data vector
547547
"""
548548
# TODO debug with this
549-
# try:
550-
# assert os.stat(str(path)).st_size == np.prod(shape) * dtype.itemsize
551-
# except AssertionError:
552-
# raise ValueError('Dimension missmatch')
549+
try:
550+
assert os.stat(str(path)).st_size == np.prod(shape) * dtype.itemsize
551+
except AssertionError:
552+
raise ValueError("Dimension mismatch") from AssertionError
553553

554554
return np.array(np.memmap(path, dtype=dtype, shape=shape, order="F")[:])
555555

@@ -594,7 +594,7 @@ def write(self, path, **kwargs):
594594

595595
path = Path(path)
596596

597-
if path.name != self.type:
597+
if path.name.split(".")[0] != self.type:
598598
raise DatasetTypeMissmatch
599599

600600
parent = path.parent

brukerapi/folders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def make_tree(self, *, recursive: bool = True) -> list:
217217
children.append(Folder(path, parent=self, recursive=recursive, dataset_index=self._dataset_index, dataset_state=self._dataset_state))
218218
continue
219219

220-
if path.name in self._dataset_index:
220+
if path.name in self._dataset_index or (path.name.partition(".")[0] in self._dataset_index and "rawdata" in path.name):
221221
try:
222222
children.append(Dataset(path, **self._dataset_state))
223223
except (UnsuportedDatasetType, IncompleteDataset, NotADatasetDir):

0 commit comments

Comments
 (0)