00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
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 }