From 07787a409f8c152bf5ce224b67ae2ca8f99fb1d5 Mon Sep 17 00:00:00 2001 From: Pascal Hogan-Lamarre Date: Thu, 17 Sep 2020 00:29:28 -0400 Subject: multiple crystal per shot implemented (to be tested) --- libcrystfel/src/fromfile.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/libcrystfel/src/fromfile.c b/libcrystfel/src/fromfile.c index c87d5cbe..f79bc0d1 100644 --- a/libcrystfel/src/fromfile.c +++ b/libcrystfel/src/fromfile.c @@ -283,6 +283,7 @@ int fromfile_index(struct image *image, void *mpriv, int crystal_number) float asx, asy, asz, bsx, bsy, bsz, csx, csy, csz; float xshift, yshift, profile_radius, resolution_limit; struct fromfile_entries *item, *p, *pprime; + int ncryst = 0; float *sol; struct fromfile_private *dp = (struct fromfile_private *)mpriv; @@ -323,6 +324,7 @@ int fromfile_index(struct image *image, void *mpriv, int crystal_number) cell_set_unique_axis(cell, cell_get_unique_axis(dp->cellTemplate)); cr = crystal_new(); + ncryst += 1; crystal_set_cell(cr, cell); crystal_set_profile_radius(cr, profile_radius); crystal_set_resolution_limit(cr, resolution_limit); @@ -335,17 +337,10 @@ int fromfile_index(struct image *image, void *mpriv, int crystal_number) HASH_FIND(hh, dp->sol_hash, &item->key, sizeof(struct fromfile_keys), pprime); - if ( pprime == NULL ) { - /* If no more crystal, done */ - return 1; + if ( pprime != NULL ) { + ncryst += fromfile_index(image, mpriv, crystal_number+1); } - else{ - /* If more crystals, recursive call for next crystal in line */ - fromfile_index(image, mpriv, crystal_number+1); - } - - dp->sol_hash = NULL; /* Clean up local copy */ - - return 1; + + return ncryst; } \ No newline at end of file -- cgit v1.2.3