aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/image.c')
-rw-r--r--libcrystfel/src/image.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index 093e20f2..8fe3d69c 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -159,3 +159,31 @@ void image_remove_feature(ImageFeatureList *flist, int idx)
{
flist->features[idx].valid = 0;
}
+
+
+void image_add_crystal(struct image *image, Crystal *cryst)
+{
+ Crystal **crs;
+ int n;
+
+ n = image->n_crystals;
+ crs = realloc(image->crystals, (n+1)*sizeof(Crystal *));
+ if ( crs == NULL ) {
+ ERROR("Failed to allocate memory for crystals.\n");
+ return;
+ }
+
+ crs[n] = cryst;
+ image->crystals = crs;
+ image->n_crystals = n+1;
+}
+
+
+void free_all_crystals(struct image *image)
+{
+ int i;
+
+ for ( i=0; i<image->n_crystals; i++ ) {
+ crystal_free(image->crystals[i]);
+ }
+}