VTK
vtkMINC.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMINC.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*=========================================================================
16 
17 Copyright (c) 2006 Atamai, Inc.
18 
19 Use, modification and redistribution of the software, in source or
20 binary forms, are permitted provided that the following terms and
21 conditions are met:
22 
23 1) Redistribution of the source code, in verbatim or modified
24  form, must retain the above copyright notice, this license,
25  the following disclaimer, and any notices that refer to this
26  license and/or the following disclaimer.
27 
28 2) Redistribution in binary form must include the above copyright
29  notice, a copy of this license and the following disclaimer
30  in the documentation or with other materials provided with the
31  distribution.
32 
33 3) Modified copies of the source code must be clearly marked as such,
34  and must not be misrepresented as verbatim copies of the source code.
35 
36 THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS"
37 WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO,
38 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 PURPOSE. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY
40 MODIFY AND/OR REDISTRIBUTE THE SOFTWARE UNDER THE TERMS OF THIS LICENSE
41 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES
42 (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BECOMING INACCURATE
43 OR LOSS OF PROFIT OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF
44 THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE
45 POSSIBILITY OF SUCH DAMAGES.
46 
47 =========================================================================*/
48 
49 /*
50  This file has been modified from the original "minc.h" that was
51  distributed with minc version 1.4. All of the prototype
52  declarations have been removed. This modification was made in
53  support of the use of this file with the vtkMINCReader
54  and vtkMINCWriter.
55 
56  David Gobbi, Atamai Inc..
57 */
58 
59 #ifndef vtkMINC_h
60 #define vtkMINC_h
61 
62 /* Added since the file moved to VTK */
63 #define MIident "ident"
64 
65 /* Internally, attributes are stored as named arrays where
66  * the format of the name is "/minc/variable/attribute" rather
67  * than the typical NetCDF format "variable:attribute".
68  */
69 #define MI_GRPNAME "/minc"
70 #define MI_GRP_SEP "/"
71 #define MI_ATT_SEP "/"
72 
73 /* ----------------------------- MNI Header -----------------------------------
74 @NAME : minc.h
75 @DESCRIPTION: Header file for minc (Medical Image NetCDF) file format
76  standard.
77 @METHOD : Includes name definitions for NetCDF dimensions, attributes
78  and variables for the following :
79  NetCDF standard attributes
80  MI general variable attributes
81  MI dimensions and associated variables
82  MI dimension variable attributes
83  MI root variable
84  MI image variable
85  MI patient variable
86  MI study variable
87  MI acquisition variable
88 @CREATED : July 24, 1992. (Peter Neelin, Montreal Neurological Institute)
89 @MODIFIED :
90  * Log: vtkMINC.h
91  * Revision 1.1 2006/09/03 01:01:21 dgobbi
92  * ENH: move the MINC attributes into a separate file to make it easy to copy from the reader to the writer
93  *
94  * Revision 1.1 2006/08/30 16:03:22 dgobbi
95  * ENH: Add a vtkMINC.h that contains all the MINC constants. Make the MINCReader and MINCWriter use it.
96  *
97  * Revision 6.11.2.2 2004/09/28 20:23:40 bert
98  * Minor portability fixes for Windows
99  *
100  * Revision 6.11.2.1 2004/08/11 21:03:06 bert
101  * Fix MI_MAX_IMGDIMS at 100 to avoid netCDF 3.5.1 problem
102  *
103  * Revision 6.11 2004/04/15 21:13:21 bert
104  * Add C++ linkage specifier
105  *
106  * Revision 6.10 2004/02/02 18:22:34 bert
107  * Added miget_version() and miappend_history()
108  *
109  * Revision 6.9 2003/03/17 16:03:28 bert
110  * Added declaration of micreate_tempfile()
111  *
112  * Revision 6.8 2001/11/13 14:15:17 neelin
113  * Added functions miget_image_range and mivar_exists
114  *
115  * Revision 6.7 2001/08/20 13:19:14 neelin
116  * Added function miattget_with_sign to allow the caller to specify the sign
117  * of the input attribute since this information is ambiguous. This is
118  * necessary for the valid_range attribute which should have the same sign
119  * as the image data. Modified miget_valid_range to make use of this function.
120  *
121  * Revision 6.6 2001/08/16 16:41:31 neelin
122  * Added library functions to handle reading of datatype, sign and valid range,
123  * plus writing of valid range and setting of default ranges. These functions
124  * properly handle differences between valid_range type and image type. Such
125  * difference can cause valid data to appear as invalid when double to float
126  * conversion causes rounding in the wrong direction (out of range).
127  * Modified voxel_loop, volume_io and programs to use these functions.
128  *
129  * Revision 6.5 2001/08/16 13:32:18 neelin
130  * Partial fix for valid_range of different type from image (problems
131  * arising from double to float conversion/rounding). NOT COMPLETE.
132  *
133  * Revision 6.4 2001/04/24 13:38:40 neelin
134  * Replaced NC_NAT with MI_ORIGINAL_TYPE.
135  *
136  * Revision 6.3 2001/04/17 18:40:13 neelin
137  * Modifications to work with NetCDF 3.x
138  * In particular, changed NC_LONG to NC_INT (and corresponding longs to ints).
139  * Changed NC_UNSPECIFIED to NC_NAT.
140  * A few fixes to the configure script.
141  *
142  * Revision 6.2 2001/04/10 22:05:30 neelin
143  * Start of modifications to get minc working with netcdf 3.5.
144  *
145  * Revision 6.1 1999/10/19 14:45:08 neelin
146  * Fixed Log subsitutions for CVS
147  *
148  * Revision 6.0 1997/09/12 13:24:54 neelin
149  * Release of minc version 0.6
150  *
151  * Revision 5.0 1997/08/21 13:25:53 neelin
152  * Release of minc version 0.5
153  *
154  * Revision 4.0 1997/05/07 20:07:52 neelin
155  * Release of minc version 0.4
156  *
157  * Revision 3.1 1995/06/12 17:37:05 neelin
158  * Added MI_LABEL modality.
159  *
160  * Revision 3.0 1995/05/15 19:33:12 neelin
161  * Release of minc version 0.3
162  *
163  * Revision 2.4 1995/01/24 08:34:30 neelin
164  * Added optional tempfile argument to miexpand_file.
165  *
166  * Revision 2.3 95/01/23 08:28:31 neelin
167  * Changed name of midecompress_file to miexpand_file.
168  *
169  * Revision 2.2 95/01/20 15:21:16 neelin
170  * Added midecompress_file with ability to decompress only the header of a file.
171  *
172  * Revision 2.1 94/11/25 15:32:32 neelin
173  * Added #undef for public if it wasn't previously defined so that C++
174  * code won't get upset.
175  *
176  * Revision 2.0 94/09/28 10:38:00 neelin
177  * Release of minc version 0.2
178  *
179  * Revision 1.29 94/09/28 10:37:24 neelin
180  * Pre-release
181  *
182  * Revision 1.28 93/11/03 13:08:37 neelin
183  * Added prototypes for miopen, miclose, micreate.
184  *
185  * Revision 1.27 93/11/03 12:29:11 neelin
186  * Added error code for failure to uncompress a file.
187  *
188  * Revision 1.26 93/08/11 12:06:34 neelin
189  * Added RCS logging in source.
190  *
191  July 15, 1993 (P.N.)
192  - added MI_ICV_DO_FILLVALUE and MI_FILLVALUE
193 @COPYRIGHT :
194  Copyright 1993 Peter Neelin, McConnell Brain Imaging Centre,
195  Montreal Neurological Institute, McGill University.
196  Permission to use, copy, modify, and distribute this
197  software and its documentation for any purpose and without
198  fee is hereby granted, provided that the above copyright
199  notice appear in all copies. The author and McGill University
200  make no representations about the suitability of this
201  software for any purpose. It is provided "as is" without
202  express or implied warranty.
203 @RCSID : Header MINC (MNI)
204 ---------------------------------------------------------------------------- */
205 
206 /* Some useful constants */
207 #define MI_EMPTY_STRING ""
208 /* Error flags */
209 #define MI_ERROR (-1)
210 #define MI_NOERROR 0
211 /* Maximum length of standard attributes */
212 #define MI_MAX_ATTSTR_LEN 64
213 /* Number of spatial dimensions */
214 #define MI_NUM_SPACE_DIMS 3
215 /* Maximum number of image dimensions for image conversion */
216 
217 /* Bert 10-Aug-2004 - MI_MAX_IMGDIMS used to be defined to be MAX_VAR_DIMS,
218  * a constant defined in netcdf.h. For many years MAX_VAR_DIMS was 100,
219  * but in netCDF 3.5.1 the value was changed to 512.
220  * Unfortunately, the definitions of MI_ICV_DIM_SIZE, MI_ICV_DIM_STEP,
221  * and MI_ICV_DIM_START assume that MI_MAX_IMGDIMS is less than or
222  * equal to 100. To avoid changing the MINC API, we have to define
223  * MI_MAX_IMGDIMS to 100 here. Otherwise the miicv_inqdbl() function
224  * will return bogus values for these ICV properties.
225  */
226 #define MI_MAX_IMGDIMS 100
227 
228 /* NetCDF standard attributes */
229 #define MIunits "units"
230 #define MIlong_name "long_name"
231 #define MIvalid_range "valid_range"
232 #define MIvalid_max "valid_max"
233 #define MIvalid_min "valid_min"
234 #define MI_FillValue "_FillValue"
235 #define MItitle "title"
236 #define MIhistory "history"
237 
238 /* General variable attributes */
239 #define MIvartype "vartype"
240 #define MIvarid "varid"
241 #define MIsigntype "signtype"
242 #define MIparent "parent"
243 #define MIchildren "children"
244 #define MIcomments "comments"
245 #define MIversion "version"
246 
247 /* General attribute constants */
248 /* Prefix for identifying a variable attribute pointer */
249 #define MI_VARATT_POINTER_PREFIX "--->"
250 /* Separator for elements of MIchildren */
251 #define MI_CHILD_SEPARATOR "\n"
252 /* MIvartype values */
253 #define MI_GROUP "group________"
254 #define MI_DIMENSION "dimension____"
255 #define MI_DIM_WIDTH "dim-width____"
256 #define MI_VARATT "var_attribute"
257 /* MIvarid value */
258 #define MI_STDVAR "MINC standard variable"
259 /* MIsigntype values */
260 #define MI_SIGNED "signed__"
261 #define MI_UNSIGNED "unsigned"
262 /* MIversion value */
263 #define MI_VERSION_1_0 "MINC Version 1.0"
264 #define MI_CURRENT_VERSION MI_VERSION_1_0
265 /* Generally useful values for boolean attributes */
266 #define MI_TRUE "true_"
267 #define MI_FALSE "false"
268 
269 /* Dimension names and names of associated variables */
270 #define MIxspace "xspace"
271 #define MIyspace "yspace"
272 #define MIzspace "zspace"
273 #define MItime "time"
274 #define MItfrequency "tfrequency"
275 #define MIxfrequency "xfrequency"
276 #define MIyfrequency "yfrequency"
277 #define MIzfrequency "zfrequency"
278 #define MIvector_dimension "vector_dimension"
279 #define MIxspace_width "xspace-width"
280 #define MIyspace_width "yspace-width"
281 #define MIzspace_width "zspace-width"
282 #define MItime_width "time-width"
283 #define MItfrequency_width "tfrequency-width"
284 #define MIxfrequency_width "xfrequency-width"
285 #define MIyfrequency_width "yfrequency-width"
286 #define MIzfrequency_width "zfrequency-width"
287 
288 /* Dimension variable attribute names */
289 /* For dimension variables (MIspacing is also for dimension width vars) */
290 #define MIspacing "spacing"
291 #define MIstep "step"
292 #define MIstart "start"
293 #define MIspacetype "spacetype"
294 #define MIalignment "alignment"
295 #define MIdirection_cosines "direction_cosines"
296 /* For dimension width variables */
297 #define MIwidth "width"
298 #define MIfiltertype "filtertype"
299 
300 /* Dimension attribute constants */
301 /* MIgridtype values */
302 #define MI_REGULAR "regular__"
303 #define MI_IRREGULAR "irregular"
304 /* MIspacetype values */
305 #define MI_NATIVE "native____"
306 #define MI_TALAIRACH "talairach_"
307 #define MI_CALLOSAL "callosal__"
308 /* MIalignment values */
309 #define MI_START "start_"
310 #define MI_CENTRE "centre"
311 #define MI_END "end___"
312 #define MI_CENTER MI_CENTRE
313 /* MIfiltertype values */
314 #define MI_SQUARE "square____"
315 #define MI_GAUSSIAN "gaussian__"
316 #define MI_TRIANGULAR "triangular"
317 
318 /* The root variable */
319 #define MIrootvariable "rootvariable"
320 
321 /* The image variable and its attributes */
322 #define MIimage "image"
323 #define MIimagemax "image-max"
324 #define MIimagemin "image-min"
325 #define MIcomplete "complete"
326 
327 /* The patient variable and its attributes */
328 #define MIpatient "patient"
329 #define MIfull_name "full_name"
330 #define MIother_names "other_names"
331 #define MIidentification "identification"
332 #define MIother_ids "other_ids"
333 #define MIbirthdate "birthdate"
334 #define MIsex "sex"
335 #define MIage "age"
336 #define MIweight "weight"
337 #define MIsize "size"
338 #define MIaddress "address"
339 #define MIinsurance_id "insurance_id"
340 
341 /* Patient attribute constants */
342 #define MI_MALE "male__"
343 #define MI_FEMALE "female"
344 #define MI_OTHER "other_"
345 
346 /* The study variable and its attributes */
347 #define MIstudy "study"
348 #define MIstart_time "start_time"
349 #define MIstart_year "start_year"
350 #define MIstart_month "start_month"
351 #define MIstart_day "start_day"
352 #define MIstart_hour "start_hour"
353 #define MIstart_minute "start_minute"
354 #define MIstart_seconds "start_seconds"
355 #define MImodality "modality"
356 #define MImanufacturer "manufacturer"
357 #define MIdevice_model "device_model"
358 #define MIinstitution "institution"
359 #define MIdepartment "department"
360 #define MIstation_id "station_id"
361 #define MIreferring_physician "referring_physician"
362 #define MIattending_physician "attending_physician"
363 #define MIradiologist "radiologist"
364 #define MIoperator "operator"
365 #define MIadmitting_diagnosis "admitting_diagnosis"
366 #define MIprocedure "procedure"
367 #define MIstudy_id "study_id"
368 
369 /* Study attribute constants */
370 #define MI_PET "PET__"
371 #define MI_SPECT "SPECT"
372 #define MI_GAMMA "GAMMA"
373 #define MI_MRI "MRI__"
374 #define MI_MRS "MRS__"
375 #define MI_MRA "MRA__"
376 #define MI_CT "CT___"
377 #define MI_DSA "DSA__"
378 #define MI_DR "DR___"
379 #define MI_LABEL "label"
380 
381 /* The acquisition variable and its attributes */
382 #define MIacquisition "acquisition"
383 #define MIprotocol "protocol"
384 #define MIscanning_sequence "scanning_sequence"
385 #define MIrepetition_time "repetition_time"
386 #define MIecho_time "echo_time"
387 #define MIinversion_time "inversion_time"
388 #define MInum_averages "num_averages"
389 #define MIimaging_frequency "imaging_frequency"
390 #define MIimaged_nucleus "imaged_nucleus"
391 #define MIradionuclide "radionuclide"
392 #define MIcontrast_agent "contrast_agent"
393 #define MIradionuclide_halflife "radionuclide_halflife"
394 #define MItracer "tracer"
395 #define MIinjection_time "injection_time"
396 #define MIinjection_year "injection_year"
397 #define MIinjection_month "injection_month"
398 #define MIinjection_day "injection_day"
399 #define MIinjection_hour "injection_hour"
400 #define MIinjection_minute "injection_minute"
401 #define MIinjection_seconds "injection_seconds"
402 #define MIinjection_length "injection_length"
403 #define MIinjection_dose "injection_dose"
404 #define MIdose_units "dose_units"
405 #define MIinjection_volume "injection_volume"
406 #define MIinjection_route "injection_route"
407 
408 /* End ifndef vtkMINC_h */
409 #endif
410 // VTK-HeaderTest-Exclude: vtkMINC.h