From 5692430eac2d781f10cd8756045326bb84e4aadb Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 7 Sep 2021 16:26:37 +0200 Subject: filter_noise_in_panel: Fix panel edge behaviour --- libcrystfel/src/filters.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/filters.c b/libcrystfel/src/filters.c index 5f6a0b2d..4bc41f3d 100644 --- a/libcrystfel/src/filters.c +++ b/libcrystfel/src/filters.c @@ -55,19 +55,15 @@ static void filter_noise_in_panel(float *data, int width, int height) * but this filter is so horrible it's unlikely to matter. */ if ( (x==0) || (x==width-1) || (y==0) || (y==height-1) ) { - if ( val < 0 ) val = 0; + if ( val < 0 ) { + data[x+width*y] = 0.0; + } continue; } for ( dy=-1; dy<=+1; dy++ ) { for ( dx=-1; dx<=+1; dx++ ) { - - int val2; - - val2 = data[(x+dx)+width*(y+dy)]; - - if ( val2 < 0 ) val = 0; - + if ( data[(x+dx)+width*(y+dy)] ) val = 0.0; } } -- cgit v1.2.3