Alternaria
fit cylinders and ellipsoids to fungus
alternaria.cpp File Reference

Fit an Alternaria_model, PSF_model, and Imaging_model to 3D microscopic image data of Alternaria. More...

#include <config.h>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <inttypes.h>
#include <jwsc/config.h>
#include <jwsc/math/constants.h>
#include <jwsc/matblock/matblock.h>
#include <jwsc/imgblock/imgblock.h>
#include <jwsc/imgblock/imgblock_io.h>
#include <jwsc/imgblock/imgblock_util.h>
#include <jwsc++/base/exception.h>
#include <jwsc++/base/option.h>
#include "imaging_model.h"
#include "psf_model.h"
#include "structure.h"
#include "spore.h"
#include "hypha.h"
#include "alternaria_model.h"
#include "sampler.h"
#include "imaging_moves.h"
#include "psf_moves.h"
#include "alternaria_moves.h"
#include "dd_spore.h"

Go to the source code of this file.

Defines

#define SEED   2537984
#define MOVE_INFO_FNAME   "move.info"
#define BEST_INFO_FNAME   "best.info"
#define ITERATIONS   10
#define RES_IMG   1.0f
#define RES_ROW   1.0f
#define RES_COL   1.0f
#define DATA_IMGS_NAMED   false
#define IMG_IN_FNAME   0
#define IMG_OUT_FNAME   "imaging.model"
#define PSF_IN_FNAME   0
#define PSF_OUT_FNAME   "psf.model"
#define ALT_IN_FNAME   0
#define ALT_OUT_FNAME   "alternaria.model"
#define ALT_PRO_FMT   0
#define ALT_SCENE_FMT   0
#define PSF_H_FMT   0
#define BASE_LEVEL   0
#define DD_SPORES_FNAME   0

Functions

void read_data (Matblock_f **data_out, int argc, const char **argv, int argi) throw (Arg_error)
 Reads the input data images and creates a Matblock_f from them.
void init_density_centroids () throw (Arg_error)
 Initializes the Spore and Hypha densities x, y, and z.
void init_sampler_moves (Sampler *sampler) throw (Arg_error)
 Create and initize the sampler moves.
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_options_opt (const char *arg) throw (Arg_error)
 Processes the 'options' program options.
void process_move_info_opt (const char *arg) throw (Arg_error)
 Processes the 'move-info' program options.
void process_best_info_opt (const char *arg) throw (Arg_error)
 Processes the 'best-info' program options.
void process_iterations_opt (const char *arg) throw (Arg_error)
 Processes the 'threads' program options.
void process_resolution_opt (const char *arg) throw (Arg_error)
 Processes the 'resolution' program options.
void process_seed_opt (const char *arg) throw (Arg_error)
 Processes the 'seed' program options.
void process_img_in_opt (const char *arg) throw (Arg_error)
 Processes the 'img-in' program options.
void process_img_out_opt (const char *arg) throw (Arg_error)
 Processes the 'img-out' program options.
void process_psf_in_opt (const char *arg) throw (Arg_error)
 Processes the 'psf-in' program options.
void process_psf_out_opt (const char *arg) throw (Arg_error)
 Processes the 'psf-out' program options.
void process_alt_in_opt (const char *arg) throw (Arg_error)
 Processes the 'alt-in' program options.
void process_alt_out_opt (const char *arg) throw (Arg_error)
 Processes the 'alt-out' program options.
void process_alt_pro_opt (const char *arg) throw (Arg_error)
 Processes the 'alt-pro' program options.
void process_dd_spores_opt (const char *arg) throw (Arg_error)
 Processes the 'dd-spores' program options.
void process_scene_fmt_opt (const char *arg) throw (Arg_error)
 Processes the 'scene-fmt' program options.
void process_scene_scale_opt (const char *arg) throw (Arg_error)
 Processes the 'scene-scale' program options.
void process_scene_window_opt (const char *arg) throw (Arg_error)
 Processes the 'scene-window' program options.
void process_psf_fmt_opt (const char *arg) throw (Arg_error)
 Processes the 'psf_fmt' program options.
void process_apical_hypha_length_opt (const char *arg) throw (Arg_error)
 Processes the 'apical-hypha-length' program options.
void process_lateral_hypha_length_opt (const char *arg) throw (Arg_error)
 Processes the 'lateral-hypha-length' program options.
void process_apical_hypha_width_opt (const char *arg) throw (Arg_error)
 Processes the 'apical-hypha-width' program options.
void process_apical_hypha_dwidth_opt (const char *arg) throw (Arg_error)
 Processes the 'apical-hypha-dwidth' program options.
void process_lateral_hypha_width_opt (const char *arg) throw (Arg_error)
 Processes the 'lateral-hypha-width' program options.
void process_apical_hypha_theta_opt (const char *arg) throw (Arg_error)
 Processes the 'apical-hypha-theta' program options.
void process_lateral_hypha_1_theta_opt (const char *arg) throw (Arg_error)
 Processes the 'lateral-hypha-1-theta' program options.
void process_lateral_hypha_n_theta_opt (const char *arg) throw (Arg_error)
 Processes the 'lateral-hypha-n-theta' program options.
void process_hypha_psi_opt (const char *arg) throw (Arg_error)
 Processes the 'hypha-psi' program options.
void process_hypha_opacity_opt (const char *arg) throw (Arg_error)
 Processes the 'hypha-opacity' program options.
void process_lateral_hypha_dist_opt (const char *arg) throw (Arg_error)
 Processes the 'lateral-hypha-dist' program options.
void process_spore_length_opt (const char *arg) throw (Arg_error)
 Processes the 'spore-length' program options.
void process_spore_width_opt (const char *arg) throw (Arg_error)
 Processes the 'spore-width' program options.
void process_spore_theta_opt (const char *arg) throw (Arg_error)
 Processes the 'spore-theta' program options.
void process_spore_psi_opt (const char *arg) throw (Arg_error)
 Processes the 'spore-psi' program options.
void process_spore_opacity_opt (const char *arg) throw (Arg_error)
 Processes the 'spore-opacity' program options.
void process_psf_alpha_opt (const char *arg) throw (Arg_error)
 Processes the 'psf-alpha' program options.
void process_psf_beta_opt (const char *arg) throw (Arg_error)
 Processes the 'psf-beta' program options.
void process_psf_gamma_opt (const char *arg) throw (Arg_error)
 Processes the 'psf-gamma' program options.
void process_img_bg_opt (const char *arg) throw (Arg_error)
 Processes the 'img-bg' program options.
void process_levels_p_opt (const char *arg) throw (Arg_error)
 Processes the 'levels-p' program options.
void process_structs_p_opt (const char *arg) throw (Arg_error)
 Processes the 'structs-p' program options.
void process_base_level_opt (const char *arg) throw (Arg_error)
 Processes the 'base-level' program options.
void init_options ()
 Initialize the options.
void * operator new (size_t s) throw (std::bad_alloc)
void operator delete (void *ptr) throw ()
int main (int argc, char **argv)
 Main function for the alternaria program.

Variables

Optionsopts = 0
 Program options.
uint32_t seed = SEED
 Random seed.
const char * move_info_fname = MOVE_INFO_FNAME
 Move information file name.
const char * best_info_fname = BEST_INFO_FNAME
 Best move information file name.
uint32_t iterations = ITERATIONS
 Number of iterations to run the sampler.
float res_img = RES_IMG
 Resolution of number of images to down-sample the input image block data to.
float res_row = RES_ROW
 Resolution of number of rows to down-sample the input image block data to.
float res_col = RES_COL
 Resolution of number of columns to down-sample the input image block data to.
bool data_imgs_named = DATA_IMGS_NAMED
 Boolean indicating whether the input data images to read are a named sequence in argv, or a printf numbered sequence.
const char * img_in_fname = IMG_IN_FNAME
 Imaging_model file name to read from.
const char * img_out_fname = IMG_OUT_FNAME
 Imaging_model file name to write to.
const char * psf_in_fname = PSF_IN_FNAME
 PSF_model file name to read from.
const char * psf_out_fname = PSF_OUT_FNAME
 PSF_model file name to write to.
const char * alt_in_fname = ALT_IN_FNAME
 Alternaria file name to read from.
const char * alt_out_fname = ALT_OUT_FNAME
 Alternaria file name to write to.
const char * alt_pro_fmt = ALT_PRO_FMT
 Alternaria proposal formatted file name to write to.
const char * alt_scene_fmt = ALT_SCENE_FMT
 Printf formatted file name for the output Alternaria_model::scene images.
const char * psf_h_fmt = PSF_H_FMT
 Printf formatted file name for the output PSF::h images.
uint32_t base_level = BASE_LEVEL
 Base level for the root Structure.
const char * dd_spores_fname = DD_SPORES_FNAME
 Data-driven spores file name.
Imaging_windowimg_window = 0
 Imaging_model window.
Imaging_scaleimg_scale = 0
 Imaging_model scale.
PSF_paddingpadding = 0
 PSF_model padding.
Imaging_model_densityimaging_d = 0
 Imaging_model density.
PSF_model_densitypsf_d = 0
 PSF_model density.
Apical_hypha_densityapical_hypha_d = 0
 Apical_hypha density.
Lateral_hypha_densitylateral_hypha_1_d = 0
 Lateral_hypha density for level 1.
Lateral_hypha_densitylateral_hypha_n_d = 0
 Lateral_hypha density for level > 1.
Spore_densityspore_d = 0
 Spore density.
Alternaria_model_densityalt_d = 0
 Alternaria density.
bool img_window_set = false
 Boolean indicating whether the Imaging_window was set by an option.

Detailed Description

Fit an Alternaria_model, PSF_model, and Imaging_model to 3D microscopic image data of Alternaria.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Uses an MCMC sampler to fit the models.

Definition in file alternaria.cpp.


Define Documentation

#define SEED   2537984

Definition at line 278 of file alternaria.cpp.

#define MOVE_INFO_FNAME   "move.info"

Definition at line 279 of file alternaria.cpp.

#define BEST_INFO_FNAME   "best.info"

Definition at line 280 of file alternaria.cpp.

#define ITERATIONS   10

Definition at line 281 of file alternaria.cpp.

#define RES_IMG   1.0f

Definition at line 282 of file alternaria.cpp.

#define RES_ROW   1.0f

Definition at line 283 of file alternaria.cpp.

#define RES_COL   1.0f

Definition at line 284 of file alternaria.cpp.

#define DATA_IMGS_NAMED   false

Definition at line 285 of file alternaria.cpp.

#define IMG_IN_FNAME   0

Definition at line 286 of file alternaria.cpp.

#define IMG_OUT_FNAME   "imaging.model"

Definition at line 287 of file alternaria.cpp.

#define PSF_IN_FNAME   0

Definition at line 288 of file alternaria.cpp.

#define PSF_OUT_FNAME   "psf.model"

Definition at line 289 of file alternaria.cpp.

#define ALT_IN_FNAME   0

Definition at line 290 of file alternaria.cpp.

#define ALT_OUT_FNAME   "alternaria.model"

Definition at line 291 of file alternaria.cpp.

#define ALT_PRO_FMT   0

Definition at line 292 of file alternaria.cpp.

#define ALT_SCENE_FMT   0

Definition at line 293 of file alternaria.cpp.

#define PSF_H_FMT   0

Definition at line 294 of file alternaria.cpp.

#define BASE_LEVEL   0

Definition at line 295 of file alternaria.cpp.

#define DD_SPORES_FNAME   0

Definition at line 296 of file alternaria.cpp.


Function Documentation

void read_data ( Matblock_f **  data_out,
int  argc,
const char **  argv,
int  argi 
) throw (Arg_error)

Reads the input data images and creates a Matblock_f from them.

Definition at line 423 of file alternaria.cpp.

void init_density_centroids ( ) throw (Arg_error)

Initializes the Spore and Hypha densities x, y, and z.

Definition at line 482 of file alternaria.cpp.

void init_sampler_moves ( Sampler sampler) throw (Arg_error)

Create and initize the sampler moves.

Definition at line 509 of file alternaria.cpp.

void print_usage ( void  )

Prints the usage of the program.

Definition at line 535 of file alternaria.cpp.

void process_help_opt ( void  )

Processes the 'help' program options.

Definition at line 543 of file alternaria.cpp.

void process_version_opt ( void  )

Processes the 'version' program options.

Definition at line 550 of file alternaria.cpp.

void process_options_opt ( const char *  arg) throw (Arg_error)

Processes the 'options' program options.

Definition at line 557 of file alternaria.cpp.

void process_move_info_opt ( const char *  arg) throw (Arg_error)

Processes the 'move-info' program options.

Definition at line 574 of file alternaria.cpp.

void process_best_info_opt ( const char *  arg) throw (Arg_error)

Processes the 'best-info' program options.

Definition at line 584 of file alternaria.cpp.

void process_iterations_opt ( const char *  arg) throw (Arg_error)

Processes the 'threads' program options.

Processes the 'iterations' program options.

Definition at line 616 of file alternaria.cpp.

void process_resolution_opt ( const char *  arg) throw (Arg_error)

Processes the 'resolution' program options.

Definition at line 629 of file alternaria.cpp.

void process_seed_opt ( const char *  arg) throw (Arg_error)

Processes the 'seed' program options.

Definition at line 647 of file alternaria.cpp.

void process_img_in_opt ( const char *  arg) throw (Arg_error)

Processes the 'img-in' program options.

Definition at line 660 of file alternaria.cpp.

void process_img_out_opt ( const char *  arg) throw (Arg_error)

Processes the 'img-out' program options.

Definition at line 670 of file alternaria.cpp.

void process_psf_in_opt ( const char *  arg) throw (Arg_error)

Processes the 'psf-in' program options.

Definition at line 680 of file alternaria.cpp.

void process_psf_out_opt ( const char *  arg) throw (Arg_error)

Processes the 'psf-out' program options.

Definition at line 690 of file alternaria.cpp.

void process_alt_in_opt ( const char *  arg) throw (Arg_error)

Processes the 'alt-in' program options.

Definition at line 700 of file alternaria.cpp.

void process_alt_out_opt ( const char *  arg) throw (Arg_error)

Processes the 'alt-out' program options.

Definition at line 710 of file alternaria.cpp.

void process_alt_pro_opt ( const char *  arg) throw (Arg_error)

Processes the 'alt-pro' program options.

Definition at line 720 of file alternaria.cpp.

void process_dd_spores_opt ( const char *  arg) throw (Arg_error)

Processes the 'dd-spores' program options.

Definition at line 730 of file alternaria.cpp.

void process_scene_fmt_opt ( const char *  arg) throw (Arg_error)

Processes the 'scene-fmt' program options.

Definition at line 740 of file alternaria.cpp.

void process_scene_scale_opt ( const char *  arg) throw (Arg_error)

Processes the 'scene-scale' program options.

Definition at line 750 of file alternaria.cpp.

void process_scene_window_opt ( const char *  arg) throw (Arg_error)

Processes the 'scene-window' program options.

Definition at line 775 of file alternaria.cpp.

void process_psf_fmt_opt ( const char *  arg) throw (Arg_error)

Processes the 'psf_fmt' program options.

Definition at line 802 of file alternaria.cpp.

void process_apical_hypha_length_opt ( const char *  arg) throw (Arg_error)

Processes the 'apical-hypha-length' program options.

Definition at line 812 of file alternaria.cpp.

void process_lateral_hypha_length_opt ( const char *  arg) throw (Arg_error)

Processes the 'lateral-hypha-length' program options.

Definition at line 837 of file alternaria.cpp.

void process_apical_hypha_width_opt ( const char *  arg) throw (Arg_error)

Processes the 'apical-hypha-width' program options.

Definition at line 863 of file alternaria.cpp.

void process_apical_hypha_dwidth_opt ( const char *  arg) throw (Arg_error)

Processes the 'apical-hypha-dwidth' program options.

Definition at line 888 of file alternaria.cpp.

void process_lateral_hypha_width_opt ( const char *  arg) throw (Arg_error)

Processes the 'lateral-hypha-width' program options.

Definition at line 913 of file alternaria.cpp.

void process_apical_hypha_theta_opt ( const char *  arg) throw (Arg_error)

Processes the 'apical-hypha-theta' program options.

Definition at line 939 of file alternaria.cpp.

void process_lateral_hypha_1_theta_opt ( const char *  arg) throw (Arg_error)

Processes the 'lateral-hypha-1-theta' program options.

Definition at line 964 of file alternaria.cpp.

void process_lateral_hypha_n_theta_opt ( const char *  arg) throw (Arg_error)

Processes the 'lateral-hypha-n-theta' program options.

Definition at line 989 of file alternaria.cpp.

void process_hypha_psi_opt ( const char *  arg) throw (Arg_error)

Processes the 'hypha-psi' program options.

Definition at line 1014 of file alternaria.cpp.

void process_hypha_opacity_opt ( const char *  arg) throw (Arg_error)

Processes the 'hypha-opacity' program options.

Definition at line 1041 of file alternaria.cpp.

void process_lateral_hypha_dist_opt ( const char *  arg) throw (Arg_error)

Processes the 'lateral-hypha-dist' program options.

Definition at line 1068 of file alternaria.cpp.

void process_spore_length_opt ( const char *  arg) throw (Arg_error)

Processes the 'spore-length' program options.

Definition at line 1094 of file alternaria.cpp.

void process_spore_width_opt ( const char *  arg) throw (Arg_error)

Processes the 'spore-width' program options.

Definition at line 1119 of file alternaria.cpp.

void process_spore_theta_opt ( const char *  arg) throw (Arg_error)

Processes the 'spore-theta' program options.

Definition at line 1144 of file alternaria.cpp.

void process_spore_psi_opt ( const char *  arg) throw (Arg_error)

Processes the 'spore-psi' program options.

Definition at line 1169 of file alternaria.cpp.

void process_spore_opacity_opt ( const char *  arg) throw (Arg_error)

Processes the 'spore-opacity' program options.

Definition at line 1194 of file alternaria.cpp.

void process_psf_alpha_opt ( const char *  arg) throw (Arg_error)

Processes the 'psf-alpha' program options.

Definition at line 1219 of file alternaria.cpp.

void process_psf_beta_opt ( const char *  arg) throw (Arg_error)

Processes the 'psf-beta' program options.

Definition at line 1244 of file alternaria.cpp.

void process_psf_gamma_opt ( const char *  arg) throw (Arg_error)

Processes the 'psf-gamma' program options.

Definition at line 1269 of file alternaria.cpp.

void process_img_bg_opt ( const char *  arg) throw (Arg_error)

Processes the 'img-bg' program options.

Definition at line 1294 of file alternaria.cpp.

void process_levels_p_opt ( const char *  arg) throw (Arg_error)

Processes the 'levels-p' program options.

Definition at line 1319 of file alternaria.cpp.

void process_structs_p_opt ( const char *  arg) throw (Arg_error)

Processes the 'structs-p' program options.

Definition at line 1344 of file alternaria.cpp.

void process_base_level_opt ( const char *  arg) throw (Arg_error)

Processes the 'base-level' program options.

Definition at line 1370 of file alternaria.cpp.

void init_options ( )

Initialize the options.

Definition at line 1383 of file alternaria.cpp.

void* operator new ( size_t  s) throw (std::bad_alloc)

Definition at line 1581 of file alternaria.cpp.

void operator delete ( void *  ptr) throw ()

Definition at line 1586 of file alternaria.cpp.

int main ( int  argc,
char **  argv 
)

Main function for the alternaria program.

Definition at line 1596 of file alternaria.cpp.


Variable Documentation

Options* opts = 0

Program options.

Definition at line 311 of file alternaria.cpp.

uint32_t seed = SEED

Random seed.

Definition at line 314 of file alternaria.cpp.

const char* move_info_fname = MOVE_INFO_FNAME

Move information file name.

Definition at line 317 of file alternaria.cpp.

const char* best_info_fname = BEST_INFO_FNAME

Best move information file name.

Definition at line 320 of file alternaria.cpp.

uint32_t iterations = ITERATIONS

Number of iterations to run the sampler.

Definition at line 323 of file alternaria.cpp.

float res_img = RES_IMG

Resolution of number of images to down-sample the input image block data to.

Definition at line 329 of file alternaria.cpp.

float res_row = RES_ROW

Resolution of number of rows to down-sample the input image block data to.

Definition at line 335 of file alternaria.cpp.

float res_col = RES_COL

Resolution of number of columns to down-sample the input image block data to.

Definition at line 341 of file alternaria.cpp.

bool data_imgs_named = DATA_IMGS_NAMED

Boolean indicating whether the input data images to read are a named sequence in argv, or a printf numbered sequence.

Definition at line 347 of file alternaria.cpp.

const char* img_in_fname = IMG_IN_FNAME

Imaging_model file name to read from.

Definition at line 350 of file alternaria.cpp.

const char* img_out_fname = IMG_OUT_FNAME

Imaging_model file name to write to.

Definition at line 353 of file alternaria.cpp.

const char* psf_in_fname = PSF_IN_FNAME

PSF_model file name to read from.

Definition at line 356 of file alternaria.cpp.

const char* psf_out_fname = PSF_OUT_FNAME

PSF_model file name to write to.

Definition at line 359 of file alternaria.cpp.

const char* alt_in_fname = ALT_IN_FNAME

Alternaria file name to read from.

Definition at line 362 of file alternaria.cpp.

const char* alt_out_fname = ALT_OUT_FNAME

Alternaria file name to write to.

Definition at line 365 of file alternaria.cpp.

const char* alt_pro_fmt = ALT_PRO_FMT

Alternaria proposal formatted file name to write to.

Definition at line 368 of file alternaria.cpp.

const char* alt_scene_fmt = ALT_SCENE_FMT

Printf formatted file name for the output Alternaria_model::scene images.

Definition at line 374 of file alternaria.cpp.

const char* psf_h_fmt = PSF_H_FMT

Printf formatted file name for the output PSF::h images.

Definition at line 377 of file alternaria.cpp.

uint32_t base_level = BASE_LEVEL

Base level for the root Structure.

Definition at line 380 of file alternaria.cpp.

const char* dd_spores_fname = DD_SPORES_FNAME

Data-driven spores file name.

Definition at line 383 of file alternaria.cpp.

Imaging_model window.

Definition at line 386 of file alternaria.cpp.

Imaging_model scale.

Definition at line 389 of file alternaria.cpp.

PSF_model padding.

Definition at line 392 of file alternaria.cpp.

Imaging_model density.

Definition at line 395 of file alternaria.cpp.

PSF_model density.

Definition at line 398 of file alternaria.cpp.

Apical_hypha density.

Definition at line 401 of file alternaria.cpp.

Lateral_hypha density for level 1.

Definition at line 404 of file alternaria.cpp.

Lateral_hypha density for level > 1.

Definition at line 407 of file alternaria.cpp.

Spore density.

Definition at line 410 of file alternaria.cpp.

Alternaria density.

Definition at line 413 of file alternaria.cpp.

bool img_window_set = false

Boolean indicating whether the Imaging_window was set by an option.

Definition at line 418 of file alternaria.cpp.