Commit aab9901f authored by Thomas White's avatar Thomas White Committed by Thomas White
Browse files

Make find_projected_peaks() behave like find_intersections()

Also make sure output_intensities() deals only with integration
parent 91ffa38f
......@@ -168,7 +168,6 @@ static void add_image(void *args, int cookie)
image.flags = NULL;
image.indexed_cell = NULL;
image.filename = pargs->filename;
image.reflections = NULL;
image.det = NULL;
STATUS("%3i: Processing '%s'\n", cookie, pargs->filename);
......
......@@ -218,7 +218,6 @@ static void sum_image(void *pg, int cookie)
image.flags = NULL;
image.indexed_cell = NULL;
image.filename = apargs->filename;
image.reflections = NULL;
image.det = pargs->det;
STATUS("Processing '%s'\n", apargs->filename);
......
......@@ -65,7 +65,6 @@ struct image {
struct detector *det;
struct beam_params *beam; /* The nominal beam parameters */
char *filename;
RefList *reflections;
int id; /* ID number of the thread
* handling this image */
......@@ -86,6 +85,10 @@ struct image {
int width;
int height;
/* Reflections (used for scaling ONLY) */
RefList *reflections;
/* Detected peaks */
ImageFeatureList *features;
};
......
......@@ -38,6 +38,7 @@
#include "thread-pool.h"
#include "beam-parameters.h"
#include "symmetry.h"
#include "geometry.h"
enum {
......@@ -262,9 +263,6 @@ static struct image *get_simage(struct image *template, int alternate)
image->indexed_cell = template->indexed_cell;
image->f0 = template->f0;
/* Prevent muppetry */
image->reflections = NULL;
return image;
}
......@@ -325,7 +323,6 @@ static void process_image(void *pp, int cookie)
image.indexed_cell = NULL;
image.id = cookie;
image.filename = filename;
image.reflections = NULL;
image.det = pargs->static_args.det;
STATUS("Processing '%s'\n", image.filename);
......@@ -397,11 +394,22 @@ static void process_image(void *pp, int cookie)
/* Measure intensities if requested */
if ( config_nearbragg ) {
output_intensities(&image, image.indexed_cell,
RefList *reflections;
//reflections = find_intersections(&image, image.indexed_cell,
// 0);
reflections = find_projected_peaks(&image, image.indexed_cell,
0, 0.1);
output_intensities(&image, image.indexed_cell, reflections,
pargs->static_args.output_mutex,
config_polar,
pargs->static_args.config_closer,
pargs->static_args.ofh, 0, 0.1);
pargs->static_args.ofh);
reflist_free(reflections);
}
simage = get_simage(&image, config_alternate);
......@@ -432,7 +440,6 @@ done:
free(image.data);
free(image.flags);
image_feature_list_free(image.features);
reflist_free(image.reflections);
hdfile_close(hdfile);
}
......
......@@ -564,10 +564,17 @@ int main(int argc, char *argv[])
record_image(&image, !config_nonoise);
if ( config_nearbragg ) {
find_projected_peaks(&image, cell, 0, 0.1);
output_intensities(&image, cell, NULL, 0, 0, stdout,
0, 0.1);
reflist_free(image.reflections);
RefList *reflections;
reflections = find_projected_peaks(&image, cell,
0, 0.1);
output_intensities(&image, cell, reflections, NULL,
0, 0, stdout);
reflist_free(reflections);
}
if ( powder_fn != NULL ) {
......
......@@ -473,8 +473,8 @@ void dump_peaks(struct image *image, FILE *ofh, pthread_mutex_t *mutex)
}
int find_projected_peaks(struct image *image, UnitCell *cell,
int circular_domain, double domain_r)
RefList *find_projected_peaks(struct image *image, UnitCell *cell,
int circular_domain, double domain_r)
{
int x, y;
double ax, ay, az;
......@@ -550,9 +550,7 @@ int find_projected_peaks(struct image *image, UnitCell *cell,
optimise_reflist(reflections);
STATUS("Found %i reflections\n", n_reflections);
image->reflections = reflections;
return n_reflections;
return reflections;
}
......@@ -664,9 +662,8 @@ static void output_header(FILE *ofh, UnitCell *cell, struct image *image)
void output_intensities(struct image *image, UnitCell *cell,
pthread_mutex_t *mutex, int polar,
int use_closer, FILE *ofh,
int circular_domain, double domain_r)
RefList *reflections, pthread_mutex_t *mutex, int polar,
int use_closer, FILE *ofh)
{
double asx, asy, asz;
double bsx, bsy, bsz;
......@@ -674,10 +671,6 @@ void output_intensities(struct image *image, UnitCell *cell,
Reflection *refl;
RefListIterator *iter;
if ( image->reflections == NULL ) {
find_projected_peaks(image, cell, circular_domain, domain_r);
}
/* Get exclusive access to the output stream if necessary */
if ( mutex != NULL ) pthread_mutex_lock(mutex);
......@@ -687,7 +680,7 @@ void output_intensities(struct image *image, UnitCell *cell,
&bsx, &bsy, &bsz,
&csx, &csy, &csz);
for ( refl = first_refl(image->reflections, &iter);
for ( refl = first_refl(reflections, &iter);
refl != NULL;
refl = next_refl(refl, iter) ) {
......@@ -768,7 +761,7 @@ void output_intensities(struct image *image, UnitCell *cell,
/* Write h,k,l, integrated intensity and centroid coordinates */
get_indices(refl, &h, &k, &l);
fprintf(ofh, "%3i %3i %3i %6f (at %5.2f,%5.2f) max=%6f bg=%6f\n",
h, l, l, intensity, x, y, max, bg);
h, k, l, intensity, x, y, max, bg);
}
......
......@@ -19,14 +19,16 @@
#include <pthread.h>
#include "reflist.h"
extern void search_peaks(struct image *image, float threshold,
float min_gradient);
extern void dump_peaks(struct image *image, FILE *ofh, pthread_mutex_t *mutex);
extern void output_intensities(struct image *image, UnitCell *cell,
RefList *reflections,
pthread_mutex_t *mutex, int polar,
int use_closer, FILE *ofh, int circular_domain,
double domain_r);
int use_closer, FILE *ofh);
extern void output_pixels(struct image *image, UnitCell *cell,
pthread_mutex_t *mutex, int do_polar,
......@@ -34,8 +36,8 @@ extern void output_pixels(struct image *image, UnitCell *cell,
extern int peak_sanity_check(struct image *image, UnitCell *cell,
int circular_domain, double domain_r);
extern int find_projected_peaks(struct image *image, UnitCell *cell,
int circular_domain, double domain_r);
extern RefList *find_projected_peaks(struct image *image, UnitCell *cell,
int circular_domain, double domain_r);
extern int integrate_peak(struct image *image, int xp, int yp,
float *xc, float *yc, float *intensity,
double *pbg, double *pmax,
......
......@@ -110,7 +110,6 @@ static void process_image(void *pg, int cookie)
image.flags = NULL;
image.indexed_cell = NULL;
image.filename = apargs->filename;
image.reflections = NULL;
image.det = pargs->det;
STATUS("Processing '%s'\n", apargs->filename);
......@@ -137,9 +136,18 @@ static void process_image(void *pg, int cookie)
} else {
output_intensities(&image, apargs->cell,
pargs->output_mutex, pargs->config_polar,
pargs->config_closer, pargs->ofh, 0, 0.1);
RefList *reflections;
reflections = find_projected_peaks(&image, image.indexed_cell,
0, 0.1);
output_intensities(&image, image.indexed_cell, reflections,
pargs->output_mutex,
pargs->config_polar,
pargs->config_closer,
pargs->ofh);
reflist_free(reflections);
}
free(image.data);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment