aboutsummaryrefslogtreecommitdiff
path: root/src/mapping.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapping.c')
-rw-r--r--src/mapping.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mapping.c b/src/mapping.c
index c9872f9..4897450 100644
--- a/src/mapping.c
+++ b/src/mapping.c
@@ -3,7 +3,7 @@
*
* 3D Mapping
*
- * (c) 2007 Thomas White <taw27@cam.ac.uk>
+ * (c) 2007-2008 Thomas White <taw27@cam.ac.uk>
*
* dtr - Diffraction Tomography Reconstruction
*
@@ -128,6 +128,20 @@ int mapping_scale(ImageFeature *refl, double *ddx, double *ddy) {
}
+/* Return the length of a 1 nm^-1 scale bar in the given image (in pixels)
+ * Result only strictly valid at the centre of the image */
+double mapping_scale_bar_length(ImageRecord *image) {
+
+ switch ( image->fmode ) {
+ case FORMULATION_PIXELSIZE : return 1.0e9/image->pixel_size;
+ case FORMULATION_CLEN : return image->camera_len*image->lambda;
+ default : fprintf(stderr, "Unrecognised formulation mode in mapping_scale_bar_length.\n");
+ }
+
+ return 0.0;
+
+}
+
void mapping_map_features(ControlContext *ctx) {
int i;
@@ -146,7 +160,8 @@ 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) ) {
+ 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);
}