xref: /netbsd-src/external/bsd/file/dist/magic/magdir/nifty (revision a77ebd868432a4d7e595fb7709cfc1b8f144789b)
1*a77ebd86Schristos
2*a77ebd86Schristos#------------------------------------------------------------------------------
3*a77ebd86Schristos# $File: nifty,v 1.1 2022/02/14 16:51:15 christos Exp $
4*a77ebd86Schristos# file(1) magic for the NIfTI file format
5*a77ebd86Schristos
6*a77ebd86Schristos# Type: NIfTI, Neuroimaging file format
7*a77ebd86Schristos# URL:  https://nifti.nimh.nih.gov/
8*a77ebd86Schristos# From: Yann Leprince <yann.leprince@cea.fr>, 2022
9*a77ebd86Schristos
10*a77ebd86Schristos344	string		n+1\0		NIfTI-1 neuroimaging data,
11*a77ebd86Schristos!:mime	image/x.nifti
12*a77ebd86Schristos!:ext	nii
13*a77ebd86Schristos>0	use		nifti1
14*a77ebd86Schristos344	string		ni1\0		NIfTI-1 neuroimaging data header,
15*a77ebd86Schristos!:mime	image/x.nifti
16*a77ebd86Schristos!:ext	hdr
17*a77ebd86Schristos>0	use		nifti1
18*a77ebd86Schristos
19*a77ebd86Schristos4	string		n+2\0\r\n\032\n	NIfTI-2 neuroimaging data,
20*a77ebd86Schristos!:mime	image/x.nifti
21*a77ebd86Schristos!:ext	nii
22*a77ebd86Schristos>0	use		nifti2
23*a77ebd86Schristos4	string		ni2\0\r\n\032\n	NIfTI-2 neuroimaging data header,
24*a77ebd86Schristos!:mime	image/x.nifti
25*a77ebd86Schristos!:ext	hdr
26*a77ebd86Schristos>0	use		nifti2
27*a77ebd86Schristos
28*a77ebd86Schristos# Main subroutine for NIfTI-1
29*a77ebd86Schristos0	name		nifti1
30*a77ebd86Schristos>0	clear		x
31*a77ebd86Schristos>0	lelong		=348		little endian
32*a77ebd86Schristos>>70	use		nifti-datatype-le
33*a77ebd86Schristos>>112	lefloat	!0		with scaling
34*a77ebd86Schristos>>0	use		nifti1-dim-le
35*a77ebd86Schristos>>252	leshort	>0		\b, with qform
36*a77ebd86Schristos>>>252	use		xform-code-nifti1-le
37*a77ebd86Schristos>>254	leshort	>0		\b, with sform
38*a77ebd86Schristos>>>254	use		xform-code-nifti1-le
39*a77ebd86Schristos>>136	string		>\0		\b, description: %s
40*a77ebd86Schristos>0	belong		=348		big endian
41*a77ebd86Schristos>>70	use		\^nifti-datatype-le
42*a77ebd86Schristos>>112	befloat	!0		with scaling
43*a77ebd86Schristos>>0	use		\^nifti1-dim-le
44*a77ebd86Schristos>>252	beshort	>0		\b, with qform
45*a77ebd86Schristos>>>252	use		\^xform-code-nifti1-le
46*a77ebd86Schristos>>254	beshort	>0		\b, with sform
47*a77ebd86Schristos>>>254	use		\^xform-code-nifti1-le
48*a77ebd86Schristos>>136	string		>\0		\b, description: %s
49*a77ebd86Schristos>0	default	x
50*a77ebd86Schristos>>0	long		x		invalid sizeof_hdr=%d
51*a77ebd86Schristos
52*a77ebd86Schristos# Main subroutine for NIfTI-2
53*a77ebd86Schristos0	name		nifti2
54*a77ebd86Schristos>0	clear		x
55*a77ebd86Schristos>0	lelong		=540		little endian
56*a77ebd86Schristos>>12	use		nifti-datatype-le
57*a77ebd86Schristos>>176	lefloat	!0		with scaling
58*a77ebd86Schristos>>0	use		nifti2-dim-le
59*a77ebd86Schristos>>344	lelong		>0		\b, with qform
60*a77ebd86Schristos>>>344	use		xform-code-nifti2-le
61*a77ebd86Schristos>>348	lelong		>0		\b, with sform
62*a77ebd86Schristos>>>348	use		xform-code-nifti2-le
63*a77ebd86Schristos>>240	string		>\0		\b, description: %s
64*a77ebd86Schristos>0	belong		=540		big endian
65*a77ebd86Schristos>>12	use		\^nifti-datatype-le
66*a77ebd86Schristos>>176	befloat	!0		with scaling
67*a77ebd86Schristos>>0	use		\^nifti2-dim-le
68*a77ebd86Schristos>>344	lelong		>0		\b, with qform
69*a77ebd86Schristos>>>344	use		\^xform-code-nifti2-le
70*a77ebd86Schristos>>348	lelong		>0		\b, with sform
71*a77ebd86Schristos>>>348	use		\^xform-code-nifti2-le
72*a77ebd86Schristos>>240	string		>\0		\b, description: %s
73*a77ebd86Schristos>0	default	x
74*a77ebd86Schristos>>0	long		x		invalid sizeof_hdr=%d
75*a77ebd86Schristos
76*a77ebd86Schristos
77*a77ebd86Schristos# Other subroutines for details of NIfTI files
78*a77ebd86Schristos
79*a77ebd86Schristos0	name		nifti-datatype-le
80*a77ebd86Schristos>0	clear		x
81*a77ebd86Schristos>0	leshort	=1		\b, binary datatype
82*a77ebd86Schristos>0	leshort	=2		\b, uint8 datatype
83*a77ebd86Schristos>0	leshort	=4		\b, int16 datatype
84*a77ebd86Schristos>0	leshort	=8		\b, int32 datatype
85*a77ebd86Schristos>0	leshort	=16		\b, float32 datatype
86*a77ebd86Schristos>0	leshort	=32		\b, complex64 datatype
87*a77ebd86Schristos>0	leshort	=64		\b, float64 datatype
88*a77ebd86Schristos>0	leshort	=128		\b, RGB24 datatype
89*a77ebd86Schristos>0	leshort	=256		\b, int8 datatype
90*a77ebd86Schristos>0	leshort	=512		\b, uint16 datatype
91*a77ebd86Schristos>0	leshort	=768		\b, uint32 datatype
92*a77ebd86Schristos>0	leshort	=1024		\b, int64 datatype
93*a77ebd86Schristos>0	leshort	=1280		\b, uint64 datatype
94*a77ebd86Schristos>0	leshort	=1536		\b, float128 datatype
95*a77ebd86Schristos>0	leshort	=1792		\b, complex128 datatype
96*a77ebd86Schristos>0	leshort	=2048		\b, complex256 datatype
97*a77ebd86Schristos>0	leshort	=2304		\b, RGBA32 datatype
98*a77ebd86Schristos>0	default	x
99*a77ebd86Schristos>>0	leshort	x		\b, unknown datatype 0x%x
100*a77ebd86Schristos>>2	leshort	x		(%d bits/pixel)
101*a77ebd86Schristos
102*a77ebd86Schristos0	name		nifti1-dim-le
103*a77ebd86Schristos>0	clear		x
104*a77ebd86Schristos>40	leshort	<0		\b, INVALID dim[0]=%d
105*a77ebd86Schristos>40	leshort	>7		\b, INVALID dim[0]=%d
106*a77ebd86Schristos>0	default	x
107*a77ebd86Schristos>>40	leshort	x		\b, %d-dimensional (size
108*a77ebd86Schristos>>42	leshort	x		%d
109*a77ebd86Schristos>>40	leshort	>1
110*a77ebd86Schristos>>>44	leshort	x		\bx%d
111*a77ebd86Schristos>>40	leshort	>2
112*a77ebd86Schristos>>>46	leshort	x		\bx%d
113*a77ebd86Schristos>>40	leshort	>3
114*a77ebd86Schristos>>>48	leshort	x		\bx%d
115*a77ebd86Schristos>>40	leshort	>4
116*a77ebd86Schristos>>>50	leshort	x		\bx%d
117*a77ebd86Schristos>>40	leshort	>5
118*a77ebd86Schristos>>>52	leshort	x		\bx%d
119*a77ebd86Schristos>>40	leshort	>6
120*a77ebd86Schristos>>>54	leshort	x		\bx%d
121*a77ebd86Schristos>>80	lefloat	x		\b, voxel size %f
122*a77ebd86Schristos>>40	leshort	>1
123*a77ebd86Schristos>>>84	lefloat	x		x %f
124*a77ebd86Schristos>>40	leshort	>2
125*a77ebd86Schristos>>>88	lefloat	x		x %f
126*a77ebd86Schristos>>123	use		nifti1-xyz-unit
127*a77ebd86Schristos>>40	leshort	>3
128*a77ebd86Schristos>>>92	lefloat	x		x %f
129*a77ebd86Schristos>>>123	use		nifti1-t-unit
130*a77ebd86Schristos>>40	leshort	x		\b)
131*a77ebd86Schristos
132*a77ebd86Schristos0	name		nifti2-dim-le
133*a77ebd86Schristos>0	clear		x
134*a77ebd86Schristos>16	lequad		<0		\b, INVALID dim[0]=%lld
135*a77ebd86Schristos>16	lequad		>7		\b, INVALID dim[0]=%lld
136*a77ebd86Schristos>0	default	x
137*a77ebd86Schristos>>16	lequad		x		\b, %lld-dimensional (size
138*a77ebd86Schristos>>24	lequad		x		%lld
139*a77ebd86Schristos>>16	lequad		>1
140*a77ebd86Schristos>>>32	lequad		x		\bx%lld
141*a77ebd86Schristos>>16	lequad		>2
142*a77ebd86Schristos>>>40	lequad		x		\bx%lld
143*a77ebd86Schristos>>16	lequad		>3
144*a77ebd86Schristos>>>48	lequad		x		\bx%lld
145*a77ebd86Schristos>>16	lequad		>4
146*a77ebd86Schristos>>>56	lequad		x		\bx%lld
147*a77ebd86Schristos>>16	lequad		>5
148*a77ebd86Schristos>>>64	lequad		x		\bx%lld
149*a77ebd86Schristos>>16	lequad		>6
150*a77ebd86Schristos>>>72	lequad		x		\bx%lld,
151*a77ebd86Schristos>>112	ledouble	x		\b, voxel size %f
152*a77ebd86Schristos>>16	lequad		>1
153*a77ebd86Schristos>>>120	ledouble	x		x %f
154*a77ebd86Schristos>>16	lequad		>2
155*a77ebd86Schristos>>>128	ledouble	x		x %f
156*a77ebd86Schristos>>500	use		nifti2-xyz-unit
157*a77ebd86Schristos>>16	lequad		>3
158*a77ebd86Schristos>>>136	ledouble	x		x %f
159*a77ebd86Schristos>>>500	use		nifti2-t-unit
160*a77ebd86Schristos>>16	lequad		x		\b)
161*a77ebd86Schristos
162*a77ebd86Schristos0	name		xform-code-nifti1-le
163*a77ebd86Schristos>0	leshort	=1		to scanner-based coordinates
164*a77ebd86Schristos>0	leshort	=2		to aligned coordinates
165*a77ebd86Schristos>0	leshort	=3		to Talairach coordinates
166*a77ebd86Schristos>0	leshort	=4		to MNI152 coordinates
167*a77ebd86Schristos>0	leshort	=5		to template coordinates
168*a77ebd86Schristos
169*a77ebd86Schristos0	name		xform-code-nifti2-le
170*a77ebd86Schristos>0	lelong		=1		to scanner-based coordinates
171*a77ebd86Schristos>0	lelong		=2		to aligned coordinates
172*a77ebd86Schristos>0	lelong		=3		to Talairach coordinates
173*a77ebd86Schristos>0	lelong		=4		to MNI152 coordinates
174*a77ebd86Schristos>0	lelong		=5		to template coordinates
175*a77ebd86Schristos
176*a77ebd86Schristos0	name		nifti1-xyz-unit
177*a77ebd86Schristos>0	byte		&0x01
178*a77ebd86Schristos>>0	byte		^0x02		m
179*a77ebd86Schristos>>0	byte		&0x02		micron
180*a77ebd86Schristos>0	byte		^0x01
181*a77ebd86Schristos>>0	byte		&0x02		mm
182*a77ebd86Schristos
183*a77ebd86Schristos0	name		nifti1-t-unit
184*a77ebd86Schristos>0	byte		&0x08
185*a77ebd86Schristos>>0	byte		^0x10		s
186*a77ebd86Schristos>>0	byte		&0x10		ms
187*a77ebd86Schristos>0	byte		^0x08
188*a77ebd86Schristos>>0	byte		&0x10		microsecond
189*a77ebd86Schristos
190*a77ebd86Schristos0	name		nifti2-xyz-unit
191*a77ebd86Schristos>0	lelong		&0x01
192*a77ebd86Schristos>>0	lelong		^0x02		m
193*a77ebd86Schristos>>0	lelong		&0x02		micron
194*a77ebd86Schristos>0	lelong		^0x01
195*a77ebd86Schristos>>0	lelong		&0x02		mm
196*a77ebd86Schristos
197*a77ebd86Schristos0	name		nifti2-t-unit
198*a77ebd86Schristos>0	lelong		&0x08
199*a77ebd86Schristos>>0	lelong		^0x10		s
200*a77ebd86Schristos>>0	lelong		&0x10		ms
201*a77ebd86Schristos>0	lelong		^0x08
202*a77ebd86Schristos>>0	lelong		&0x10		microsecond
203