diff options
author | Thomas White <taw@physics.org> | 2010-01-08 15:53:17 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-01-08 15:53:17 +0100 |
commit | bd26d5745269594647ec79f64fdfb8e750891672 (patch) | |
tree | 29968c2c0872fe0d52c5078426c3a89f1e8ed6ec /src/hdf5-file.c | |
parent | a374cdb2396659d711f85851cb0904ccf7c9731d (diff) |
Zaefferer gradient search
Diffstat (limited to 'src/hdf5-file.c')
-rw-r--r-- | src/hdf5-file.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c index 0e9453cf..509147a0 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -45,6 +45,7 @@ struct hdfile *hdfile_open(const char *filename) f = malloc(sizeof(struct hdfile)); if ( f == NULL ) return NULL; + f->image = NULL; f->fh = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); if ( f->fh < 0 ) { @@ -149,18 +150,29 @@ int16_t *hdfile_get_image_binned(struct hdfile *f, int binning, int16_t *max) struct image *image; int16_t *data; - image = malloc(sizeof(struct image)); - if ( image == NULL ) return NULL; + if ( f->image == NULL ) { - hdf5_read(f, image); - f->image = image; + image = malloc(sizeof(struct image)); + if ( image == NULL ) return NULL; + image->features = NULL; - data = hdfile_bin(image->data, f->nx, f->ny, binning, max); + hdf5_read(f, image); + f->image = image; + + } + + data = hdfile_bin(f->image->data, f->nx, f->ny, binning, max); return data; } +struct image *hdfile_get_image(struct hdfile *f) +{ + return f->image; +} + + int hdfile_get_unbinned_value(struct hdfile *f, int x, int y, int16_t *val) { if ( (x>=f->image->width) || (y>=f->image->height) ) { |