1 #ifndef MINC_HEADER_FILE
2 #define MINC_HEADER_FILE
3 
4 /* ----------------------------- MNI Header -----------------------------------
5 @NAME       : minc.h
6 @DESCRIPTION: Header file for minc (Medical Image NetCDF) file format
7               standard.
8 @METHOD     : Includes name definitions for NetCDF dimensions, attributes
9               and variables for the following :
10                  NetCDF standard attributes
11                  MI general variable attributes
12                  MI dimensions and associated variables
13                  MI dimension variable attributes
14                  MI root variable
15                  MI image variable
16                  MI patient variable
17                  MI study variable
18                  MI acquisition variable
19 @CREATED    : July 24, 1992. (Peter Neelin, Montreal Neurological Institute)
20 @MODIFIED   :
21  * $Log: minc.h,v $
22  * Revision 6.21  2010-05-19 03:44:25  stever
23  * Move definition of MNCAPI ahead of #include "minc_compat.h"; fix-up for
24  * previous check-in.
25  *
26  * Revision 6.20  2010-05-19 03:18:42  stever
27  * Ensure hdf5.h included before netcdf.h.
28  *
29  * Revision 6.19  2010-03-02 23:24:40  rotor
30  *  * libsrc/hdf_convenience.c: removed spurious debug output
31  *  * libsrc/minc.h: replaced MAX_NC_OPEN with 32
32  *  * libsrc/voxel_loop.c: replaced MAX_NC_OPEN with MI_MAX_NUM_ICV
33  *
34  * Revision 6.18  2007/08/09 17:05:25  rotor
35  *  * added some fixes of Claudes for chunking and internal compression
36  *
37  * Revision 6.17  2005/08/26 21:04:57  bert
38  * Use #if rather than #ifdef with MINC2 symbol
39  *
40  * Revision 6.16  2004/12/03 21:52:35  bert
41  * Minor changes for Windows build
42  *
43  * Revision 6.15  2004/10/15 13:48:13  bert
44  * Minor changes for Windows compatibility
45  *
46  * Revision 6.14  2004/08/11 20:50:54  bert
47  * Fix incompatibility with netCDF 3.5.1 by fixing MI_MAX_IMGDIMS at 100
48  *
49  * Revision 6.13  2004/06/04 18:14:52  bert
50  * Add micreate_ident()
51  *
52  * Revision 6.12  2004/04/27 15:44:04  bert
53  * Add MINC 2.0 specific stuff
54  *
55  * Revision 6.11  2004/04/15 21:13:21  bert
56  * Add C++ linkage specifier
57  *
58  * Revision 6.10  2004/02/02 18:22:34  bert
59  * Added miget_version() and miappend_history()
60  *
61  * Revision 6.9  2003/03/17 16:03:28  bert
62  * Added declaration of micreate_tempfile()
63  *
64  * Revision 6.8  2001/11/13 14:15:17  neelin
65  * Added functions miget_image_range and mivar_exists
66  *
67  * Revision 6.7  2001/08/20 13:19:14  neelin
68  * Added function miattget_with_sign to allow the caller to specify the sign
69  * of the input attribute since this information is ambiguous. This is
70  * necessary for the valid_range attribute which should have the same sign
71  * as the image data. Modified miget_valid_range to make use of this function.
72  *
73  * Revision 6.6  2001/08/16 16:41:31  neelin
74  * Added library functions to handle reading of datatype, sign and valid range,
75  * plus writing of valid range and setting of default ranges. These functions
76  * properly handle differences between valid_range type and image type. Such
77  * difference can cause valid data to appear as invalid when double to float
78  * conversion causes rounding in the wrong direction (out of range).
79  * Modified voxel_loop, volume_io and programs to use these functions.
80  *
81  * Revision 6.5  2001/08/16 13:32:18  neelin
82  * Partial fix for valid_range of different type from image (problems
83  * arising from double to float conversion/rounding). NOT COMPLETE.
84  *
85  * Revision 6.4  2001/04/24 13:38:40  neelin
86  * Replaced NC_NAT with MI_ORIGINAL_TYPE.
87  *
88  * Revision 6.3  2001/04/17 18:40:13  neelin
89  * Modifications to work with NetCDF 3.x
90  * In particular, changed NC_LONG to NC_INT (and corresponding longs to ints).
91  * Changed NC_UNSPECIFIED to NC_NAT.
92  * A few fixes to the configure script.
93  *
94  * Revision 6.2  2001/04/10 22:05:30  neelin
95  * Start of modifications to get minc working with netcdf 3.5.
96  *
97  * Revision 6.1  1999/10/19 14:45:08  neelin
98  * Fixed Log subsitutions for CVS
99  *
100  * Revision 6.0  1997/09/12 13:24:54  neelin
101  * Release of minc version 0.6
102  *
103  * Revision 5.0  1997/08/21  13:25:53  neelin
104  * Release of minc version 0.5
105  *
106  * Revision 4.0  1997/05/07  20:07:52  neelin
107  * Release of minc version 0.4
108  *
109  * Revision 3.1  1995/06/12  17:37:05  neelin
110  * Added MI_LABEL modality.
111  *
112  * Revision 3.0  1995/05/15  19:33:12  neelin
113  * Release of minc version 0.3
114  *
115  * Revision 2.4  1995/01/24  08:34:30  neelin
116  * Added optional tempfile argument to miexpand_file.
117  *
118  * Revision 2.3  95/01/23  08:28:31  neelin
119  * Changed name of midecompress_file to miexpand_file.
120  *
121  * Revision 2.2  95/01/20  15:21:16  neelin
122  * Added midecompress_file with ability to decompress only the header of a file.
123  *
124  * Revision 2.1  94/11/25  15:32:32  neelin
125  * Added #undef for public if it wasn't previously defined so that C++
126  * code won't get upset.
127  *
128  * Revision 2.0  94/09/28  10:38:00  neelin
129  * Release of minc version 0.2
130  *
131  * Revision 1.29  94/09/28  10:37:24  neelin
132  * Pre-release
133  *
134  * Revision 1.28  93/11/03  13:08:37  neelin
135  * Added prototypes for miopen, miclose, micreate.
136  *
137  * Revision 1.27  93/11/03  12:29:11  neelin
138  * Added error code for failure to uncompress a file.
139  *
140  * Revision 1.26  93/08/11  12:06:34  neelin
141  * Added RCS logging in source.
142  *
143               July 15, 1993 (P.N.)
144                  - added MI_ICV_DO_FILLVALUE and MI_FILLVALUE
145 @COPYRIGHT  :
146               Copyright 1993 Peter Neelin, McConnell Brain Imaging Centre,
147               Montreal Neurological Institute, McGill University.
148               Permission to use, copy, modify, and distribute this
149               software and its documentation for any purpose and without
150               fee is hereby granted, provided that the above copyright
151               notice appear in all copies.  The author and McGill University
152               make no representations about the suitability of this
153               software for any purpose.  It is provided "as is" without
154               express or implied warranty.
155 @RCSID      : $Header: /private-cvsroot/minc/libsrc/minc.h,v 6.21 2010-05-19 03:44:25 stever Exp $ MINC (MNI)
156 ---------------------------------------------------------------------------- */
157 
158 #ifndef MNCAPI
159 #if defined(_MSC_VER)
160 /* If we are building on the Microsoft C compiler, we want to
161  * explicitly import all public functions from the DLL
162  */
163 #define MNCAPI __declspec(dllimport)
164 #else
165 #define MNCAPI
166 #endif /* _MSC_VER not defined */
167 #endif /* MNCAPI not defined */
168 
169 #if MINC2
170 #include <hdf5.h>
171 #include <netcdf.h>
172 #include "minc_compat.h"
173 #else
174 #include <netcdf.h>
175 #endif
176 
177 #ifdef __cplusplus
178 extern "C" {
179 #endif /* __cplusplus */
180 
181 /* For compatibility with NetCDF 2.x which uses NC_LONG rather than NC_INT.
182    Since NC_INT is defined in an enum, and since there are no version macros,
183    we use NC_FILL_INT as an indicator of whether NC_INT is defined. */
184 #ifndef NC_FILL_INT
185 #  define NC_INT NC_LONG
186 #endif
187 
188 /* Constant used with nc_type variables to indicate that the data type
189    should be taken from the source object or file. This replaces earlier
190    use of NC_UNSPECIFIED and is equivalent to NetCDF NC_NAT in version 3.5
191    and later. */
192 #define MI_ORIGINAL_TYPE ((nc_type) 0)
193 
194 /* NC_UNSPECIFIED is defined here for backwards compatibility. With
195    NetCDF 2.x, NC_UNSPECIFIED may already be defined either through a macro
196    or an enum. In the latter case, this macro will override the enum. */
197 #ifndef NC_UNSPECIFIED
198 #  define NC_UNSPECIFIED MI_ORIGINAL_TYPE
199 #endif
200 
201 /* Some useful constants */
202 #define MI_EMPTY_STRING ""
203 /* Error flags */
204 #define MI_ERROR (-1)
205 #define MI_NOERROR 0
206 /* Maximum length of standard attributes */
207 #define MI_MAX_ATTSTR_LEN  64
208 /* Number of spatial dimensions */
209 #define MI_NUM_SPACE_DIMS 3
210 /* Maximum number of image dimensions for image conversion */
211 
212 /* Bert 10-Aug-2004 - MI_MAX_IMGDIMS used to be defined to be MAX_VAR_DIMS,
213  * a constant defined in netcdf.h. For many years MAX_VAR_DIMS was 100,
214  * but in netCDF 3.5.1 the value was changed to 512.
215  * Unfortunately, the definitions of MI_ICV_DIM_SIZE, MI_ICV_DIM_STEP,
216  * and MI_ICV_DIM_START assume that MI_MAX_IMGDIMS is less than or
217  * equal to 100.  To avoid changing the MINC API, we have to define
218  * MI_MAX_IMGDIMS to 100 here.  Otherwise the miicv_inqdbl() function
219  * will return bogus values for these ICV properties.
220  */
221 #define MI_MAX_IMGDIMS 100
222 
223 /* NetCDF standard attributes */
224 #define MIunits       "units"
225 #define MIlong_name   "long_name"
226 #define MIvalid_range "valid_range"
227 #define MIvalid_max   "valid_max"
228 #define MIvalid_min   "valid_min"
229 #define MI_FillValue  "_FillValue"
230 #define MItitle       "title"
231 #define MIhistory     "history"
232 
233 /* General variable attributes */
234 #define MIvartype  "vartype"
235 #define MIvarid    "varid"
236 #define MIsigntype "signtype"
237 #define MIparent   "parent"
238 #define MIchildren "children"
239 #define MIcomments "comments"
240 #define MIversion  "version"
241 
242 /* General attribute constants */
243 /*    Prefix for identifying a variable attribute pointer */
244 #define MI_VARATT_POINTER_PREFIX "--->"
245 /*    Separator for elements of MIchildren */
246 #define MI_CHILD_SEPARATOR "\n"
247 /*    MIvartype values */
248 #define MI_GROUP     "group________"
249 #define MI_DIMENSION "dimension____"
250 #define MI_DIM_WIDTH "dim-width____"
251 #define MI_VARATT    "var_attribute"
252 /*    MIvarid value */
253 #define MI_STDVAR "MINC standard variable"
254 /*    MIsigntype values */
255 #define MI_SIGNED   "signed__"
256 #define MI_UNSIGNED "unsigned"
257 /*    MIversion value */
258 #define MI_VERSION_1_0 "MINC Version    1.0"
259 #define MI_CURRENT_VERSION MI_VERSION_1_0
260 /* Generally useful values for boolean attributes */
261 #define MI_TRUE  "true_"
262 #define MI_FALSE "false"
263 
264 /* Dimension names and names of associated variables */
265 #define MIxspace           "xspace"
266 #define MIyspace           "yspace"
267 #define MIzspace           "zspace"
268 #define MItime             "time"
269 #define MItfrequency       "tfrequency"
270 #define MIxfrequency       "xfrequency"
271 #define MIyfrequency       "yfrequency"
272 #define MIzfrequency       "zfrequency"
273 #define MIvector_dimension "vector_dimension"
274 #define MIxspace_width     "xspace-width"
275 #define MIyspace_width     "yspace-width"
276 #define MIzspace_width     "zspace-width"
277 #define MItime_width       "time-width"
278 #define MItfrequency_width "tfrequency-width"
279 #define MIxfrequency_width "xfrequency-width"
280 #define MIyfrequency_width "yfrequency-width"
281 #define MIzfrequency_width "zfrequency-width"
282 
283 /* Dimension variable attribute names */
284 /* For dimension variables (MIspacing is also for dimension width vars) */
285 #define MIspacing           "spacing"
286 #define MIstep              "step"
287 #define MIstart             "start"
288 #define MIspacetype         "spacetype"
289 #define MIalignment         "alignment"
290 #define MIdirection_cosines "direction_cosines"
291 /* For dimension width variables */
292 #define MIwidth             "width"
293 #define MIfiltertype        "filtertype"
294 
295 /* Dimension attribute constants */
296 /*    MIgridtype values */
297 #define MI_REGULAR   "regular__"
298 #define MI_IRREGULAR "irregular"
299 /*    MIspacetype values */
300 #define MI_NATIVE    "native____"
301 #define MI_TALAIRACH "talairach_"
302 #define MI_CALLOSAL  "callosal__"
303 /*    MIalignment values */
304 #define MI_START  "start_"
305 #define MI_CENTRE "centre"
306 #define MI_END    "end___"
307 #define MI_CENTER MI_CENTRE
308 /*    MIfiltertype values */
309 #define MI_SQUARE     "square____"
310 #define MI_GAUSSIAN   "gaussian__"
311 #define MI_TRIANGULAR "triangular"
312 
313 /* The root variable */
314 #define MIrootvariable "rootvariable"
315 
316 /* The image variable and its attributes */
317 #define MIimage    "image"
318 #define MIimagemax "image-max"
319 #define MIimagemin "image-min"
320 #define MIcomplete "complete"
321 
322 /* The patient variable and its attributes */
323 #define MIpatient        "patient"
324 #define MIfull_name      "full_name"
325 #define MIother_names    "other_names"
326 #define MIidentification "identification"
327 #define MIother_ids      "other_ids"
328 #define MIbirthdate      "birthdate"
329 #define MIsex            "sex"
330 #define MIage            "age"
331 #define MIweight         "weight"
332 #define MIsize           "size"
333 #define MIaddress        "address"
334 #define MIinsurance_id   "insurance_id"
335 
336 /* Patient attribute constants */
337 #define MI_MALE   "male__"
338 #define MI_FEMALE "female"
339 #define MI_OTHER  "other_"
340 
341 /* The study variable and its attributes */
342 #define MIstudy               "study"
343 #define MIstart_time          "start_time"
344 #define MIstart_year          "start_year"
345 #define MIstart_month         "start_month"
346 #define MIstart_day           "start_day"
347 #define MIstart_hour          "start_hour"
348 #define MIstart_minute        "start_minute"
349 #define MIstart_seconds       "start_seconds"
350 #define MImodality            "modality"
351 #define MImanufacturer        "manufacturer"
352 #define MIdevice_model        "device_model"
353 #define MIinstitution         "institution"
354 #define MIdepartment          "department"
355 #define MIstation_id          "station_id"
356 #define MIreferring_physician "referring_physician"
357 #define MIattending_physician "attending_physician"
358 #define MIradiologist         "radiologist"
359 #define MIoperator            "operator"
360 #define MIadmitting_diagnosis "admitting_diagnosis"
361 #define MIprocedure           "procedure"
362 #define MIstudy_id            "study_id"
363 
364 /* Study attribute constants */
365 #define MI_PET   "PET__"
366 #define MI_SPECT "SPECT"
367 #define MI_GAMMA "GAMMA"
368 #define MI_MRI   "MRI__"
369 #define MI_MRS   "MRS__"
370 #define MI_MRA   "MRA__"
371 #define MI_CT    "CT___"
372 #define MI_DSA   "DSA__"
373 #define MI_DR    "DR___"
374 #define MI_LABEL "label"
375 
376 /* The acquisition variable and its attributes */
377 #define MIacquisition           "acquisition"
378 #define MIprotocol              "protocol"
379 #define MIscanning_sequence     "scanning_sequence"
380 #define MIrepetition_time       "repetition_time"
381 #define MIecho_time             "echo_time"
382 #define MIinversion_time        "inversion_time"
383 #define MInum_averages          "num_averages"
384 #define MIimaging_frequency     "imaging_frequency"
385 #define MIimaged_nucleus        "imaged_nucleus"
386 #define MIradionuclide          "radionuclide"
387 #define MIcontrast_agent        "contrast_agent"
388 #define MIradionuclide_halflife "radionuclide_halflife"
389 #define MItracer                "tracer"
390 #define MIinjection_time        "injection_time"
391 #define MIinjection_year        "injection_year"
392 #define MIinjection_month       "injection_month"
393 #define MIinjection_day         "injection_day"
394 #define MIinjection_hour        "injection_hour"
395 #define MIinjection_minute      "injection_minute"
396 #define MIinjection_seconds     "injection_seconds"
397 #define MIinjection_length      "injection_length"
398 #define MIinjection_dose        "injection_dose"
399 #define MIdose_units            "dose_units"
400 #define MIinjection_volume      "injection_volume"
401 #define MIinjection_route       "injection_route"
402 
403 /* Constants for image conversion variable (icv) properties */
404 /* Maximum number of icv's allowed */
405 /* changed to 32 as netcdf 4.x no longer defines MAX_NC_OPEN */
406 /* #define MI_MAX_NUM_ICV MAX_NC_OPEN */
407 #define MI_MAX_NUM_ICV 32
408 
409 /* Default max and min for normalization */
410 #define MI_DEFAULT_MAX 1.0
411 #define MI_DEFAULT_MIN 0.0
412 /* For converting data type */
413 #define MI_ICV_TYPE             1
414 #define MI_ICV_SIGN             2
415 #define MI_ICV_DO_RANGE         3
416 #define MI_ICV_VALID_MAX        4
417 #define MI_ICV_VALID_MIN        5
418 /* For doing normalization */
419 #define MI_ICV_DO_NORM          6
420 #define MI_ICV_USER_NORM        7
421 #define MI_ICV_IMAGE_MAX        8
422 #define MI_ICV_IMAGE_MIN        9
423 /* Values actually used in normalization - read-only */
424 #define MI_ICV_NORM_MAX        10
425 #define MI_ICV_NORM_MIN        11
426 /* For doing dimension conversions */
427 #define MI_ICV_DO_DIM_CONV     12
428 /* For converting vector fields to scalar */
429 #define MI_ICV_DO_SCALAR       13
430 /* For flipping axis direction */
431 #define MI_ICV_XDIM_DIR        14
432 #define MI_ICV_YDIM_DIR        15
433 #define MI_ICV_ZDIM_DIR        16
434 /* For changing size of first two dimensions (excluding MIvector_dimension) */
435 #define MI_ICV_ADIM_SIZE       17
436 #define MI_ICV_BDIM_SIZE       18
437 #define MI_ICV_KEEP_ASPECT     19
438 /* The pixel size and location of first two dimensions (these are readonly) */
439 #define MI_ICV_ADIM_STEP       20
440 #define MI_ICV_BDIM_STEP       21
441 #define MI_ICV_ADIM_START      22
442 #define MI_ICV_BDIM_START      23
443 /* Number of image dimensions for dimension conversion */
444 #define MI_ICV_NUM_IMGDIMS     24
445 /* Number of dimensions of image variable taking into account vector/scalar
446    data (read-only property) */
447 #define MI_ICV_NUM_DIMS        25
448 /* Id of file and image variable (read-only properties) */
449 #define MI_ICV_CDFID           26
450 #define MI_ICV_VARID           27
451 /* Names of MIimagemax and MIimagemin variables */
452 #define MI_ICV_MAXVAR          28
453 #define MI_ICV_MINVAR          29
454 /* For setting input values to a specified fillvalue */
455 #define MI_ICV_DO_FILLVALUE    30
456 #define MI_ICV_FILLVALUE       31
457 /* Image dimension properties. For each dimension, add the dimension
458    number (counting from fastest to slowest). */
459 #define MI_ICV_DIM_SIZE        1000
460 #define MI_ICV_DIM_STEP        1100
461 #define MI_ICV_DIM_START       1200
462 
463 /* Constants that can be used as values for the above properties. */
464 /* Possible values for MI_ICV_?DIM_DIR */
465 #define MI_ICV_POSITIVE         1
466 #define MI_ICV_NEGATIVE       (-1)
467 #define MI_ICV_ANYDIR           0
468 /* Possible value for MI_ICV_?DIM_SIZE */
469 #define MI_ICV_ANYSIZE        (-1)
470 
471 /* Error codes.
472    Note that they must not conflict with NetCDF error codes since
473    they are stored in the same global variable. */
474 #define MI_ERR_NONNUMERIC       1331  /* Non-numeric type */
475 #define MI_ERR_NONCHAR          1332  /* Non-character type */
476 #define MI_ERR_NONSCALAR        1333  /* Non-scalar attribute */
477 #define MI_ERR_BADOP            1334  /* Bad operation for MI_varaccess */
478 #define MI_ERR_NOTPOINTER       1335  /* Attribute is not a pointer */
479 #define MI_ERR_BAD_STDVAR       1336  /* Not a standard variable */
480 #define MI_ERR_BADSUFFIX        1337  /* Bad dimension width suffix */
481 #define MI_ERR_NOICV            1338  /* Out of icv slots */
482 #define MI_ERR_BADICV           1339  /* Illegal icv identifier */
483 #define MI_ERR_BADPROP          1340  /* Unknown icv property */
484 #define MI_ERR_ICVATTACHED      1341  /* Tried to modify attached icv */
485 #define MI_ERR_TOOFEWDIMS       1342  /* Too few dimensions to be an image */
486 #define MI_ERR_ICVNOTATTACHED   1343  /* Tried to access an unattached icv */
487 #define MI_ERR_DIMSIZE          1344  /* Dimensions differ in size */
488 #define MI_ERR_ICV_INVCOORDS    1345  /* Invalid icv coordinates */
489 #define MI_ERR_WRONGNDIMS       1346  /* Too many dimensions for a dim var */
490 #define MI_ERR_BADMATCH         1347  /* Variables do not match for copy */
491 #define MI_ERR_MAXMIN_DIMS      1348  /* Imagemax/min variables vary over
492                                          image dimensions */
493 #define MI_ERR_UNCOMPRESS       1349  /* Not able to uncompress file */
494 
495 /* MINC public functions */
496 
497 /* From netcdf_convenience.c */
498 MNCAPI char *miexpand_file(char *path, char *tempfile,
499                            int header_only, int *created_tempfile);
500 MNCAPI int miopen(char *path, int mode);
501 MNCAPI int micreate(char *path, int cmode);
502 MNCAPI int miclose(int cdfid);
503 MNCAPI int miattget_with_sign(int cdfid, int varid, char *name,
504                               char *insign, nc_type datatype, char *outsign,
505                               int max_length, void *value, int *att_length);
506 MNCAPI int miattget(int cdfid, int varid, char *name, nc_type datatype,
507                     int max_length, void *value, int *att_length);
508 MNCAPI int miattget1(int cdfid, int varid, char *name, nc_type datatype,
509                      void *value);
510 MNCAPI char *miattgetstr(int cdfid, int varid, char *name,
511                          int maxlen, char *value);
512 MNCAPI int miattputint(int cdfid, int varid, char *name, int value);
513 MNCAPI int miattputdbl(int cdfid, int varid, char *name, double value);
514 MNCAPI int miattputstr(int cdfid, int varid, char *name, char *value);
515 MNCAPI int mivarget(int cdfid, int varid, long start[], long count[],
516                     nc_type datatype, char *sign, void *values);
517 MNCAPI int mivarget1(int cdfid, int varid, long mindex[],
518                      nc_type datatype, char *sign, void *value);
519 MNCAPI int mivarput(int cdfid, int varid, long start[], long count[],
520                     nc_type datatype, char *sign, void *values);
521 MNCAPI int mivarput1(int cdfid, int varid, long mindex[],
522                      nc_type datatype, char *sign, void *value);
523 MNCAPI long *miset_coords(int nvals, long value, long coords[]);
524 MNCAPI long *mitranslate_coords(int cdfid,
525                                 int invar,  long incoords[],
526                                 int outvar, long outcoords[]);
527 MNCAPI int micopy_all_atts(int incdfid, int invarid,
528                            int outcdfid, int outvarid);
529 MNCAPI int micopy_var_def(int incdfid, int invarid, int outcdfid);
530 MNCAPI int micopy_var_values(int incdfid, int invarid,
531                              int outcdfid, int outvarid);
532 MNCAPI int micopy_all_var_defs(int incdfid, int outcdfid, int nexclude,
533                                int excluded_vars[]);
534 MNCAPI int micopy_all_var_values(int incdfid, int outcdfid, int nexclude,
535                                  int excluded_vars[]);
536 MNCAPI char *micreate_tempfile(void);
537 
538 /* From minc_convenience.c */
539 MNCAPI int miget_datatype(int cdfid, int imgid,
540                           nc_type *datatype, int *is_signed);
541 MNCAPI int miget_default_range(nc_type datatype, int is_signed,
542                                double default_range[]);
543 MNCAPI int miget_valid_range(int cdfid, int imgid, double valid_range[]);
544 MNCAPI int miset_valid_range(int cdfid, int imgid, double valid_range[]);
545 MNCAPI int miget_image_range(int cdfid, double image_range[]);
546 MNCAPI int mivar_exists(int cdfid, char *varname);
547 MNCAPI int miattput_pointer(int cdfid, int varid, char *name, int ptrvarid);
548 MNCAPI int miattget_pointer(int cdfid, int varid, char *name);
549 MNCAPI int miadd_child(int cdfid, int parent_varid, int child_varid);
550 MNCAPI int micreate_std_variable(int cdfid, char *name, nc_type datatype,
551                                  int ndims, int dim[]);
552 MNCAPI int micreate_group_variable(int cdfid, char *name);
553 MNCAPI const char *miget_version(void);
554 MNCAPI int miappend_history(int fd, const char *tm_stamp);
555 MNCAPI int micreate_ident(char * id_str, size_t length);
556 
557 /* From image_conversion.c */
558 MNCAPI int miicv_create(void);
559 MNCAPI int miicv_free(int icvid);
560 MNCAPI int miicv_setdbl(int icvid, int icv_property, double value);
561 MNCAPI int miicv_setint(int icvid, int icv_property, int value);
562 MNCAPI int miicv_setlong(int icvid, int icv_property, long value);
563 MNCAPI int miicv_setstr(int icvid, int icv_property, char *value);
564 MNCAPI int miicv_inqdbl(int icvid, int icv_property, double *value);
565 MNCAPI int miicv_inqint(int icvid, int icv_property, int *value);
566 MNCAPI int miicv_inqlong(int icvid, int icv_property, long *value);
567 MNCAPI int miicv_inqstr(int icvid, int icv_property, char *value);
568 MNCAPI int miicv_ndattach(int icvid, int cdfid, int varid);
569 MNCAPI int miicv_detach(int icvid);
570 MNCAPI int miicv_get(int icvid, long start[], long count[], void *values);
571 MNCAPI int miicv_put(int icvid, long start[], long count[], void *values);
572 
573 /* From dim_conversion.c */
574 MNCAPI int miicv_attach(int icvid, int cdfid, int varid);
575 
576 /* From minc_error.c */
577 MNCAPI void milog_init(const char *);
578 MNCAPI int milog_set_verbosity(int);
579 
580 /* default voxel loop buffer size */
581 #define MI2_DEF_BUFF_SIZE 4096
582 #define MI2_DEF_MAX_MEM 104857
583 
584 #if MINC2
585 
586 /* New functions, not directly part of compatibility layer. */
587 extern int MI2varsize(int fd, int varid, long *size_ptr);
588 
589 #define MI2_GRPNAME "/minc-2.0"
590 /* These must not interfere with any NC_ flags we might have to support. */
591 #define MI2_CREATE_V2 0x1000    /* Force V2 format */
592 #define MI2_CREATE_V1 0x2000    /* Force V1 format */
593 
594 /* Possible compression type values. */
595 #define MI2_COMP_UNKNOWN (-1)
596 #define MI2_COMP_NONE 0
597 #define MI2_COMP_ZLIB 1
598 
599 #define MI2_CHUNK_UNKNOWN (-1)
600 #define MI2_CHUNK_OFF 0
601 #define MI2_CHUNK_ON 1
602 #define MI2_CHUNK_MIN_SIZE 4
603 
604 #define MI2_OPTS_V1 1
605 
606 struct mi2opts {
607     int struct_version;
608     int comp_type;
609     int comp_param;
610     int chunk_type;
611     int chunk_param;
612 };
613 
614 #define MI2_ISH5OBJ(x) (H5Iget_type(x) > 0)
615 
616 #else
617 #define MI2_ISH5OBJ(x) (0)
618 #endif /* MINC2 */
619 
620 #ifdef __cplusplus
621 }
622 #endif /* __cplusplus */
623 
624 /* End ifndef MINC_HEADER_FILE */
625 #endif
626