32 unsigned long n(0), i;
42 if ( origin.x() <= 0 || origin.x() >= p->
sizeX() ) origin[0] = p->
sizeX()/2;
43 if ( origin.y() <= 0 || origin.y() >= p->
sizeY() ) origin[1] = p->
sizeY()/2;
44 if ( origin.z() <= 0 || origin.z() >= p->
sizeZ() ) origin[2] = p->
sizeZ()/2;
47 cout <<
"Finding the diffraction origin(s)" << endl;
49 for ( i=0; i<10 && d > 1; i++ ) {
50 start = origin - size/2;
56 if ( pmask ) pc->
mask(pmask, 0);
63 cout <<
"DEBUG img_diffraction_origin: " << n <<
": " << shift <<
tab << cc << endl;
64 d = (shift - oldshift).length();
69 cout <<
"Diffraction origins:\nImage\tox\toy\toz" << endl;
70 for ( n=0; n<p->
images(); n++ )
void change_type(char letter)
Get the data type indicated by a single letter code.
int edge(int type, Vector3< size_t > rect, Vector3< double > start, double width, int fill_type=0, double fill=0)
Smooths the image edge with a soft rectangular function.
Header file for image class.
Header file for general utilities.
int mask(Bimage *pmask, double fill)
Masks an image.
Generalized matrix class.
int img_diffraction_origin(Bimage *p, Bimage *pmask)
Finds the origin of a powder diffraction pattern by cross-correlation.
double average(size_t cc, double xf, double yf, double zf, size_t nn, double iscale)
Averages in the xy plane when scaling is less than 1.
Vector3< size_t > size() const
General image parameter class.
int rescale_to_avg_std(double nuavg=0, double nustd=1)
Rescales the image data to a given average and standard deviation.
void origin(double x, double y, double z)
Bimage * copy()
Copies the header information and data of an image into a new image structure.
int rotate()
Rotates an image using parameters defined in the image in place.
int find_shift(Bimage *pref, Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag)
Calculates a cross-correlation map to find the shift for the pair of images.
ostream & tab(ostream &out)
void origin(double ox, double oy, double oz)