1M-ACR(4) Kernel Interfaces Manual M-ACR(4)
2
3
4
6 m-acr - ACR/NEMA medical image format (MedCon)
7
9 We are absolutely lost in standards, versions and ACR/NEMA dialects. Here
10 you can only read how we handle this format. The format is written in one
11 file with extension `.ima'.
12
13 The format consists of a group of fields with different elements, in a serie
14 of tags. Does that explain you something? The image data is stored from left
15 to right and from top to bottom.
16
17 The basic defines for the format:
18
19 ---------------------------------------------------------------------------
20
21 #define MDC_ACR_TAG_SIZE 8 /* size of group+element+length */
22
23 typedef struct {
24 Uint16 group; /* the kind of group */
25 Uint16 element; /* the kind of element */
26 Uint32 length; /* the length of data */
27 Uint8 *data; /* pointer to the data */
28 } MDC_ACR_TAG;
29
30 ---------------------------------------------------------------------------
31 What does the format support or not support:
32
33 ===========================================================================
34 Item Supported Not Supported
35 ===========================================================================
36 Color Map : grayscale -
37 File Endian : little & big -
38 Pixeltypes : all integers (signed/unsigned) float & double
39 ===========================================================================
40 Scaling factors : quantify & calibrate factors/image are NOT supported,
41 unless you define your own tags
42 ---------------------------------------------------------------------------
43 Dimensions/Image : different dimensions for each image are supported
44 ---------------------------------------------------------------------------
45 Pixeltypes/Image : different pixeltypes for each image are supported
46 ===========================================================================
47
48 An ACR/NEMA file could look like this, in fact it is the kind we write:
49
50 ===========================================================================
51 GROUP 0x0008 Identifying information
52 ===========================================================================
53 Uint16 Group number : 0x0008
54 Uint16 Element number : 0x0000 (first element of any group)
55 Uint32 Element length in bytes : (4)
56 Int32 Length of group in bytes : (X) (143)
57 X = [total length of this group] - [total bytes of this first tag (12)]
58 ---------------------------------------------------------------------------
59 Uint16 Group number : 0x0008
60 Uint16 Element number : 0x0001
61 Uint32 Element length in bytes : (4)
62 Int32 Total bytes to end of file : Y
63 Y = [filesize] - [total bytes of first two tags]
64 ---------------------------------------------------------------------------
65 Uint16 Group number : 0x0008
66 Uint16 Element number : 0x0010
67 Uint32 Element length in bytes : (12)
68 char * Recognition Code : (ACR-NEMA 2.0)
69 ---------------------------------------------------------------------------
70 Uint16 Group number : 0x0008
71 Uint16 Element number : 0x0020
72 Uint32 Element length in bytes : (10)
73 char * Study Date : yyyy.mm.dd
74 ---------------------------------------------------------------------------
75 Uint16 Group number : 0x0008
76 Uint16 Element number : 0x0030
77 Uint32 Element length in bytes : (14)
78 char * Study Time : hh.mm.ss.frac_
79 ---------------------------------------------------------------------------
80 Uint16 Group number : 0x0008
81 Uint16 Element number : 0x0040
82 Uint32 Element length in bytes : (2)
83 Int16 Data Set Type : 0 = Images
84 256 = Raw data
85 ---------------------------------------------------------------------------
86 Uint16 Group number : 0x0008
87 Uint16 Element number : 0x0060
88 Uint32 Element length in bytes : (2)
89 char * Image Modality : (NM)
90 ---------------------------------------------------------------------------
91 Uint16 Group number : 0x0008
92 Uint16 Element number : 0x0070
93 Uint32 Element length in bytes : (24)
94 char * Manufacturer : (MedCon v?.?? - Erik Nolf)
95 ---------------------------------------------------------------------------
96 Uint16 Group number : 0x0008
97 Uint16 Element number : 0x0080
98 Uint32 Element length in bytes : (11)
99 char * Institution ID : (NucMed)
100 ===========================================================================
101 GROUP 0x0010 Patient Information
102 ===========================================================================
103 Uint16 Group number : 0x0010
104 Uint16 Element number : 0x0000
105 Uint32 Element length in bytes : (4)
106 Int32 Length of group in bytes : (96)
107 ---------------------------------------------------------------------------
108 Uint16 Group number : 0x0010
109 Uint16 Element number : 0x0010
110 Uint32 Element length in bytes : (35)
111 char * Patient Name :
112 ---------------------------------------------------------------------------
113 Uint16 Group number : 0x0010
114 Uint16 Element number : 0x0020
115 Uint32 Element length in bytes : (35)
116 char * Patient ID :
117 ---------------------------------------------------------------------------
118 Uint16 Group number : 0x0010
119 Uint16 Element number : 0x0040
120 Uint32 Element length in bytes : (2)
121 char * Patient Sex : M_ = male
122 F_ = female
123 O_ = others
124 ===========================================================================
125 GROUP 0x0018 Acquisition Information
126 ===========================================================================
127 Uint16 Group number : 0x0018
128 Uint16 Element number : 0x0000
129 Uint32 Element length in bytes : (4)
130 Int32 Length of group in bytes : (122)
131 ---------------------------------------------------------------------------
132 Uint16 Group number : 0x0018
133 Uint16 Element number : 0x0030
134 Uint32 Element length in bytes : 32
135 char * Radionuclide :
136 ---------------------------------------------------------------------------
137 Uint16 Group number : 0x0018
138 Uint16 Element number : 0x0050
139 Uint32 Element length in bytes : (13)
140 char * Slice Thickness in mm : (+0.000000e+00)
141 ---------------------------------------------------------------------------
142 Uint16 Group number : 0x0018
143 Uint16 Element number : 0x0088
144 Uint32 Element length in bytes : (13)
145 char * Slice Spacing in mm : (+0.000000e+00)
146 ---------------------------------------------------------------------------
147 Uint16 Group number : 0x0018
148 Uint16 Element number : 0x1120
149 Uint32 Element length in bytes : (13)
150 float Gantry Tilt in degrees : (+0.000000e+00)
151 ---------------------------------------------------------------------------
152 Uint16 Group number : 0x0018
153 Uint16 Element number : 0x1160
154 Uint32 Element length in bytes : (32)
155 char * Filter Type :
156 ---------------------------------------------------------------------------
157 Uint16 Group number : 0x0018
158 Uint16 Element number : 0x5100
159 Uint32 Element length in bytes : (32)
160 char * Patient Position : (supine)
161 supine = face-up on the table
162 prone = face-down towards the table
163 other?
164 ===========================================================================
165 GROUP 0x0020 Relationship Information
166 ===========================================================================
167 Uint16 Group number : 0x0020
168 Uint16 Element number : 0x0000
169 Uint32 Element length in bytes : (4)
170 Int32 Length of group in bytes : (352)
171 ---------------------------------------------------------------------------
172 Uint16 Group number : 0x0020
173 Uint16 Element number : 0x0010
174 Uint32 Element length in bytes : (10)
175 char * Study ID :
176 ---------------------------------------------------------------------------
177 Uint16 Group number : 0x0020
178 Uint16 Element number : 0x0013
179 Uint32 Element length in bytes : (6)
180 char * Image Number :
181 ---------------------------------------------------------------------------
182 Uint16 Group number : 0x0020
183 Uint16 Element number : 0x0020
184 Uint32 Element length in bytes : (32)
185 char * Patient Orientation : (L\P)
186
187 (direction of image row in patient\direction of image column in patient)
188
189 'L' = Left (hand) 'A' = Anterior (to front) 'H' = Head
190 'R' = Right (hand) 'P' = Posterior (to back) 'F' = Feet
191
192 ---------------------------------------------------------------------------
193 Uint16 Group number : 0x0020
194 Uint16 Element number : 0x0030
195 Uint32 Element length in bytes : (41)
196 char * Image Position in mm :
197
198 * * * * * * * * * * * * *
199 Gives the 3D equipment based coordinates of the upper left hand corner
200 in the image. Example: (+0.000000e+00\+0.000000e+00\+0.000000e+00)
201 =X-axis =Y-axis =Z-axis
202 "When facing the front of the gantry (equipment device), and with the
203 gantry in a neutral (untilted) position, the x-axis is increasing to the
204 right; the y-axis is increasing down (gravitational attraction); and the
205 z-axis is defined as the line orthogonal to x and y, with increasing
206 values from the front to the back of the gantry."
207 (From a Papyrus 2.3 document: UIN/HCUG 1990, 91)
208
209
210 My note: where is its origin? For an ECAT 931 scanner we choose the origin
211 in the right/back/down point of the gantry
212
213 A
214 ______H
215 |\______\F Looking to the scanner, this is a representation of the
216 R |.|.... | L volume our scanner detects. My origin is in the point we
217 \|_____| can't see ;-) Our images are transversal slices, beginning
218 at the head towards the feet (so patient orientation = L\P)
219 P and the patient position is supine.
220
221 Therefore, the coordinates of the first pixel in our images is:
222 Image 0:
223 -(PIXEL_X_SIZE*PIXELS_IN_X);-(PIXEL_Y_SIZE*PIXELS_IN_Y);-0
224 Image 1:
225 -(PIXEL_X_SIZE*PIXELS_IN_X);-(PIXEL_Y_SIZE*PIXELS_IN_Y);-(SLICE_WIDTH*1)
226 Image n:
227 -(PIXEL_X_SIZE*PIXELS_IN_X);-(PIXEL_Y_SIZE*PIXELS_IN_Y);-(SLICE_WIDTH*N)
228 | |
229 image width image height
230
231 A view of the coordinate system you can see in 0x0020;0x0035.
232
233 However, it could all be wrong too! By the way, for DICOM it's retired stuff.
234 * * * * * * * * * * * * *
235 ---------------------------------------------------------------------------
236 Uint16 Group number : 0x0020
237 Uint16 Element number : 0x0032
238 Uint32 Element length in bytes : (41)
239 char * Image Position (Patient) in mm:
240 * * * * * * * * * * * * *
241 The same as above but know based on the coordinate system of the patient.
242 A DICOM replacement for the above values:
243 "The direction of the axes is defined fully by the patient's orientation.
244 The x-axis is increasing to the left hand side of the patient. The y-axis
245 is increasing to the posterior side of the patient. The z-axis is increasing
246 toward the head of the patient.
247
248 The patient based coordinate system is a right handed system, i.e. the vector
249 cross product of a unit vector along the positive x-axis and a unit vector
250 along the positive y-axis is equal to a unit vector along the positive z-axis.
251
252 NOTE: If a patient lies parallel to the ground, face-up on the table, with
253 his feet-to-head direction the same as front-to-back direction of the
254 imaging equipment, the direction of the axes of the patient based
255 coordinate system and equipment based coordinate system in previous
256 versions of the DICOM Standard will coincide"
257 (From the NEMA Standards Publication PS3.3(199X)
258
259 * * * * * * * * * * * * *
260 ---------------------------------------------------------------------------
261 Uint16 Group number : 0x0020
262 Uint16 Element number : 0x0032
263 Uint32 Element length in bytes : (83)
264 char * Image Orientation :
265
266 * * * * * * * * * * * * *
267 Based on 0x0020;0x0030 these are the direction cosines of a unit vector
268 on the first row and on the first column based on the equipment coordinate
269 system (or our patient coordinate system, because they coincide as we
270 described above).
271
272
273 (to back of the scanner)
274 +Z (or head of the patient)
275 \
276 \ coordinate system
277 \
278 \_ _ _ _ _ _ _ +X (to right of the scanner)
279 | (or left of the patient)
280 |
281 |
282 |
283 +Y (to the ground)
284 (or back of the patient)
285
286 * * * * * * * * * * * * *
287
288 Remember we take transversal slices (Right to Left of patient, Anterior to
289 Posterior) while the patient is supine with head first in gantry.
290 Then the images are in the plane XY and the unit vectors are
291
292 upper left
293 corner of image (X)
294 + - - - - > (x1,y1,z1 = 1,0,0)
295 | unit vector on row
296 |
297 |
298 (Y) V (x2,y2,z2 = 0,1,0)
299 unit vector on column
300
301 In this case: a) in point (x1,y1,z1)
302 X direction cosinus = +1
303 Y direction cosinus = -0
304 Z direction cosinus = -0
305
306 b) in point (x2,y2,z2)
307 X direction cosinus = +0
308 Y direction cosinus = +1
309 Z direction cosinus = +0
310
311 How about the signs and values?
312 cos(0 or 360) = +1
313 cos(90) = +0
314 cos(180) = -1
315 cos(270) = -0
316
317 The angle between an axis and the vector, you determine with a so called
318 "corkscrew-rule": You must turn from THE AXIS towards THE VECTOR (=angle)
319 the same direction so a corkscrew should proceed in the direction
320 of an axis orthogonal on the plane formed by THE AXIS and THE VECTOR.
321 Well, thats what it should be I think. If your images are tilted, it
322 will be a bit harder, isn't it?
323
324 For the above ECAT 931 acquisition an example value should be:
325
326 (+1.000000e+00\-0.000000e+00\+0.000000e+00\
327 +0.000000e+00\+1.000000e+00\-0.000000e+00)
328
329
330 Again, this tag is retired for DICOM ...
331 * * * * * * * * * * * * *
332 ---------------------------------------------------------------------------
333 Uint16 Group number : 0x0020
334 Uint16 Element number : 0x0037
335 Uint32 Element length in bytes : (83)
336 char * Image Orientation Patient :
337
338 The same as for tag 0x0020;0x0032 but now considered for the patient
339 coordinate system ...
340
341 ===========================================================================
342 GROUP 0x0028 Image Presentation
343 ===========================================================================
344 Uint16 Group number : 0x0028
345 Uint16 Element number : 0x0000
346 Uint32 Element length in bytes : (4)
347 Int32 Length of group in bytes : (127)
348 ---------------------------------------------------------------------------
349 Uint16 Group number : 0x0028
350 Uint16 Element number : 0x0005
351 Uint32 Element length in bytes : (2)
352 Int16 Image Dimensions : (2)
353 ---------------------------------------------------------------------------
354 Uint16 Group number : 0x0028
355 Uint16 Element number : 0x0010
356 Uint32 Element length in bytes : (2)
357 Int16 Rows :
358 ---------------------------------------------------------------------------
359 Uint16 Group number : 0x0028
360 Uint16 Element number : 0x0011
361 Uint32 Element length in bytes : (2)
362 Int16 Columns :
363 ---------------------------------------------------------------------------
364 Uint16 Group number : 0x0028
365 Uint16 Element number : 0x0030
366 Uint32 Element length in bytes : (27)
367 char * Pixel Size in mm : (+0.000000e+00\+0.000000e+00)
368 ---------------------------------------------------------------------------
369 Uint16 Group number : 0x0028
370 Uint16 Element number : 0x0060
371 Uint32 Element length in bytes : (4)
372 char * Compression code : (NONE)
373 ---------------------------------------------------------------------------
374 Uint16 Group number : 0x0028
375 Uint16 Element number : 0x0100
376 Uint32 Element length in bytes : (2)
377 Int16 Bits Allocated :
378 ---------------------------------------------------------------------------
379 Uint16 Group number : 0x0028
380 Uint16 Element number : 0x0101
381 Uint32 Element length in bytes : (2)
382 Int16 Bits per Pixel :
383 ---------------------------------------------------------------------------
384 Uint16 Group number : 0x0028
385 Uint16 Element number : 0x0102
386 Uint32 Element length in bytes : (2)
387 Int16 High Bit :
388 ---------------------------------------------------------------------------
389 Uint16 Group number : 0x0028
390 Uint16 Element number : 0x0103
391 Uint32 Element length in bytes : (2)
392 Int16 Pixel Representation : 0 = unsigned
393 1 = signed
394 ---------------------------------------------------------------------------
395 Uint16 Group number : 0x0028
396 Uint16 Element number : 0x0200
397 Uint32 Element length in bytes : (2)
398 Int16 Image Location : (7fe0)
399 ===========================================================================
400 GROUP 0x7fe0 Pixel Information
401 ===========================================================================
402 Uint16 Group number : 0x7fe0
403 Uint16 Element number : 0x0000
404 Uint32 Element length in bytes : (4)
405 Int32 Length of group in bytes : Z
406 Z = [imagesize] + 8
407 ---------------------------------------------------------------------------
408 Uint16 Group number : 0x7fe0
409 Uint16 Element number : 0x0010
410 Uint32 Element length in bytes : (imagesize)
411 Uint8 * Image Data :
412 ---------------------------------------------------------------------------
413
414 This was an example of an ACR/NEMA file holding one image, as normal
415 ACR/NEMA files do. However, as we are interested in multiple images, we use
416 an ACR/NEMA dialect such as Papyrus. In this case we sequentially concateā
417 nate different ACR/NEMA files into one single large file!
418
420 Because of the previous remark, we must notify that in the Element 0x0001 of
421 Group 0x0008, the [filesize] means the filesize in case of this one ACR/NEMA
422 file and NOT the real filesize!
423
424 For the Group 0x0028, Element 0x0100: `Bits Allocated'
425 We only support a multiple of 8.
426 For the Group 0x0028, Element 0x0102: `High Bit'
427 We only support `High Bit' = [`Bits per Pixel'] - 1,
428 so we only accept images stored in the file endian type.
429
431 /usr/local/xmedcon/source/m-acr.h The header file.
432 /usr/local/xmedcon/source/m-acr.c The source file.
433
435 medcon(1), xmedcon(1), xmedcon-config(1)
436
437 m-anlz(4), m-gif(4), m-inw(4), m-intf(4), m-ecat(4)
438
439 medcon(3)
440
442 (X)MedCon project was originally written by Erik Nolf (eNlf) for the former
443 PET-Centre at Ghent University (Belgium).
444
445 e-mail: enlf-at-users.sourceforge.net www: http://xmedcon.sourceforge.net
446
447
448
449 M-ACR(4)