Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

obj_defs.h

Go to the documentation of this file.
00001 #ifndef DEF_OBJECT_DEFS 00002 #define DEF_OBJECT_DEFS 00003 00004 /* ---------------------------------------------------------------------------- 00005 @COPYRIGHT : 00006 Copyright 1993,1994,1995 David MacDonald, 00007 McConnell Brain Imaging Centre, 00008 Montreal Neurological Institute, McGill University. 00009 Permission to use, copy, modify, and distribute this 00010 software and its documentation for any purpose and without 00011 fee is hereby granted, provided that the above copyright 00012 notice appear in all copies. The author and McGill University 00013 make no representations about the suitability of this 00014 software for any purpose. It is provided "as is" without 00015 express or implied warranty. 00016 ---------------------------------------------------------------------------- */ 00017 00018 00019 #include <volume_io.h> 00020 #include <bicpl/stack.h> 00021 #include <bicpl/bintree.h> 00022 00023 #define SET_OBJECT_SIZE( object, n, size ) \ 00024 { \ 00025 if( (n) == 0 ) \ 00026 (object).end_indices[0] = (size); \ 00027 else \ 00028 (object).end_indices[n] = (size) + \ 00029 (object).end_indices[(n)-1]; \ 00030 } 00031 00032 #define GET_OBJECT_SIZE( object, n ) \ 00033 ( ((n) == 0) ? (object).end_indices[0] : \ 00034 ((object).end_indices[n] - \ 00035 (object).end_indices[(n)-1]) ) 00036 00037 #define NUMBER_INDICES( object ) \ 00038 ( ((object).n_items == 0) ? 0 : \ 00039 (object).end_indices[(object).n_items-1] ) 00040 00041 #define START_INDEX( end_indices, n ) \ 00042 ( ((n) == 0) ? 0 : (end_indices)[(n)-1] ) 00043 00044 #define POINT_INDEX( end_indices, n, edge ) \ 00045 ( START_INDEX(end_indices,n) + (edge) ) 00046 00047 00053 typedef enum { ONE_COLOUR, PER_ITEM_COLOURS, PER_VERTEX_COLOURS } Colour_flags; 00054 00055 00059 typedef struct 00060 { 00061 Colour_flags colour_flag; 00062 Colour *colours; 00063 float line_thickness; 00064 00065 int n_points; 00066 Point *points; 00067 00068 int n_items; 00069 int *end_indices; 00070 int *indices; 00071 00072 bintree_struct_ptr bintree; 00073 } lines_struct; 00074 00075 00076 00077 typedef enum { BOX_MARKER, SPHERE_MARKER, 00078 N_MARKER_TYPES } Marker_types; 00079 00083 typedef struct 00084 { 00085 Marker_types type; 00086 Colour colour; 00087 Point position; 00088 Real size; 00089 STRING label; 00090 int structure_id; 00091 int patient_id; 00092 } marker_struct; 00093 00094 #define MAX_POINTS_PER_POLYGON 20 00095 #define MAX_POLYGON_NEIGHBOURS 2048 00096 00097 00101 typedef struct 00102 { 00105 Colour_flags colour_flag; 00106 Colour *colours; 00107 Surfprop surfprop; 00108 float line_thickness; 00109 00112 int n_points; 00113 Point *points; 00114 Vector *normals; 00115 00123 int n_items; 00124 int *end_indices; 00125 int *indices; 00126 00127 Smallest_int *visibilities; 00128 int *neighbours; 00129 bintree_struct_ptr bintree; 00130 } polygons_struct; 00131 00132 00137 typedef struct 00138 { 00139 Colour_flags colour_flag; 00140 Colour *colours; 00141 Surfprop surfprop; 00142 00146 BOOLEAN m_closed, n_closed; 00147 00150 int m, n; 00151 Point *points; 00152 Vector *normals; 00153 00154 bintree_struct_ptr bintree; 00155 } quadmesh_struct; 00156 00157 typedef enum { FIXED_FONT, SIZED_FONT } Font_types; 00158 00159 00163 typedef struct 00164 { 00165 Point origin; 00166 Colour colour; 00167 Font_types font; 00168 Real size; 00169 STRING string; 00170 } text_struct; 00171 00172 00173 typedef enum { 00174 COLOUR_INDEX_8BIT_PIXEL, COLOUR_INDEX_16BIT_PIXEL, RGB_PIXEL 00175 } Pixel_types; 00176 00177 00181 typedef struct 00182 { 00183 int x_position; 00184 int y_position; 00185 int x_size; 00186 int y_size; 00187 Real x_zoom; 00188 Real y_zoom; 00189 Pixel_types pixel_type; 00190 union 00191 { 00192 unsigned char *pixels_8bit_colour_index; 00193 unsigned short *pixels_16bit_colour_index; 00194 Colour *pixels_rgb; 00195 } data; 00196 00197 } pixels_struct; 00198 00199 #define PIXEL_COLOUR_INDEX_8( pixels, x, y ) \ 00200 ((pixels).data.pixels_8bit_colour_index[IJ(y,x,(pixels).x_size)]) 00201 00202 #define PIXEL_COLOUR_INDEX_16( pixels, x, y ) \ 00203 ((pixels).data.pixels_16bit_colour_index[IJ(y,x,(pixels).x_size)]) 00204 00205 #define PIXEL_RGB_COLOUR( pixels, x, y ) \ 00206 ((pixels).data.pixels_rgb[IJ(y,x,(pixels).x_size)]) 00207 00208 /* ------------------------------------------------------------------------ */ 00209 00210 typedef enum { LINES, MARKER, MODEL, PIXELS, POLYGONS, QUADMESH, TEXT, 00211 N_OBJECT_TYPES } Object_types; 00212 00213 00219 typedef struct 00220 { 00221 STRING filename; 00222 int n_objects; 00223 struct object_struct **objects; 00224 void *extra_ptr; 00225 } model_struct; 00226 00227 00231 typedef struct object_struct 00232 { 00233 Object_types object_type; 00234 BOOLEAN visibility; 00235 00236 union 00237 { 00238 lines_struct lines; 00239 marker_struct marker; 00240 model_struct model; 00241 pixels_struct pixels; 00242 polygons_struct polygons; 00243 quadmesh_struct quadmesh; 00244 text_struct text; 00245 } specific; 00246 00247 } object_struct; 00248 00249 00253 typedef struct 00254 { 00255 int index; 00256 int n_objects; 00257 object_struct **object_list; 00258 } object_stack_struct; 00259 00260 #define MAX_OBJECT_TRAVERSE 100 00261 00262 00266 typedef struct 00267 { 00268 BOOLEAN visible_ones_only; 00269 int n_stack_alloced; 00270 int top_of_stack; 00271 object_stack_struct *stack; 00272 object_stack_struct static_stack[MAX_OBJECT_TRAVERSE]; 00273 object_stack_struct *alloced_stack; 00274 } object_traverse_struct; 00275 00276 #endif

Generated on Wed Jul 28 09:10:57 2004 for BICPL by doxygen 1.3.7