diff options
author | Thomas White <taw@physics.org> | 2011-11-15 13:45:44 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:40 +0100 |
commit | fb9df2f18def2d0b8fbdbc854c8a8c10e39ce6d9 (patch) | |
tree | 6bd1db2a9a3af25511c57a802b1a30b4979cd085 /src/image.c | |
parent | 45059e51e4536db9021ca22378cbffa01b5d91c8 (diff) |
Remove duplicated files
Diffstat (limited to 'src/image.c')
-rw-r--r-- | src/image.c | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/src/image.c b/src/image.c deleted file mode 100644 index 75a8af0a..00000000 --- a/src/image.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * image.c - * - * Handle images and image features - * - * (c) 2006-2010 Thomas White <taw@physics.org> - * - * Part of CrystFEL - crystallography with a FEL - * - */ - - -#include <stdlib.h> -#include <assert.h> -#include <math.h> -#include <stdio.h> - -#include "image.h" -#include "utils.h" - -/** - * SECTION:image - * @short_description: Data structure representing an image - * @title: Image - * @section_id: - * @see_also: - * @include: "image.h" - * @Image: - * - * The <structname>image</structname> structure represents an image, usually one - * frame from a large series of diffraction patterns, which might be from the - * same or different crystals. - */ - - -struct _imagefeaturelist -{ - struct imagefeature *features; - int n_features; -}; - - -void image_add_feature(ImageFeatureList *flist, double fs, double ss, - struct image *parent, double intensity, const char *name) -{ - if ( flist->features ) { - flist->features = realloc(flist->features, - (flist->n_features+1) - *sizeof(struct imagefeature)); - } else { - assert(flist->n_features == 0); - flist->features = malloc(sizeof(struct imagefeature)); - } - - flist->features[flist->n_features].fs = fs; - flist->features[flist->n_features].ss = ss; - flist->features[flist->n_features].intensity = intensity; - flist->features[flist->n_features].parent = parent; - flist->features[flist->n_features].name = name; - flist->features[flist->n_features].valid = 1; - - flist->n_features++; - -} - - -ImageFeatureList *image_feature_list_new() -{ - ImageFeatureList *flist; - - flist = malloc(sizeof(ImageFeatureList)); - - flist->n_features = 0; - flist->features = NULL; - - return flist; -} - - -void image_feature_list_free(ImageFeatureList *flist) -{ - if ( !flist ) return; - - if ( flist->features ) free(flist->features); - free(flist); -} - - -struct imagefeature *image_feature_closest(ImageFeatureList *flist, - double fs, double ss, - double *d, int *idx) -{ - int i; - double dmin = +HUGE_VAL; - int closest = 0; - - for ( i=0; i<flist->n_features; i++ ) { - - double ds; - - ds = distance(flist->features[i].fs, flist->features[i].ss, - fs, ss); - - if ( ds < dmin ) { - dmin = ds; - closest = i; - } - - } - - if ( dmin < +HUGE_VAL ) { - *d = dmin; - *idx = closest; - return &flist->features[closest]; - } - - *d = +INFINITY; - return NULL; -} - - -int image_feature_count(ImageFeatureList *flist) -{ - if ( flist == NULL ) return 0; - return flist->n_features; -} - - -struct imagefeature *image_get_feature(ImageFeatureList *flist, int idx) -{ - /* Sanity check */ - if ( flist == NULL ) return NULL; - if ( idx > flist->n_features ) return NULL; - - if ( flist->features[idx].valid == 0 ) return NULL; - - return &flist->features[idx]; -} - - -void image_remove_feature(ImageFeatureList *flist, int idx) -{ - flist->features[idx].valid = 0; -} |