HDF5 file handling

HDF5 file handling — HDF5 file handling

Functions

Types and Values

struct hdfile
struct copy_hdf5_field

Includes

#include "hdf5-file.h"

Description

Routines for accessing HDF5 files.

Functions

hdf5_read ()

int
hdf5_read (struct hdfile *f,
           struct image *image,
           const char *element,
           int satcorr);

hdf5_read2 ()

int
hdf5_read2 (struct hdfile *f,
            struct image *image,
            struct event *ev,
            int satcorr);

hdf5_write ()

int
hdf5_write (const char *filename,
            const void *data,
            int width,
            int height,
            int type);

hdf5_write_image ()

int
hdf5_write_image (const char *filename,
                  const struct image *image,
                  char *element);

hdfile_close ()

void
hdfile_close (struct hdfile *f);

hdfile_get_image_binned ()

int16_t *
hdfile_get_image_binned (struct hdfile *hdfile,
                         int binning,
                         int16_t *maxp);

hdfile_get_string_value ()

char *
hdfile_get_string_value (struct hdfile *f,
                         const char *name,
                         struct event *ev);

hdfile_open ()

struct hdfile *
hdfile_open (const char *filename);

hdfile_read_group ()

char **
hdfile_read_group (struct hdfile *f,
                   int *n,
                   const char *parent,
                   int **p_is_group,
                   int **p_is_image);

hdfile_set_first_image ()

int
hdfile_set_first_image (struct hdfile *f,
                        const char *group);

hdfile_set_image ()

int
hdfile_set_image (struct hdfile *f,
                  const char *path);

hdfile_get_value ()

int
hdfile_get_value (struct hdfile *f,
                  const char *name,
                  struct event *ev,
                  void *val,
                  hid_t memtype);

copy_hdf5_fields ()

void
copy_hdf5_fields (struct hdfile *f,
                  const struct copy_hdf5_field *copyme,
                  FILE *fh,
                  struct event *ev);

add_copy_hdf5_field ()

void
add_copy_hdf5_field (struct copy_hdf5_field *copyme,
                     const char *name);

new_copy_hdf5_field_list ()

struct copy_hdf5_field *
new_copy_hdf5_field_list (void);

free_copy_hdf5_field_list ()

void
free_copy_hdf5_field_list (struct copy_hdf5_field *f);

get_peaks ()

int
get_peaks (struct image *image,
           struct hdfile *f,
           const char *p);

This is a wrapper function to preserve API compatibility with older CrystFEL versions. Use get_peaks_2() instead.

This function is equivalent to get_peaks_2(image , f , p , 1).

Parameters

image

An image structure

 

f

An hdfile structure

 

p

The HDF5 path to the peak data

 

Returns

non-zero on error, zero otherwise.


get_peaks_2 ()

int
get_peaks_2 (struct image *image,
             struct hdfile *f,
             const char *p,
             int half_pixel_shift);

Get peaks from HDF5. The peak list should be located at p in the HDF5 file, a 2D array where the first dimension equals the number of peaks and second dimension is three. The first two columns contain the fast scan and slow scan coordinates, respectively, of the peaks. The third column contains the intensities.

CrystFEL considers all peak locations to be distances from the corner of the detector panel, in pixel units, consistent with its description of detector geometry (see 'man crystfel_geometry'). The software which generates the CXI files, including Cheetah, may instead consider the peak locations to be pixel indices in the data array. In this case, the peak coordinates should have 0.5 added to them. This will be done if half_pixel_shift is non-zero.

Parameters

image

An image structure

 

f

An hdfile structure

 

p

The HDF5 path to the peak data

 

half_pixel_shift

Non-zero if 0.5 should be added to all peak coordinates

 

Returns

non-zero on error, zero otherwise.


get_peaks_cxi ()

int
get_peaks_cxi (struct image *image,
               struct hdfile *f,
               const char *p,
               struct filename_plus_event *fpe);

This is a wrapper function to preserve API compatibility with older CrystFEL versions. Use get_peaks_cxi_2() instead.

This function is equivalent to get_peaks_cxi_2(image , f , p , fpe , 1).

Parameters

image

An image structure

 

f

An hdfile structure

 

p

The HDF5 path to the peak data

 

fpe

A filename_plus_event structure specifying the event

 

Returns

non-zero on error, zero otherwise.


get_peaks_cxi_2 ()

int
get_peaks_cxi_2 (struct image *image,
                 struct hdfile *f,
                 const char *p,
                 struct filename_plus_event *fpe,
                 int half_pixel_shift);

Get peaks from HDF5, in "CXI format" (as in "CXIDB"). The data should be in a set of arrays under p . The number of peaks should be in a 1D array at p /nPeaks. The fast-scan and slow-scan coordinates should be in 2D arrays at p /peakXPosRaw and p /peakYPosRaw respectively (sorry about the naming). The first dimension of these arrays should be the event number (as given by fpe ). The intensities are expected to be at p /peakTotalIntensity in a similar 2D array.

CrystFEL considers all peak locations to be distances from the corner of the detector panel, in pixel units, consistent with its description of detector geometry (see 'man crystfel_geometry'). The software which generates the CXI files, including Cheetah, may instead consider the peak locations to be pixel indices in the data array. In this case, the peak coordinates should have 0.5 added to them. This will be done if half_pixel_shift is non-zero.

Parameters

image

An image structure

 

f

An hdfile structure

 

p

The HDF5 path to the peak data

 

fpe

A filename_plus_event structure specifying the event

 

half_pixel_shift

Non-zero if 0.5 should be added to all peak coordinates

 

Returns

non-zero on error, zero otherwise.


hdfile_is_scalar ()

int
hdfile_is_scalar (struct hdfile *f,
                  const char *name,
                  int verbose);

check_path_existence ()

int
check_path_existence (hid_t fh,
                      const char *path);

fill_event_list ()

struct event_list *
fill_event_list (struct hdfile *hdfile,
                 struct detector *det);

Types and Values

struct hdfile

struct hdfile;

struct copy_hdf5_field

struct copy_hdf5_field;