45 if ( bins < 256 ) bins = 256;
46 if ( bins > 1024 ) bins = 1024;
52 case UShort: avg = USHRT_MAX/2; std = 256;
break;
53 case Short: avg = 0; std = 256;
break;
54 case UInteger: avg = 100000; std = 1000;
break;
55 case Integer: avg = 0; std = 1000;
break;
56 case ULong: avg = 100000; std = 1000;
break;
57 case Long: avg = 0; std = 1000;
break;
58 default: avg = 0; std = 1;
break;
65 cout <<
"Mass normalizing ";
68 cout <<
"Normalizing type: ";
69 switch ( norm_type ) {
70 case 1: cout <<
"Gaussian";
break;
71 case 2: cout <<
"Poisson";
break;
72 default: cout <<
"Simple";
74 cout << endl <<
"Average and standard deviation: " << avg <<
" " << std << endl;
78 dispatch_queue_t myq = dispatch_queue_create(NULL, NULL);
79 dispatch_apply(p->
images(), dispatch_get_global_queue(0, 0), ^(
size_t n){
83 cout <<
"Image " << n <<
" normalized" << endl;
87 #pragma omp parallel for
88 for (
int n=0; n<p->
images(); n++ ) {
93 cout <<
"Image " << n <<
" normalized" << endl;
112 switch ( norm_type ) {
void change_type(char letter)
Get the data type indicated by a single letter code.
int img_rescale_to_avg_std(Bimage *p, double avg, double std)
Rescales the image data to a given average and standard deviation.
int replace(Bimage *img)
Replaces the data with that from the given image.
Header file for image utilities.
Header file for general utilities.
Header file for image utilities.
double average(unsigned long cc, double xf, double yf, double zf, unsigned long nn, double iscale)
Averages in the xy plane when scaling is less than 1.
size_t statistics()
Calculates the statistics for an image.
General image parameter class.
void file_name(Bstring s)
int img_calculate_background(Bimage *p, int n)
Calculates the background for one sub-image.
float * img_fit_poisson_to_histogram(Bimage *p, int bins)
double standard_deviation()
Header file for manipulating image backgrounds.
int img_mass_normalize_subimage(Bimage *p, int imgnum, float avg, float std, int norm_type, int bins)
float * img_fit_gauss_to_histogram(Bimage *p, int bins, int n)
int img_truncate_to_min_max(Bimage *p, double min, double max)
Truncates image data to a given minimum and maximum.
Header file for 2D and 3D image I/O.
Bimage * extract(unsigned long nn)
Extracts one sub-image into new image structure.
int img_mass_normalize(Bimage *p, float avg, float std, int norm_type)
Normalizes a set of images to a desired average and standard deviation.