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

scan_markers.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.h> 00017 00018 #ifndef lint 00019 static char rcsid[] = "$Header: /software/source//libraries/bicpl/Volumes/scan_markers.c,v 1.7 2000/02/05 21:27:28 stever Exp $"; 00020 #endif 00021 00022 /* ----------------------------- MNI Header ----------------------------------- 00023 @NAME : scan_marker_to_voxels 00024 @INPUT : marker 00025 volume 00026 label_volume 00027 label 00028 @OUTPUT : 00029 @RETURNS : 00030 @DESCRIPTION: Scans a marker to a label volume. Simply treats the marker 00031 as a rectangular box. 00032 @METHOD : 00033 @GLOBALS : 00034 @CALLS : 00035 @CREATED : 1993 David MacDonald 00036 @MODIFIED : 00037 ---------------------------------------------------------------------------- */ 00038 00039 public void scan_marker_to_voxels( 00040 marker_struct *marker, 00041 Volume volume, 00042 Volume label_volume, 00043 int label ) 00044 { 00045 Real low[N_DIMENSIONS], high[N_DIMENSIONS]; 00046 int min_voxel[N_DIMENSIONS], max_voxel[N_DIMENSIONS]; 00047 Real voxel[N_DIMENSIONS], min_v, max_v; 00048 int c, int_voxel[N_DIMENSIONS]; 00049 00050 convert_world_to_voxel( volume, 00051 (Real) Point_x(marker->position) - (Real) marker->size, 00052 (Real) Point_y(marker->position) - (Real) marker->size, 00053 (Real) Point_z(marker->position) - (Real) marker->size, 00054 low ); 00055 00056 convert_world_to_voxel( volume, 00057 (Real) Point_x(marker->position) + (Real) marker->size, 00058 (Real) Point_y(marker->position) + (Real) marker->size, 00059 (Real) Point_z(marker->position) + (Real) marker->size, 00060 high ); 00061 00062 for_less( c, 0, N_DIMENSIONS ) 00063 { 00064 min_v = MIN( low[c], high[c] ); 00065 max_v = MAX( low[c], high[c] ); 00066 00067 min_voxel[c] = FLOOR( min_v + 0.5 ); 00068 max_voxel[c] = FLOOR( max_v + 0.5 ); 00069 } 00070 00071 for_inclusive( int_voxel[X], min_voxel[X], max_voxel[X] ) 00072 { 00073 for_inclusive( int_voxel[Y], min_voxel[Y], max_voxel[Y] ) 00074 { 00075 for_inclusive( int_voxel[Z], min_voxel[Z], max_voxel[Z] ) 00076 { 00077 convert_int_to_real_voxel( N_DIMENSIONS, int_voxel, voxel ); 00078 if( voxel_is_within_volume( volume, voxel ) ) 00079 { 00080 set_volume_label_data( label_volume, int_voxel, label ); 00081 } 00082 } 00083 } 00084 } 00085 }

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