00001 /************************************************************************** 00002 00003 Rayburst Sampling Algorithm 00004 This code is used to cast rays inside a 3D volumetric dataset. 00005 00006 Copyright (C) 2006 Computational Neurobiology and Imaging Center 00007 Mount Sinani School of Medicine, New York NY 00008 www.mssm.edu/cnic 00009 00010 Software Development: Douglas Ehlenberger and Alfredo Rodriguez 00011 00012 This program is free software; you can redistribute it and/or modify 00013 it under the terms of the GNU General Public License as published by 00014 the Free Software Foundation; either version 2 of the License, or 00015 (at your option) any later version. 00016 00017 This program is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License along 00023 with this program; if not, write to the Free Software Foundation, Inc., 00024 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00025 00026 Please send any questions or comments to douglas.ehlenberger@mssm.edu 00027 00028 00029 To compute diameter of tubular structure, call srb_run_2d(). 00030 To compute surface area and volume call srb_run_3d(). 00031 00032 The SRBPARAMS structure contains the following input members: 00033 unsigned char *image; //pointer to volume data in row major order (one byte per voxel.) 00034 int image_width; //width of data set or number of voxels in x dimension. 00035 int image_height; //height of dataset or number of voxels in y dimension. 00036 int image_length; //length of dataset or number of voxels in z dimension. 00037 double voxel_width; //physical dimension of voxel (possibly in microns) along x. 00038 double voxel_height; //physical dimension of voxel (possibly in microns) along y. 00039 double voxel_length; //physical dimension of voxel (possibly in microns) along z. 00040 double threshold; //intensity value used to identify boundary of structure 00041 double origin_x; //position along x, in physical coordinates, where Rayburst is run. 00042 double origin_y; //position along y, in physical coordinates, where Rayburst is run. 00043 double origin_z; //position along z, in physical coordinates, where Rayburst is run. 00044 double fit_percent; //amount of change (volume for 3d, area for 2d) to converge. 00045 int max_iterations; //number of subdivisions in surface (3d) or perimeter (2d). 00046 00047 The srb_run3d() routine returns the volume and surface area of the Rayburst as part 00048 of the SRBMESH structure. This structure has the following members: 00049 00050 int vertex_count; //number of vertices used to approximate surface 00051 double *vertices; //pointer to xyz triplets with physical coordinates of all vertices. 00052 int triangle_count; //number of triagles used to approximate surface 00053 int *triangles; //pointer to array of indices into vertices array to define triangles. 00054 double volume; //computed volume of Rayburst. 00055 double surface_area; //computed surface area of Rayburst. 00056 00057 The srb_run2d() routine returns the area and tubular diameter of the Rayburst as part 00058 of the SRBFAN structure. This structure has the following members: 00059 00060 int vertex_count; //number of vertices used to approximate fan. 00061 double *vertices; //pointer to xyz triplets with physical coordinates of all vertices. 00062 double diameter; //computed tubular diameter of Rayburst. 00063 double area; //computed 2-dimensional area of Rayburst. 00064 00065 The srb_mesh_destroy() and srb_fan_destroy() free allocated memory associated 00066 with each structure. 00067 00068 ***************************************************************************/ 00069 00070 #ifndef __SRB_H__ 00071 #define __SRB_H__ 00072 00073 00074 #include <stdlib.h> 00075 #include <math.h> 00076 00077 00078 typedef struct _SRBMESH 00079 { 00080 int vertex_count; 00081 double *vertices; 00082 int triangle_count; 00083 int *triangles; 00084 double volume; 00085 double surface_area; 00086 } 00087 SRBMESH; 00088 00089 00090 typedef struct _SRBFAN 00091 { 00092 int vertex_count; 00093 double *vertices; 00094 double diameter; 00095 double area; 00096 } 00097 SRBFAN; 00098 00099 00100 typedef struct _SRBPARAMS 00101 { 00102 unsigned char *image; 00103 int image_width; 00104 int image_height; 00105 int image_length; 00106 double voxel_width; 00107 double voxel_height; 00108 double voxel_length; 00109 double threshold; 00110 double origin_x; 00111 double origin_y; 00112 double origin_z; 00113 double fit_percent; 00114 int max_iterations; 00115 } 00116 SRBPARAMS; 00117 00118 00119 SRBMESH* srb_run_3d( SRBPARAMS* ); 00120 SRBFAN* srb_run_2d( SRBPARAMS* ); 00121 00122 void srb_mesh_destroy( SRBMESH* ); 00123 void srb_fan_destroy( SRBFAN* ); 00124 00125 00126 #endif/* __SRB_H__ */
1.4.7