Image

Image — Data structure representing an image

Functions

Types and Values

struct image
struct beam_params
struct imagefeature
typedef ImageFeatureList
enum SpectrumType
struct sample

Includes

#include "image.h"

Description

The image structure represents an image, usually one frame from a large series of diffraction patterns, which might be from the same or different crystals.

Functions

image_add_feature ()

void
image_add_feature (ImageFeatureList *flist,
                   double x,
                   double y,
                   struct image *parent,
                   double intensity,
                   const char *name);

image_feature_closest ()

struct imagefeature *
image_feature_closest (ImageFeatureList *flist,
                       double fs,
                       double ss,
                       double *d,
                       int *idx,
                       struct detector *det);

image_reflection_closest ()

Reflection *
image_reflection_closest (RefList *rlist,
                          double fs,
                          double ss,
                          struct detector *det,
                          double *d);

image_feature_count ()

int
image_feature_count (ImageFeatureList *flist);

image_feature_list_free ()

void
image_feature_list_free (ImageFeatureList *flist);

image_feature_list_new ()

ImageFeatureList *
image_feature_list_new (void);

image_get_feature ()

struct imagefeature *
image_get_feature (ImageFeatureList *flist,
                   int idx);

image_add_crystal ()

void
image_add_crystal (struct image *image,
                   Crystal *cryst);

image_remove_feature ()

void
image_remove_feature (ImageFeatureList *flist,
                      int idx);

free_all_crystals ()

void
free_all_crystals (struct image *image);

remove_flagged_crystals ()

void
remove_flagged_crystals (struct image *image);

Types and Values

struct image

struct image {
	float                   **dp;    /* Data in panel */
	int                     **bad;   /* Bad pixels by panel */
	float                   **sat;   /* Per-pixel saturation values */

	Crystal                 **crystals;
	int                     n_crystals;
	IndexingMethod          indexed_by;

	struct detector         *det;
	struct beam_params      *beam;  /* The nominal beam parameters */
	char                    *filename;
	struct event            *event;
	const struct copy_hdf5_field *copyme;
	struct stuff_from_stream *stuff_from_stream;

	int                     id;   /* ID number of the thread
	                               * handling this image */
	int                     serial;  /* Monotonically ascending serial
	                                  * number for this image */

	struct sample           *spectrum;
	int                     nsamples; /* Number of wavelengths */
	int                     spectrum_size;  /* Size of "spectrum" */

	/* Per-shot radiation values */
	double                  lambda;        /* Wavelength in m */
	double                  div;           /* Divergence in radians */
	double                  bw;            /* Bandwidth as a fraction */

	int                     width;
	int                     height;

	/* Detected peaks */
	long long int           num_peaks;
	long long int           num_saturated_peaks;
	ImageFeatureList        *features;
};
struct image
{
   Crystal                 **crystals;
   int                     n_crystals;
   IndexingMethod          indexed_by;

   struct detector         *det;
   struct beam_params      *beam;
   char                    *filename;
   const struct copy_hdf5_field *copyme;

   int                     id;

   double                  lambda;
   double                  div;
   double                  bw;

   int                     width;
   int                     height;

   long long int           num_peaks;
   long long int           num_saturated_peaks;
   ImageFeatureList        *features;
};

The field data contains the raw image data, if it is currently available. The data might be available throughout the processing of an experimental pattern, but it might not be available when simulating, scaling or merging patterns. Similarly, flags contains an array of the same dimensions as data to contain the bad pixel flags. twotheta likewise contains an array of 2*theta (scattering angle) values in radians, since these values are generated as a by-product of the scattering vector calculation and can be used later for calculating intensities from differential scattering cross sections.

crystals is an array of Crystal directly returned by the low-level indexing system. n_crystals is the number of crystals which were found in the image.

copyme represents a list of HDF5 fields to copy to the output stream.


struct beam_params

struct beam_params {
	double photon_energy;  /* eV per photon */
	char  *photon_energy_from; /* HDF5 dataset name */
	double photon_energy_scale;  /* Scale factor for photon energy, if the
	                              * energy is to be from the HDF5 file */
};

struct imagefeature

struct imagefeature {
	struct image                    *parent;
	double                          fs;
	double                          ss;
	char                            *pn;
	double                          intensity;

	/* Reciprocal space coordinates (m^-1 of course) of this feature */
	double                          rx;
	double                          ry;
	double                          rz;

	/* Internal use only */
	int                             valid;

	const char                      *name;
};

ImageFeatureList

typedef struct _imagefeaturelist ImageFeatureList;

enum SpectrumType

A SpectrumType represents a type of X-ray energy spectrum to use for generating simulated data.

Members

SPECTRUM_TOPHAT

A top hat distribution of wavelengths

 

SPECTRUM_SASE

A simulated SASE spectrum

 

SPECTRUM_TWOCOLOUR

A spectrum containing two peaks

 

struct sample

struct sample {
	double k;
	double weight;
};