Image

Image — Data structure representing an image

Functions

Types and Values

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

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

imagefile_close ()

void
imagefile_close (struct imagefile *f);

imagefile_copy_fields ()

void
imagefile_copy_fields (struct imagefile *f,
                       const struct imagefile_field_list *copyme,
                       FILE *fh,
                       struct event *ev);

imagefile_get_hdfile ()

struct hdfile *
imagefile_get_hdfile (struct imagefile *f);

imagefile_get_type ()

enum imagefile_type
imagefile_get_type (struct imagefile *f);

imagefile_open ()

struct imagefile *
imagefile_open (const char *filename);

imagefile_read ()

int
imagefile_read (struct imagefile *f,
                struct image *image,
                struct event *event);

imagefile_read_simple ()

int
imagefile_read_simple (struct imagefile *f,
                       struct image *image);

new_imagefile_field_list ()

struct imagefile_field_list *
new_imagefile_field_list (void);

add_imagefile_field ()

void
add_imagefile_field (struct imagefile_field_list *copyme,
                     const char *name);

free_imagefile_field_list ()

void
free_imagefile_field_list (struct imagefile_field_list *f);

image_add_feature ()

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

image_feature_closest ()

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

image_reflection_closest ()

Reflection *
image_reflection_closest (RefList *rlist,
                          double fs,
                          double ss,
                          struct panel *p,
                          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 imagefile_field_list *copyme;
	struct stuff_from_stream *stuff_from_stream;

	double                  avg_clen;  /* Average camera length extracted
	                                    * from 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 */

	/* Detected peaks */
	long long               num_peaks;
	long long               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.

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 fields in the image file (e.g. HDF5 fields or CBF headers) to copy to the output stream.

Members

float **dp;

The image data, by panel

 

int **bad;

The bad pixel mask, array by panel

 

float **sat;

The per-pixel saturation mask, array by panel

 

Crystal **crystals;

Array of crystals in the image

 

int n_crystals;

The number of crystals in the image

 

IndexingMethod indexed_by;

Indexing method which indexed this pattern

 

struct detector *det;

Detector structure

 

struct beam_params *beam;

Beam parameters structure

 

char *filename;

Filename for the image file

 

struct event *event;

Event ID for the image

 

const struct imagefile_field_list *copyme;

Fields to copy from the image file to the stream

 

struct stuff_from_stream *stuff_from_stream;

Items read back from the stream

 

double avg_clen;

Mean of camera length values for all panels

 

int id;

ID number of the thread handling this image

 

int serial;

Serial number for this image

 

struct sample *spectrum;

Spectrum information

 

int nsamples;

Number of spectrum samples

 

int spectrum_size;

SIze of spectrum array

 

double lambda;

Wavelength

 

double div;

Divergence

 

double bw;

Bandwidth

 

long long num_peaks;

The number of peaks

 

long long num_saturated_peaks;

The number of saturated peaks

 

ImageFeatureList *features;

The peaks found in the image

 

struct beam_params

struct beam_params {
	double photon_energy;
	char  *photon_energy_from;
	double photon_energy_scale;
};

Members

double photon_energy;

eV per photon

 

char *photon_energy_from;

HDF5 dataset name

 

double photon_energy_scale;

Scale factor for photon energy, if it comes from HDF5

 

struct imagefeature

struct imagefeature {
	struct image                    *parent;
	double                          fs;
	double                          ss;
	struct panel                    *p;
	double                          intensity;

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

	const char                      *name;
};

Represents a peak in an image.

Note carefully that the fs and ss coordinates are the distances, measured in pixels, from the corner of the panel. They are NOT pixel indices. If the peak is in the middle of the first pixel, its coordinates would be 0.5,0.5.

Members

struct image *parent;

Image this feature belongs to

 

double fs;

Fast scan coordinate

 

double ss;

Slow scan coordinate

 

struct panel *p;

Pointer to panel

 

double intensity;

Intensity of peak

 

double rx;

Reciprocal x coordinate in m^-1

 

double ry;

Reciprocal y coordinate in m^-1

 

double rz;

Reciprocal z coordinate in m^-1

 

const char *name;

Text name for feature

 

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;
};

struct imagefile

struct imagefile;

struct imagefile_field_list

struct imagefile_field_list;