1 /* ----------------------------- MNI Header -----------------------------------
2 @NAME       : mincreshape.h
3 @DESCRIPTION: Header file for mincreshape.c
4 @METHOD     :
5 @GLOBALS    :
6 @CALLS      :
7 @CREATED    : March 11, 1994 (Peter Neelin)
8 @MODIFIED   :
9  * $Log: mincreshape.h,v $
10  * Revision 6.5  2008-01-13 09:38:54  stever
11  * Avoid compiler warnings about functions and variables that are defined
12  * but not used.  Remove some such functions and variables,
13  * conditionalize some, and move static declarations out of header files
14  * into C files.
15  *
16  * Revision 6.4  2004/11/01 22:38:39  bert
17  * Eliminate all references to minc_def.h
18  *
19  * Revision 6.3  2001/12/06 14:12:45  neelin
20  * Trivial change to definition of NCOPTS_DEFAULT.
21  *
22  * Revision 6.2  1999/10/19 14:45:29  neelin
23  * Fixed Log subsitutions for CVS
24  *
25  * Revision 6.1  1998/08/19 13:57:50  neelin
26  * Added ARG_SEPARATOR to replace string literal for comma.
27  *
28  * Revision 6.0  1997/09/12  13:24:12  neelin
29  * Release of minc version 0.6
30  *
31  * Revision 5.0  1997/08/21  13:25:10  neelin
32  * Release of minc version 0.5
33  *
34  * Revision 4.0  1997/05/07  20:01:44  neelin
35  * Release of minc version 0.4
36  *
37  * Revision 3.0  1995/05/15  19:32:36  neelin
38  * Release of minc version 0.3
39  *
40  * Revision 1.3  1994/12/02  09:08:57  neelin
41  * Moved nd_loop to proglib.
42  *
43  * Revision 1.2  94/11/23  11:47:08  neelin
44  * Handle image-min/max properly when using icv for normalization.
45  *
46  * Revision 1.1  94/11/02  16:22:00  neelin
47  * Initial revision
48  *
49 @COPYRIGHT  :
50               Copyright 1993 Peter Neelin, McConnell Brain Imaging Centre,
51               Montreal Neurological Institute, McGill University.
52               Permission to use, copy, modify, and distribute this
53               software and its documentation for any purpose and without
54               fee is hereby granted, provided that the above copyright
55               notice appear in all copies.  The author and McGill University
56               make no representations about the suitability of this
57               software for any purpose.  It is provided "as is" without
58               express or implied warranty.
59 ---------------------------------------------------------------------------- */
60 
61 /* Constants used in program */
62 #define NOFILL DBL_MAX   /* Fillvalue indicating -nofill */
63 #define FILL -DBL_MAX    /* Fillvalue for -fill */
64 #define NCOPTS_DEFAULT (NC_VERBOSE | NC_FATAL)
65 #define DEFAULT_MAX_CHUNK_SIZE_IN_KB (1024*4)
66 #define DIM_WIDTH_SUFFIX "-width"
67 #define ARG_SEPARATOR ','
68 #define VECTOR_SEPARATOR ','
69 #ifndef TRUE
70 #  define TRUE 1
71 #  define FALSE 0
72 #endif
73 
74 /* Types used in program */
75 
76 typedef struct {
77    int verbose;
78    int icvid, inmincid, outmincid, outimgid;
79    nc_type output_datatype;
80    int output_is_signed;
81    int input_ndims;                  /* Number of input dimensions */
82    int output_ndims;                 /* Number of output dimensions */
83    long input_size[MAX_VAR_DIMS];    /* Size of input volume */
84    long input_start[MAX_VAR_DIMS];   /* Start of desired hyperslab */
85    long input_count[MAX_VAR_DIMS];   /* Size of desired hyperslab
86                                         (<0 means 1 and remove dimension) */
87    int map_out_to_in[MAX_VAR_DIMS];  /* Map output dimension index to input */
88    int map_in_to_out[MAX_VAR_DIMS];  /* Map input dimension index to output
89                                         (-1 means no mapping) */
90    int dim_used_in_block[MAX_VAR_DIMS]; /* TRUE if output dim used in block */
91    int chunk_count[MAX_VAR_DIMS];    /* Specifies count for chunk hyperslab */
92    int need_fillvalue;               /* TRUE if we will need a fill value */
93    double fillvalue;                 /* Value to fill with (FILL_DEFAULT
94                                         means fill with real value zero) */
95    int do_block_normalization;       /* Normalize slices to block max/min */
96    int do_icv_normalization;         /* Use icv for normalization */
97 
98    /* Note that a block is a hyperslab of the output volume in which all
99       values are normalized the same way. A chunk is a hyperslab that is
100       copied in one piece (smaller than or equal to a block). */
101 
102 } Reshape_info;
103 
104 typedef struct {
105    int nentries;
106    char *name[MAX_VAR_DIMS];
107    long size[MAX_VAR_DIMS];
108 } Dimsize_list;
109 
110 typedef struct {
111    int nentries;
112    char *name[MAX_VAR_DIMS];
113    long start[MAX_VAR_DIMS];
114    long count[MAX_VAR_DIMS];
115 } Axis_ranges;
116 
117 /* Macros used in program */
118 #define ISSPACE(ch) (isspace((int)ch))
119 #define ABS(x) (((x) >= 0) ? (x) : (-(x)))
120 #define  MAX( x, y )  ( ((x) >= (y)) ? (x) : (y) )
121 #define  MIN( x, y )  ( ((x) <= (y)) ? (x) : (y) )
122 
123 /* Function prototypes */
124 extern void copy_data(Reshape_info *reshape_info);
125