diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-08-28 16:07:32 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-08-28 16:07:32 +0000 |
commit | 85b8978beedd0142560573a92442a5ed907b0ed2 (patch) | |
tree | a5fb149aa94b540a568ac6c7b2831a8065e53959 /src/itrans-threshold.c | |
parent | 49ad910255546917c22a1d0ef01b4109c7772b16 (diff) |
Be a lot more clear about which things are properties of images and which
belong to the control context.
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@81 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/itrans-threshold.c')
-rw-r--r-- | src/itrans-threshold.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/itrans-threshold.c b/src/itrans-threshold.c index 3a1d788..6aadea2 100644 --- a/src/itrans-threshold.c +++ b/src/itrans-threshold.c @@ -19,27 +19,27 @@ #include "imagedisplay.h" #include "reflections.h" -unsigned int itrans_peaksearch_threshold(int16_t *image, ControlContext *ctx, double tilt_degrees, ImageDisplay *imagedisplay) { +unsigned int itrans_peaksearch_threshold(ImageRecord imagerecord, ControlContext *ctx) { int width, height; int x, y; unsigned int n_reflections = 0; + int16_t *image = imagerecord.image; + double tilt_degrees = imagerecord.tilt; - width = ctx->width; height = ctx->height; + width = imagerecord.width; + height = imagerecord.height; /* Simple Thresholding */ for ( y=0; y<height; y++ ) { for ( x=0; x<width; x++ ) { if ( image[x + width*y] > 10 ) { - if ( ctx->fmode == FORMULATION_PIXELSIZE ) { - reflection_add_from_reciprocal(ctx, (signed)(x-ctx->x_centre)*ctx->pixel_size, (signed)(y-ctx->y_centre)*ctx->pixel_size, + if ( imagerecord.fmode == FORMULATION_PIXELSIZE ) { + reflection_add_from_reciprocal(ctx, (signed)(x-imagerecord.x_centre)*imagerecord.pixel_size, (signed)(y-imagerecord.y_centre)*imagerecord.pixel_size, tilt_degrees, image[x + width*y]); } else { - reflection_add_from_dp(ctx, (signed)(x-ctx->x_centre), (signed)(y-ctx->y_centre), tilt_degrees, image[x + width*y]); - } - if ( ctx->first_image ) { - imagedisplay_mark_point(imagedisplay, x, y); + reflection_add_from_dp(ctx, (signed)(x-imagerecord.x_centre)/imagerecord.resolution, (signed)(y-imagerecord.y_centre)/imagerecord.resolution, tilt_degrees, image[x + width*y]); } n_reflections++; } @@ -51,14 +51,17 @@ unsigned int itrans_peaksearch_threshold(int16_t *image, ControlContext *ctx, do } -unsigned int itrans_peaksearch_adaptive_threshold(int16_t *image, ControlContext *ctx, double tilt_degrees, ImageDisplay *imagedisplay) { +unsigned int itrans_peaksearch_adaptive_threshold(ImageRecord imagerecord, ControlContext *ctx) { int16_t max_val = 0; int width, height; unsigned int n_reflections = 0; + int16_t *image = imagerecord.image; + double tilt_degrees = imagerecord.tilt; + + width = imagerecord.width; + height = imagerecord.height; - width = ctx->width; height = ctx->height; - /* Adaptive Thresholding */ do { @@ -80,14 +83,11 @@ unsigned int itrans_peaksearch_adaptive_threshold(int16_t *image, ControlContext } if ( max_val > 50 ) { - if ( ctx->fmode == FORMULATION_PIXELSIZE ) { - reflection_add_from_reciprocal(ctx, (signed)(max_x-ctx->x_centre)*ctx->pixel_size, (signed)(max_y-ctx->y_centre)*ctx->pixel_size, - tilt_degrees, max_val); + if ( imagerecord.fmode == FORMULATION_PIXELSIZE ) { + reflection_add_from_reciprocal(ctx, (signed)(x-imagerecord.x_centre)*imagerecord.pixel_size, (signed)(y-imagerecord.y_centre)*imagerecord.pixel_size, + tilt_degrees, image[x + width*y]); } else { - reflection_add_from_dp(ctx, (signed)(max_x-ctx->x_centre), (signed)(max_y-ctx->y_centre), tilt_degrees, max_val); - } - if ( ctx->first_image ) { - imagedisplay_mark_point(imagedisplay, max_x, max_y); + reflection_add_from_dp(ctx, (signed)(x-imagerecord.x_centre)/imagerecord.resolution, (signed)(y-imagerecord.y_centre)/imagerecord.resolution, tilt_degrees, image[x + width*y]); } n_reflections++; @@ -104,3 +104,4 @@ unsigned int itrans_peaksearch_adaptive_threshold(int16_t *image, ControlContext return n_reflections; } + |