Skip to content

Commit 4c2bca7

Browse files
authored
Merge pull request #561 from rmarkello/brikhead
NF: Functionality for reading AFNI BRIK/HEAD
2 parents 636d5d2 + c5f0ecf commit 4c2bca7

10 files changed

+1310
-5
lines changed

nibabel/brikhead.py

Lines changed: 627 additions & 0 deletions
Large diffs are not rendered by default.

nibabel/imageclasses.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
''' Define supported image classes and names '''
1010

1111
from .analyze import AnalyzeImage
12+
from .brikhead import AFNIImage
1213
from .cifti2 import Cifti2Image
1314
from .freesurfer import MGHImage
1415
from .gifti import GiftiImage
@@ -31,7 +32,7 @@
3132
Cifti2Image, Nifti2Image, # Cifti2 before Nifti2
3233
Spm2AnalyzeImage, Spm99AnalyzeImage, AnalyzeImage,
3334
Minc1Image, Minc2Image, MGHImage,
34-
PARRECImage, GiftiImage]
35+
PARRECImage, GiftiImage, AFNIImage]
3536

3637

3738
# DEPRECATED: mapping of names to classes and class functionality
@@ -88,7 +89,12 @@ def __getitem__(self, *args, **kwargs):
8889
'ext': '.par',
8990
'has_affine': True,
9091
'makeable': False,
91-
'rw': False})
92+
'rw': False},
93+
afni={'class': AFNIImage,
94+
'ext': '.brik',
95+
'has_affine': True,
96+
'makeable': False,
97+
'rw': False})
9298

9399

94100
class ExtMapRecoder(Recoder):
@@ -107,14 +113,15 @@ def __getitem__(self, *args, **kwargs):
107113
('mgh', '.mgh'),
108114
('mgz', '.mgz'),
109115
('par', '.par'),
116+
('brik', '.brik')
110117
))
111118

112119
# Image classes known to require spatial axes to be first in index ordering.
113120
# When adding an image class, consider whether the new class should be listed
114121
# here.
115122
KNOWN_SPATIAL_FIRST = (Nifti1Pair, Nifti1Image, Nifti2Pair, Nifti2Image,
116123
Spm2AnalyzeImage, Spm99AnalyzeImage, AnalyzeImage,
117-
MGHImage, PARRECImage)
124+
MGHImage, PARRECImage, AFNIImage)
118125

119126

120127
def spatial_axes_first(img):
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
2+
type = string-attribute
3+
name = DATASET_NAME
4+
count = 5
5+
'none~
6+
7+
type = string-attribute
8+
name = TYPESTRING
9+
count = 15
10+
'3DIM_HEAD_ANAT~
11+
12+
type = string-attribute
13+
name = IDCODE_STRING
14+
count = 27
15+
'AFN_-zxZ0OyZs8eEtm9syGBNdA~
16+
17+
type = string-attribute
18+
name = IDCODE_DATE
19+
count = 25
20+
'Sun Oct 1 21:13:09 2017~
21+
22+
type = integer-attribute
23+
name = SCENE_DATA
24+
count = 8
25+
0 2 0 -999 -999
26+
-999 -999 -999
27+
28+
type = string-attribute
29+
name = LABEL_1
30+
count = 5
31+
'none~
32+
33+
type = string-attribute
34+
name = LABEL_2
35+
count = 5
36+
'none~
37+
38+
type = integer-attribute
39+
name = ORIENT_SPECIFIC
40+
count = 3
41+
0 3 4
42+
43+
type = float-attribute
44+
name = ORIGIN
45+
count = 3
46+
-49.5 -82.312 -52.3511
47+
48+
type = float-attribute
49+
name = DELTA
50+
count = 3
51+
3 3 3
52+
53+
type = float-attribute
54+
name = IJK_TO_DICOM
55+
count = 12
56+
3 0 0 -49.5 0
57+
3 0 -82.312 0 0
58+
3 -52.3511
59+
60+
type = float-attribute
61+
name = IJK_TO_DICOM_REAL
62+
count = 12
63+
3 0 0 -49.5 0
64+
3 0 -82.312 0 0
65+
3 -52.3511
66+
67+
type = float-attribute
68+
name = BRICK_STATS
69+
count = 6
70+
0 13722 0 10051 0
71+
9968
72+
73+
type = integer-attribute
74+
name = TAXIS_NUMS
75+
count = 8
76+
3 25 77002 -999 -999
77+
-999 -999 -999
78+
79+
type = float-attribute
80+
name = TAXIS_FLOATS
81+
count = 8
82+
0 3 0 -52.3511 3
83+
-999999 -999999 -999999
84+
85+
type = float-attribute
86+
name = TAXIS_OFFSETS
87+
count = 25
88+
0.3260869 1.826087 0.3913043 1.891304 0.4565217
89+
1.956521 0.5217391 2.021739 0.5869564 2.086956
90+
0.6521738 2.152174 0.7173912 2.217391 0.7826086
91+
2.282609 0.8478259 2.347826 0.9130433 2.413044
92+
0.9782607 2.478261 1.043478 2.543479 1.108696
93+
94+
type = integer-attribute
95+
name = DATASET_RANK
96+
count = 8
97+
3 3 0 0 0
98+
0 0 0
99+
100+
type = integer-attribute
101+
name = DATASET_DIMENSIONS
102+
count = 5
103+
33 41 25 0 0
104+
105+
type = integer-attribute
106+
name = BRICK_TYPES
107+
count = 3
108+
1 1 1
109+
110+
type = float-attribute
111+
name = BRICK_FLOAT_FACS
112+
count = 3
113+
0 0 0
114+
115+
type = string-attribute
116+
name = TEMPLATE_SPACE
117+
count = 5
118+
'ORIG~
119+
120+
type = integer-attribute
121+
name = INT_CMAP
122+
count = 1
123+
0
124+
125+
type = integer-attribute
126+
name = BYTEORDER_STRING
127+
count = 10
128+
'LSB_FIRST~
129+
130+
type = string-attribute
131+
name = BRICK_LABS
132+
count = 9
133+
'#0~#1~#2~
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
2+
type = string-attribute
3+
name = DATASET_NAME
4+
count = 5
5+
'none~
6+
7+
type = string-attribute
8+
name = TYPESTRING
9+
count = 15
10+
'3DIM_HEAD_ANAT~
11+
12+
type = string-attribute
13+
name = IDCODE_STRING
14+
count = 27
15+
'AFN_-zxZ0OyZs8eEtm9syGBNdA~
16+
17+
type = string-attribute
18+
name = IDCODE_DATE
19+
count = 25
20+
'Sun Oct 1 21:13:09 2017~
21+
22+
type = integer-attribute
23+
name = SCENE_DATA
24+
count = 8
25+
0 2 0 -999 -999
26+
-999 -999 -999
27+
28+
type = string-attribute
29+
name = LABEL_1
30+
count = 5
31+
'none~
32+
33+
type = string-attribute
34+
name = LABEL_2
35+
count = 5
36+
'none~
37+
38+
type = integer-attribute
39+
name = ORIENT_SPECIFIC
40+
count = 3
41+
0 3 4
42+
43+
type = float-attribute
44+
name = ORIGIN
45+
count = 3
46+
-49.5 -82.312 -52.3511
47+
48+
type = float-attribute
49+
name = DELTA
50+
count = 3
51+
3 3 3
52+
53+
type = float-attribute
54+
name = IJK_TO_DICOM
55+
count = 12
56+
3 0 0 -49.5 0
57+
3 0 -82.312 0 0
58+
3 -52.3511
59+
60+
type = float-attribute
61+
name = IJK_TO_DICOM_REAL
62+
count = 12
63+
3 0 0 -49.5 0
64+
3 0 -82.312 0 0
65+
3 -52.3511
66+
67+
type = float-attribute
68+
name = BRICK_STATS
69+
count = 6
70+
0 13722 0 10051 0
71+
9968
72+
73+
type = integer-attribute
74+
name = TAXIS_NUMS
75+
count = 8
76+
3 25 77002 -999 -999
77+
-999 -999 -999
78+
79+
type = float-attribute
80+
name = TAXIS_FLOATS
81+
count = 8
82+
0 3 0 -52.3511 3
83+
-999999 -999999 -999999
84+
85+
type = float-attribute
86+
name = TAXIS_OFFSETS
87+
count = 25
88+
0.3260869 1.826087 0.3913043 1.891304 0.4565217
89+
1.956521 0.5217391 2.021739 0.5869564 2.086956
90+
0.6521738 2.152174 0.7173912 2.217391 0.7826086
91+
2.282609 0.8478259 2.347826 0.9130433 2.413044
92+
0.9782607 2.478261 1.043478 2.543479 1.108696
93+
94+
type = integer-attribute
95+
name = DATASET_RANK
96+
count = 8
97+
3 3 0 0 0
98+
0 0 0
99+
100+
type = integer-attribute
101+
name = DATASET_DIMENSIONS
102+
count = 5
103+
33 41 25 0 0
104+
105+
type = integer-attribute
106+
name = BRICK_TYPES
107+
count = 3
108+
1 3 5
109+
110+
type = float-attribute
111+
name = BRICK_FLOAT_FACS
112+
count = 3
113+
0 0 0
114+
115+
type = string-attribute
116+
name = TEMPLATE_SPACE
117+
count = 5
118+
'ORIG~
119+
120+
type = integer-attribute
121+
name = INT_CMAP
122+
count = 1
123+
0
124+
125+
type = string-attribute
126+
name = BYTEORDER_STRING
127+
count = 10
128+
'LSB_FIRST~
129+
130+
type = string-attribute
131+
name = BRICK_LABS
132+
count = 9
133+
'#0~#1~#2~
173 KB
Binary file not shown.

0 commit comments

Comments
 (0)