 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
21 "Usage: bkernel [options] output.krn",
22 "-----------------------------------",
23 "Calculates filter kernels.",
24 "The default kernel just calculates the mean.",
25 "The different types of kernel are mutually exclusive.",
28 "-gaussian 1.7,8.4 Gaussian kernel with the indicated sigma and maximum.",
29 "-log 2.5,5 Laplacian of gaussian kernel with the indicated sigma and maximum.",
30 "-frequency 8,2 Frequency space kernel: width and power.",
33 "-verbose 7 Verbosity of output.",
34 "-size 5,7,9 Size of kernel (voxels).",
39 int main(
int argc,
char **argv)
52 for ( curropt = option; curropt; curropt = curropt->
next ) {
53 if ( curropt->
tag ==
"gaussian" )
54 if ( curropt->
values(sigma, max) < 1 )
55 cerr <<
"-gaussian: A sigma value must be specified!" << endl;
56 if ( curropt->
tag ==
"log" )
57 if ( curropt->
values(log_sigma, max) < 1 )
58 cerr <<
"-log: A sigma value must be specified!" << endl;
59 if ( curropt->
tag ==
"frequency" )
60 if ( curropt->
values(kernel_width, kernel_power) < 1 )
61 cerr <<
"-frequency: At least the kernel size must be specified!" << endl;
62 if ( curropt->
tag ==
"size" )
63 size = curropt->
size();
73 if ( log_sigma > 0.001 ) {
74 side = 2*( (int) (4*log_sigma + 0.9) ) + 1;
75 size = {side, side, side};
76 }
else if ( sigma > 0.001 ) {
77 side = 2*( (int) (4*sigma + 0.9) ) + 1;
78 size = {side, side, side};
79 }
else if ( kernel_width ) {
92 }
else if ( sigma > 0.001 ) {
94 }
else if ( kernel_width ) {
95 for (
long i=0; i<p->
data_size(); ++i ) p->
set(i, ker[i]);
100 if ( p && optind < argc ) {
A class for a command line input option.
void set(long j, double v)
Sets a single value at the given index.
Vector3< double > default_origin()
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Header file for frequency space interpolation kernel.
Header file for option handlers.
int main(int argc, char **argv)
long values(T1 &v1, T2 &v2)
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
General image parameter class.
Utilities for timing functions.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
int kernel_gaussian(double sigma, double max)
Generates a gaussian kernel image.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
void origin(double ox, double oy, double oz)
Header file for 2D and 3D image I/O.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
int kernel_laplacian_of_gaussian(double sigma, double max)
Generates a laplacian-of-gaussian kernel.