aboutsummaryrefslogtreecommitdiff
path: root/src/mapping.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-22 14:52:04 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-22 14:52:04 +0000
commitb7ba021860c13552972efed75d051f271f025505 (patch)
treef1ef1fbb0424d4d0da89faeeb7cd489f94b55215 /src/mapping.c
parent51ceb4cfffa10475a5e30dc62e91df4ba59741be (diff)
New cache format stores image features rather than 3D reflection coordinates
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@167 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/mapping.c')
-rw-r--r--src/mapping.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mapping.c b/src/mapping.c
index 544a9ac..def29c4 100644
--- a/src/mapping.c
+++ b/src/mapping.c
@@ -19,6 +19,7 @@
#include "itrans.h"
#include "image.h"
#include "displaywindow.h"
+#include "cache.h"
static int mapping_map_to_space(ImageFeature *refl, double *ddx, double *ddy, double *ddz, double *twotheta) {
@@ -110,7 +111,8 @@ static void mapping_map_features(ControlContext *ctx) {
double nx, ny, nz, twotheta;
if ( !mapping_map_to_space(&ctx->images->images[i].features->features[j], &nx, &ny, &nz, &twotheta) ) {
- reflection_add(ctx->reflectionlist, nx, ny, nz, ctx->images->images[i].features->features[j].intensity, REFLECTION_NORMAL);
+ reflection_add(ctx->reflectionlist, nx, ny, nz,
+ ctx->images->images[i].features->features[j].intensity, REFLECTION_NORMAL);
}
}
@@ -124,12 +126,17 @@ ReflectionList *mapping_create(ControlContext *ctx) {
int i;
- /* Find all the features */
- printf("MP: Analysing images..."); fflush(stdout);
- for ( i=0; i<ctx->images->n_images; i++ ) {
- ctx->images->images[i].features = itrans_process_image(&ctx->images->images[i], ctx->psmode);
+ if ( !ctx->cache_filename ) {
+ /* Find all the features */
+ printf("MP: Analysing images..."); fflush(stdout);
+ for ( i=0; i<ctx->images->n_images; i++ ) {
+ ctx->images->images[i].features = itrans_process_image(&ctx->images->images[i], ctx->psmode);
+ }
+ printf("done.\n");
+ } else {
+ printf("MP: Loading previous image analysis from '%s'\n", ctx->cache_filename);
+ if ( cache_load(ctx->images, ctx->cache_filename) ) return NULL;
}
- printf("done.\n");
mapping_map_features(ctx);