Commit a4df0244 authored by Jan André Reuter's avatar Jan André Reuter

Adjusted CPU and GPU centroid methods to achieve the same results again. Fixed...

Adjusted CPU and GPU centroid methods to achieve the same results again. Fixed Matplotlib tests accordingly
Signed-off-by: default avatarJan André Reuter <jan.andre.reuter@hotmail.de>
parent 363d2e35
Pipeline #25730 passed with stages
in 4 minutes and 52 seconds
......@@ -276,7 +276,7 @@ def _centroid(image, peak_image, left_bases, right_bases):
for x in range(-sub_left_bases[pos], sub_right_bases[pos]):
img_pixel = sub_image[(pos + x) % len(sub_image)]
next_img_pixel = sub_image[(pos + x + 1) % len(sub_image)]
for interp in range(NUMBER_OF_SAMPLES+1):
for interp in range(NUMBER_OF_SAMPLES):
step = interp / NUMBER_OF_SAMPLES
func_val = img_pixel + \
(next_img_pixel - img_pixel) * step
......@@ -285,9 +285,7 @@ def _centroid(image, peak_image, left_bases, right_bases):
centroid_sum_top += (x + step) * func_val
centroid_sum_bottom += func_val
centroid = centroid_sum_top / centroid_sum_bottom
if centroid > 1:
centroid = 1
if centroid < -1:
centroid = -1
if abs(centroid) > 1:
centroid = numpy.sign(centroid)
centroid_peaks[idx, pos] = centroid
return centroid_peaks
......@@ -268,10 +268,10 @@ def _centroid(image, peak_image, left_bases, right_bases, centroid_peaks):
for x in range(-sub_left_bases[pos], sub_right_bases[pos]):
img_pixel = sub_image[(pos + x) % len(sub_image)]
next_img_pixel = sub_image[(pos + x + 1) % len(sub_image)]
for interp in range(NUMBER_OF_SAMPLES+1):
for interp in range(NUMBER_OF_SAMPLES):
step = interp / NUMBER_OF_SAMPLES
func_val = img_pixel + (next_img_pixel - img_pixel) * step
if func_val > target_peak_height:
if func_val >= target_peak_height:
centroid_sum_top += (x + step) * func_val
centroid_sum_bottom += func_val
......
/home/jreuter/Arbeit/Programme/SLIX/tests/baseline_images/test_visualization/parameter_map.png
\ No newline at end of file
/home/jreuter/Arbeit/Programme/SLIX/tests/baseline_images/test_visualization/unit_vectors.png
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment