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

col_code_points.c

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- 00002 @COPYRIGHT : 00003 Copyright 1993,1994,1995 David MacDonald, 00004 McConnell Brain Imaging Centre, 00005 Montreal Neurological Institute, McGill University. 00006 Permission to use, copy, modify, and distribute this 00007 software and its documentation for any purpose and without 00008 fee is hereby granted, provided that the above copyright 00009 notice appear in all copies. The author and McGill University 00010 make no representations about the suitability of this 00011 software for any purpose. It is provided "as is" without 00012 express or implied warranty. 00013 ---------------------------------------------------------------------------- */ 00014 00015 #include <volume_io/internal_volume_io.h> 00016 #include <bicpl/vols.h> 00017 00018 #ifndef lint 00019 static char rcsid[] = "$Header: /software/source//libraries/bicpl/Volumes/col_code_points.c,v 1.8 2000/02/06 15:30:53 stever Exp $"; 00020 #endif 00021 00022 /* ----------------------------- MNI Header ----------------------------------- 00023 @NAME : colour_code_points 00024 @INPUT : colour_coding 00025 volume 00026 continuity 00027 n_points 00028 points 00029 @OUTPUT : colour_flag 00030 colours 00031 @RETURNS : 00032 @DESCRIPTION: Colour codes the points according to the associated value in the 00033 volume. Adjust the colour_flag and reallocs the colours as 00034 necessary. 00035 @METHOD : 00036 @GLOBALS : 00037 @CALLS : 00038 @CREATED : 1993 David MacDonald 00039 @MODIFIED : 00040 ---------------------------------------------------------------------------- */ 00041 00042 private void colour_code_points( 00043 colour_coding_struct *colour_coding, 00044 Volume volume, 00045 int continuity, 00046 Colour_flags *colour_flag, 00047 Colour *colours[], 00048 int n_points, 00049 Point points[] ) 00050 { 00051 int i; 00052 Real val; 00053 00054 if( *colour_flag != PER_VERTEX_COLOURS ) 00055 { 00056 if( n_points > 0 ) 00057 { 00058 REALLOC( *colours, n_points ); 00059 } 00060 else 00061 { 00062 FREE( *colours ); 00063 } 00064 *colour_flag = PER_VERTEX_COLOURS; 00065 } 00066 00067 for_less( i, 0, n_points ) 00068 { 00069 (void) evaluate_volume_in_world( volume, 00070 (Real) Point_x(points[i]), 00071 (Real) Point_y(points[i]), 00072 (Real) Point_z(points[i]), continuity, FALSE, 00073 get_volume_real_min(volume), 00074 &val, (Real *) NULL, 00075 (Real *) NULL, (Real *) NULL, 00076 (Real *) NULL, (Real *) NULL, 00077 (Real *) NULL, (Real *) NULL, 00078 (Real *) NULL, (Real *) NULL ); 00079 00080 (*colours)[i] = get_colour_code( colour_coding, val ); 00081 } 00082 } 00083 00084 /* ----------------------------- MNI Header ----------------------------------- 00085 @NAME : colour_code_object 00086 @INPUT : volume 00087 continuity 00088 colour_coding 00089 @OUTPUT : object 00090 @RETURNS : 00091 @DESCRIPTION: Colour codes an object, modifying its per-vertex colours. 00092 @METHOD : 00093 @GLOBALS : 00094 @CALLS : 00095 @CREATED : 1993 David MacDonald 00096 @MODIFIED : 00097 ---------------------------------------------------------------------------- */ 00098 00099 public void colour_code_object( 00100 Volume volume, 00101 int continuity, 00102 colour_coding_struct *colour_coding, 00103 object_struct *object ) 00104 { 00105 polygons_struct *polygons; 00106 quadmesh_struct *quadmesh; 00107 lines_struct *lines; 00108 00109 switch( object->object_type ) 00110 { 00111 case POLYGONS: 00112 polygons = get_polygons_ptr( object ); 00113 colour_code_points( colour_coding, volume, continuity, 00114 &polygons->colour_flag, &polygons->colours, 00115 polygons->n_points, polygons->points ); 00116 break; 00117 00118 case QUADMESH: 00119 quadmesh = get_quadmesh_ptr( object ); 00120 colour_code_points( colour_coding, volume, continuity, 00121 &quadmesh->colour_flag, &quadmesh->colours, 00122 quadmesh->m * quadmesh->n, 00123 quadmesh->points ); 00124 break; 00125 00126 case LINES: 00127 lines = get_lines_ptr( object ); 00128 colour_code_points( colour_coding, volume, continuity, 00129 &lines->colour_flag, &lines->colours, 00130 lines->n_points, lines->points ); 00131 break; 00132 default: 00133 print_error( "colour_code_object: object type %d not handled.\n", 00134 object->object_type ); 00135 } 00136 }

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