Alternaria
fit cylinders and ellipsoids to fungus
|
View an Alternaria_model in an OpenGL environment. More...
#include <config.h>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <inttypes.h>
#include <jwsc/math/constants.h>
#include <jwsc/vector/vector.h>
#include <jwsc/vector/vector_math.h>
#include <jwsc/matrix/matrix.h>
#include <jwsc/matrix/matrix_math.h>
#include <jwsc/image/image.h>
#include <jwsc/image/image_io.h>
#include <jwsc/imgblock/imgblock.h>
#include <jwsc/imgblock/imgblock_io.h>
#include <jwsc/imgblock/surface.h>
#include <jwsc++/base/option.h>
#include <jwsc++/base/exception.h>
#include <jwsc++/graphics/camera.h>
#include "imaging_model.h"
#include "psf_model.h"
#include "structure.h"
#include "spore.h"
#include "hypha.h"
#include "alternaria_model.h"
Go to the source code of this file.
Classes | |
struct | Alternaria_viewer_modes |
Modes the viewer can be in. More... | |
Defines | |
#define | REDBLUE 1 |
#define | REDGREEN 2 |
#define | REDCYAN 3 |
#define | BLUERED 4 |
#define | GREENRED 5 |
#define | CYANRED 6 |
#define | VIEW_WIDTH 800 |
#define | VIEW_HEIGHT 800 |
#define | APERTURE 60.0f |
#define | CLIP_NEAR 10.0f |
#define | CLIP_FAR 3000.0f |
#define | GLASSES_TYPE REDCYAN |
#define | CAPTURE_FMT "capture-%04u.tiff" |
#define | MODEL_COMPARE_FNAME 0 |
#define | SURF_COMPARE_FNAME 0 |
#define | SURF_PATCH_SIZE 2.0 |
#define | OBJECT_SCALE 1.0 |
#define | CENTROID_MIN -5000.0f |
#define | CENTROID_MAX 5000.0f |
#define | LENGTH_MU 40.0f |
#define | LENGTH_SIGMA 4.0f |
#define | LENGTH_MIN 1.f |
#define | LENGTH_MAX 1000.0f |
#define | WIDTH_MU 15.0f |
#define | WIDTH_SIGMA 1.0f |
#define | WIDTH_MIN 1.0f |
#define | WIDTH_MAX 1000.0f |
#define | DWIDTH_SIGMA 0.05f |
#define | DWIDTH_MIN -100.0f |
#define | DWIDTH_MAX 100.0f |
#define | THETA_MU 0 |
#define | THETA_SIGMA 0.2f |
#define | THETA_MIN 0 |
#define | THETA_MAX JWSC_PI |
#define | PSI_MIN -JWSC_PI |
#define | PSI_MAX JWSC_PI |
#define | OPACITY_MU 0.9f |
#define | OPACITY_SIGMA 0.2f |
#define | OPACITY_MIN 0.0f |
#define | OPACITY_MAX 1.0f |
#define | DIST_MU 0.5f |
#define | DIST_SIGMA 0.1f |
#define | DIST_MIN 0 |
#define | DIST_MAX 1.0f |
Functions | |
void | init_modes () |
Initialize the viewer modes. | |
void | init_camera () throw (Arg_error) |
Initializes the camera to default values. | |
void | clean_up () |
Cleans up the program to prepare for exit. | |
void | reset () |
Resets the state of the viewer. | |
void | render_world_axis () |
Renders the 3D world axis. | |
void | render_focal_plane () |
Renders the focal plane. | |
void | render_model_compare () |
Renders the Alternaria model to compare with. | |
void | render_surface_compare () |
Renders the surface of an Alternaria to compare with. | |
void | render_scene () |
Renders the scene into the viewer. | |
void | display_glut_anaglyph () |
Display the model as an anaglyph (3D stereo pair). | |
void | display_glut_regular () |
Display the model under normal conditions. | |
void | display_glut () |
Display callback for the GLUT library. | |
void | reshape_glut (int w, int h) |
Reshape callback for the GLUT library. | |
void | keyboard_glut (unsigned char key, int a, int b) |
Keyboard callback for the GLUT library. | |
void | mouse_glut (int button, int state, int x, int y) |
Mouse callback for the GLUT library. | |
void | main_menu_glut (int id) |
Main menu callback for the GLUT library. | |
void | option_menu_glut (int id) |
Option submenu callback for the GLUT library. | |
void | navigation_menu_glut (int id) |
Keyboard navigation submenu callback for the GLUT library. | |
void | focal_length_menu_glut (int id) |
Focal length submenu callback for the GLUT library. | |
void | clipping_menu_glut (int id) |
Clipping plane submenu callback for the GLUT library. | |
void | init_glut (int argc, char **argv) |
Initializes the GLUT to default values. | |
void | init_gl () |
Initializes the GL to default values. | |
void | print_usage (void) |
Prints the usage of the program. | |
void | process_help_opt (void) |
Processes the 'help' program options. | |
void | process_version_opt (void) |
Processes the 'version' program options. | |
void | process_view_size_opt (const char *arg) throw (Arg_error) |
Processes the 'view-size' program options. | |
void | process_glasses_opt (const char *arg) throw (Arg_error) |
Processes the 'glasses' program options. | |
void | process_capture_opt (const char *arg) throw (Arg_error) |
Processes the 'capture' program options. | |
void | process_surf_compare_opt (const char *arg) throw (Arg_error) |
Processes the 'surf-compare' program options. | |
void | process_surf_scale_opt (const char *arg) throw (Arg_error) |
Processes the 'surf-scale' program options. | |
void | process_patch_size_opt (const char *arg) throw (Arg_error) |
Processes the 'patch-size' program options. | |
void | process_model_compare_opt (const char *arg) throw (Arg_error) |
Processes the 'model-compare' program options. | |
void | init_options () |
Initialize the options. | |
void | init_densities () |
Initializes the density parameters. | |
void | read_model_compare () throw (Exception) |
Reads the Alternaria model to compare, if there is one. | |
void | read_surface_compare () throw (Exception) |
Reads the Alternaria surface to compare, if there is one. | |
int | main (int argc, char **argv) |
Main function for alternaria_viewer. | |
Variables | |
Options * | opts = 0 |
Program options. | |
uint32_t | view_width = VIEW_WIDTH |
Width of the viewing window. | |
uint32_t | view_height = VIEW_HEIGHT |
Height of the viewing window. | |
float | aperture = APERTURE |
Viewing aperture. | |
float | clip_near = CLIP_NEAR |
Near clipping plane. | |
float | clip_far = CLIP_FAR |
Far clipping plane. | |
int | glasses_type = GLASSES_TYPE |
Anaglyph glasses type. | |
const char * | capture_fmt = CAPTURE_FMT |
Printf-formatted file to write captured view images to. | |
const char * | model_compare_fname = MODEL_COMPARE_FNAME |
Name of the model file to compare Alternaria models with. | |
const char * | surface_compare_fname = SURF_COMPARE_FNAME |
Name of the surface file to compare Alternaria models with. | |
float | object_scale = OBJECT_SCALE |
Scale of the objects. | |
Stereo_camera_f * | camera = 0 |
3D viewing camera. | |
GLUquadric * | quad_fill = 0 |
Filled quadric. | |
GLUquadric * | quad_wire = 0 |
Wire-frame quadric. | |
PSF_model * | psf = 0 |
PSF_model to test. | |
Alternaria * | alternaria = 0 |
Alternaria to test. | |
Alternaria * | model_compare = 0 |
Alternaria model to compare with. | |
list< Surface_patch_f * > * | surface_compare = 0 |
Alternaria surface to compare with. | |
Imaging_scale * | surface_scale = 0 |
Number of world unit coordinates per image pixel. | |
float | surface_patch_size = SURF_PATCH_SIZE |
Size of the patch representing each surface point. | |
Imaging_model_density * | imaging_d = 0 |
Imaging_model density. | |
PSF_model_density * | psf_d = 0 |
PSF_model density. | |
Apical_hypha_density * | apical_hypha_d = 0 |
Apical_hypha density. | |
Lateral_hypha_density * | lateral_hypha_d = 0 |
Lateral_hypha density. | |
Spore_density * | spore_d = 0 |
Spore density. | |
Alternaria_density * | alt_d = 0 |
Alternaria density. | |
Structure * | highlight = 0 |
Pointer to the currently selected Structure in alternaria to modify. | |
struct Alternaria_viewer_modes | modes |
View an Alternaria_model in an OpenGL environment.
Definition in file alternaria_viewer.cpp.
#define REDBLUE 1 |
Definition at line 96 of file alternaria_viewer.cpp.
#define REDGREEN 2 |
Definition at line 97 of file alternaria_viewer.cpp.
#define REDCYAN 3 |
Definition at line 98 of file alternaria_viewer.cpp.
#define BLUERED 4 |
Definition at line 99 of file alternaria_viewer.cpp.
#define GREENRED 5 |
Definition at line 100 of file alternaria_viewer.cpp.
#define CYANRED 6 |
Definition at line 101 of file alternaria_viewer.cpp.
#define VIEW_WIDTH 800 |
Definition at line 104 of file alternaria_viewer.cpp.
#define VIEW_HEIGHT 800 |
Definition at line 105 of file alternaria_viewer.cpp.
#define APERTURE 60.0f |
Definition at line 106 of file alternaria_viewer.cpp.
#define CLIP_NEAR 10.0f |
Definition at line 107 of file alternaria_viewer.cpp.
#define CLIP_FAR 3000.0f |
Definition at line 108 of file alternaria_viewer.cpp.
#define GLASSES_TYPE REDCYAN |
Definition at line 109 of file alternaria_viewer.cpp.
#define CAPTURE_FMT "capture-%04u.tiff" |
Definition at line 110 of file alternaria_viewer.cpp.
#define MODEL_COMPARE_FNAME 0 |
Definition at line 111 of file alternaria_viewer.cpp.
#define SURF_COMPARE_FNAME 0 |
Definition at line 112 of file alternaria_viewer.cpp.
#define SURF_PATCH_SIZE 2.0 |
Definition at line 113 of file alternaria_viewer.cpp.
#define OBJECT_SCALE 1.0 |
Definition at line 114 of file alternaria_viewer.cpp.
#define CENTROID_MIN -5000.0f |
Definition at line 116 of file alternaria_viewer.cpp.
#define CENTROID_MAX 5000.0f |
Definition at line 117 of file alternaria_viewer.cpp.
#define LENGTH_MU 40.0f |
Definition at line 118 of file alternaria_viewer.cpp.
#define LENGTH_SIGMA 4.0f |
Definition at line 119 of file alternaria_viewer.cpp.
#define LENGTH_MIN 1.f |
Definition at line 120 of file alternaria_viewer.cpp.
#define LENGTH_MAX 1000.0f |
Definition at line 121 of file alternaria_viewer.cpp.
#define WIDTH_MU 15.0f |
Definition at line 122 of file alternaria_viewer.cpp.
#define WIDTH_SIGMA 1.0f |
Definition at line 123 of file alternaria_viewer.cpp.
#define WIDTH_MIN 1.0f |
Definition at line 124 of file alternaria_viewer.cpp.
#define WIDTH_MAX 1000.0f |
Definition at line 125 of file alternaria_viewer.cpp.
#define DWIDTH_SIGMA 0.05f |
Definition at line 126 of file alternaria_viewer.cpp.
#define DWIDTH_MIN -100.0f |
Definition at line 127 of file alternaria_viewer.cpp.
#define DWIDTH_MAX 100.0f |
Definition at line 128 of file alternaria_viewer.cpp.
#define THETA_MU 0 |
Definition at line 129 of file alternaria_viewer.cpp.
#define THETA_SIGMA 0.2f |
Definition at line 130 of file alternaria_viewer.cpp.
#define THETA_MIN 0 |
Definition at line 131 of file alternaria_viewer.cpp.
#define THETA_MAX JWSC_PI |
Definition at line 132 of file alternaria_viewer.cpp.
#define PSI_MIN -JWSC_PI |
Definition at line 133 of file alternaria_viewer.cpp.
#define PSI_MAX JWSC_PI |
Definition at line 134 of file alternaria_viewer.cpp.
#define OPACITY_MU 0.9f |
Definition at line 135 of file alternaria_viewer.cpp.
#define OPACITY_SIGMA 0.2f |
Definition at line 136 of file alternaria_viewer.cpp.
#define OPACITY_MIN 0.0f |
Definition at line 137 of file alternaria_viewer.cpp.
#define OPACITY_MAX 1.0f |
Definition at line 138 of file alternaria_viewer.cpp.
#define DIST_MU 0.5f |
Definition at line 139 of file alternaria_viewer.cpp.
#define DIST_SIGMA 0.1f |
Definition at line 140 of file alternaria_viewer.cpp.
#define DIST_MIN 0 |
Definition at line 141 of file alternaria_viewer.cpp.
#define DIST_MAX 1.0f |
Definition at line 142 of file alternaria_viewer.cpp.
void init_modes | ( | ) |
Initialize the viewer modes.
Definition at line 284 of file alternaria_viewer.cpp.
void init_camera | ( | ) | throw (Arg_error) |
Initializes the camera to default values.
Definition at line 298 of file alternaria_viewer.cpp.
void clean_up | ( | ) |
Cleans up the program to prepare for exit.
Used to check for memory leaks.
Definition at line 319 of file alternaria_viewer.cpp.
void reset | ( | ) |
Resets the state of the viewer.
Definition at line 348 of file alternaria_viewer.cpp.
void render_world_axis | ( | ) |
Renders the 3D world axis.
Definition at line 358 of file alternaria_viewer.cpp.
void render_focal_plane | ( | ) |
Renders the focal plane.
Definition at line 409 of file alternaria_viewer.cpp.
void render_model_compare | ( | ) |
Renders the Alternaria model to compare with.
Definition at line 459 of file alternaria_viewer.cpp.
void render_surface_compare | ( | ) |
Renders the surface of an Alternaria to compare with.
Definition at line 471 of file alternaria_viewer.cpp.
void render_scene | ( | ) |
Renders the scene into the viewer.
Definition at line 518 of file alternaria_viewer.cpp.
void display_glut_anaglyph | ( | ) |
Display the model as an anaglyph (3D stereo pair).
Reset the color mask.
Definition at line 548 of file alternaria_viewer.cpp.
void display_glut_regular | ( | ) |
Display the model under normal conditions.
Definition at line 653 of file alternaria_viewer.cpp.
void display_glut | ( | ) |
Display callback for the GLUT library.
Definition at line 686 of file alternaria_viewer.cpp.
void reshape_glut | ( | int | w, |
int | h | ||
) |
Reshape callback for the GLUT library.
Definition at line 709 of file alternaria_viewer.cpp.
void keyboard_glut | ( | unsigned char | key, |
int | a, | ||
int | b | ||
) |
Keyboard callback for the GLUT library.
Definition at line 718 of file alternaria_viewer.cpp.
void mouse_glut | ( | int | button, |
int | state, | ||
int | x, | ||
int | y | ||
) |
Mouse callback for the GLUT library.
Definition at line 995 of file alternaria_viewer.cpp.
void main_menu_glut | ( | int | id | ) |
Main menu callback for the GLUT library.
Definition at line 1050 of file alternaria_viewer.cpp.
void option_menu_glut | ( | int | id | ) |
Option submenu callback for the GLUT library.
Definition at line 1068 of file alternaria_viewer.cpp.
void navigation_menu_glut | ( | int | id | ) |
Keyboard navigation submenu callback for the GLUT library.
Definition at line 1088 of file alternaria_viewer.cpp.
void focal_length_menu_glut | ( | int | id | ) |
Focal length submenu callback for the GLUT library.
Definition at line 1108 of file alternaria_viewer.cpp.
void clipping_menu_glut | ( | int | id | ) |
Clipping plane submenu callback for the GLUT library.
Definition at line 1124 of file alternaria_viewer.cpp.
void init_glut | ( | int | argc, |
char ** | argv | ||
) |
Initializes the GLUT to default values.
Definition at line 1138 of file alternaria_viewer.cpp.
void init_gl | ( | ) |
Initializes the GL to default values.
Definition at line 1181 of file alternaria_viewer.cpp.
void print_usage | ( | void | ) |
Prints the usage of the program.
Definition at line 1245 of file alternaria_viewer.cpp.
void process_help_opt | ( | void | ) |
Processes the 'help' program options.
Definition at line 1253 of file alternaria_viewer.cpp.
void process_version_opt | ( | void | ) |
Processes the 'version' program options.
Definition at line 1260 of file alternaria_viewer.cpp.
void process_view_size_opt | ( | const char * | arg | ) | throw (Arg_error) |
Processes the 'view-size' program options.
Definition at line 1267 of file alternaria_viewer.cpp.
void process_glasses_opt | ( | const char * | arg | ) | throw (Arg_error) |
Processes the 'glasses' program options.
Definition at line 1288 of file alternaria_viewer.cpp.
void process_capture_opt | ( | const char * | arg | ) | throw (Arg_error) |
Processes the 'capture' program options.
Definition at line 1313 of file alternaria_viewer.cpp.
void process_surf_compare_opt | ( | const char * | arg | ) | throw (Arg_error) |
Processes the 'surf-compare' program options.
Definition at line 1323 of file alternaria_viewer.cpp.
void process_surf_scale_opt | ( | const char * | arg | ) | throw (Arg_error) |
Processes the 'surf-scale' program options.
Definition at line 1333 of file alternaria_viewer.cpp.
void process_patch_size_opt | ( | const char * | arg | ) | throw (Arg_error) |
Processes the 'patch-size' program options.
Definition at line 1358 of file alternaria_viewer.cpp.
void process_model_compare_opt | ( | const char * | arg | ) | throw (Arg_error) |
Processes the 'model-compare' program options.
Definition at line 1371 of file alternaria_viewer.cpp.
void init_options | ( | ) |
Initialize the options.
Definition at line 1381 of file alternaria_viewer.cpp.
void init_densities | ( | ) |
Initializes the density parameters.
Definition at line 1430 of file alternaria_viewer.cpp.
void read_model_compare | ( | ) | throw (Exception) |
Reads the Alternaria model to compare, if there is one.
Definition at line 1464 of file alternaria_viewer.cpp.
void read_surface_compare | ( | ) | throw (Exception) |
Reads the Alternaria surface to compare, if there is one.
Definition at line 1479 of file alternaria_viewer.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
Main function for alternaria_viewer.
Definition at line 1526 of file alternaria_viewer.cpp.
Program options.
Definition at line 161 of file alternaria_viewer.cpp.
uint32_t view_width = VIEW_WIDTH |
Width of the viewing window.
Definition at line 164 of file alternaria_viewer.cpp.
uint32_t view_height = VIEW_HEIGHT |
Height of the viewing window.
Definition at line 167 of file alternaria_viewer.cpp.
float aperture = APERTURE |
Viewing aperture.
Definition at line 170 of file alternaria_viewer.cpp.
float clip_near = CLIP_NEAR |
Near clipping plane.
Definition at line 173 of file alternaria_viewer.cpp.
float clip_far = CLIP_FAR |
Far clipping plane.
Definition at line 176 of file alternaria_viewer.cpp.
int glasses_type = GLASSES_TYPE |
Anaglyph glasses type.
Definition at line 179 of file alternaria_viewer.cpp.
const char* capture_fmt = CAPTURE_FMT |
Printf-formatted file to write captured view images to.
Definition at line 182 of file alternaria_viewer.cpp.
const char* model_compare_fname = MODEL_COMPARE_FNAME |
Name of the model file to compare Alternaria models with.
Definition at line 185 of file alternaria_viewer.cpp.
const char* surface_compare_fname = SURF_COMPARE_FNAME |
Name of the surface file to compare Alternaria models with.
Definition at line 188 of file alternaria_viewer.cpp.
float object_scale = OBJECT_SCALE |
Scale of the objects.
Definition at line 191 of file alternaria_viewer.cpp.
Stereo_camera_f* camera = 0 |
3D viewing camera.
Definition at line 194 of file alternaria_viewer.cpp.
GLUquadric* quad_fill = 0 |
Filled quadric.
Definition at line 197 of file alternaria_viewer.cpp.
GLUquadric* quad_wire = 0 |
Wire-frame quadric.
Definition at line 200 of file alternaria_viewer.cpp.
PSF_model to test.
Definition at line 203 of file alternaria_viewer.cpp.
Alternaria* alternaria = 0 |
Alternaria to test.
Definition at line 206 of file alternaria_viewer.cpp.
Alternaria* model_compare = 0 |
Alternaria model to compare with.
Definition at line 209 of file alternaria_viewer.cpp.
list<Surface_patch_f*>* surface_compare = 0 |
Alternaria surface to compare with.
Definition at line 212 of file alternaria_viewer.cpp.
Number of world unit coordinates per image pixel.
Definition at line 215 of file alternaria_viewer.cpp.
float surface_patch_size = SURF_PATCH_SIZE |
Size of the patch representing each surface point.
Definition at line 218 of file alternaria_viewer.cpp.
Imaging_model density.
Definition at line 221 of file alternaria_viewer.cpp.
PSF_model_density* psf_d = 0 |
PSF_model density.
Definition at line 224 of file alternaria_viewer.cpp.
Apical_hypha density.
Definition at line 227 of file alternaria_viewer.cpp.
Lateral_hypha density.
Definition at line 230 of file alternaria_viewer.cpp.
Spore_density* spore_d = 0 |
Spore density.
Definition at line 233 of file alternaria_viewer.cpp.
Alternaria_density* alt_d = 0 |
Alternaria density.
Definition at line 236 of file alternaria_viewer.cpp.
Pointer to the currently selected Structure in alternaria to modify.
Definition at line 242 of file alternaria_viewer.cpp.
struct Alternaria_viewer_modes modes |