Commit 7665b62d authored by Jan André Reuter's avatar Jan André Reuter

SLIX v2.0 will now produce same direction maps as SLIX v1.2.2 (aside from...

SLIX v2.0 will now produce same direction maps as SLIX v1.2.2 (aside from small differences below 0.1°)
Signed-off-by: default avatarJan André Reuter <jan.andre.reuter@hotmail.de>
parent a4df0244
Pipeline #25737 passed with stages
in 4 minutes and 53 seconds
......@@ -6,7 +6,7 @@ BACKGROUND_COLOR = -1
MAX_DISTANCE_FOR_CENTROID_ESTIMATION = 2
NUMBER_OF_SAMPLES = 100
TARGET_PEAK_HEIGHT = 0.94
TARGET_PEAK_HEIGHT = 0.06
@jit(nopython=True)
......@@ -218,7 +218,7 @@ def _centroid_correction_bases(image, peak_image, reverse_peaks):
if sub_peaks[pos] == 1:
target_peak_height = max(0, sub_image[pos] - max_pos *
(1 - TARGET_PEAK_HEIGHT))
TARGET_PEAK_HEIGHT)
left_position = MAX_DISTANCE_FOR_CENTROID_ESTIMATION
right_position = MAX_DISTANCE_FOR_CENTROID_ESTIMATION
......@@ -233,7 +233,7 @@ def _centroid_correction_bases(image, peak_image, reverse_peaks):
break
# Check for peak height
for offset in range(abs(left_position)):
for offset in range(left_position):
if sub_image[pos - offset] < target_peak_height:
left_position = offset
break
......@@ -271,7 +271,7 @@ def _centroid(image, peak_image, left_bases, right_bases):
centroid_sum_top = 0.0
centroid_sum_bottom = 1e-15
target_peak_height = max(0, sub_image[pos] - max_pos *
(1 - TARGET_PEAK_HEIGHT))
TARGET_PEAK_HEIGHT)
for x in range(-sub_left_bases[pos], sub_right_bases[pos]):
img_pixel = sub_image[(pos + x) % len(sub_image)]
......
......@@ -383,6 +383,7 @@ def centroid_correction(image, peak_image, low_prominence=TARGET_PROMINENCE,
high_prominence = -numpy.inf
[image_x, image_y, image_z] = image.shape
image = normalize(image)
image = image.reshape(image_x * image_y, image_z).astype('float32')
peak_image = peak_image.reshape(image_x * image_y, image_z).astype('uint8')
......
......@@ -6,7 +6,7 @@ BACKGROUND_COLOR = -1
MAX_DISTANCE_FOR_CENTROID_ESTIMATION = 2
NUMBER_OF_SAMPLES = 100
TARGET_PEAK_HEIGHT = 0.94
TARGET_PEAK_HEIGHT = 0.06
@cuda.jit('void(float32[:, :, :], int8[:, :, :])')
......@@ -212,7 +212,7 @@ def _centroid_correction_bases(image, peak_image, reverse_peaks,
if sub_peaks[pos] == 1:
target_peak_height = max(0, sub_image[pos] - max_val *
(1 - TARGET_PEAK_HEIGHT))
TARGET_PEAK_HEIGHT)
left_position = MAX_DISTANCE_FOR_CENTROID_ESTIMATION
right_position = MAX_DISTANCE_FOR_CENTROID_ESTIMATION
......@@ -263,7 +263,7 @@ def _centroid(image, peak_image, left_bases, right_bases, centroid_peaks):
centroid_sum_top = 0.0
centroid_sum_bottom = 1e-15
target_peak_height = max(0, sub_image[pos] - max_pos *
(1 - TARGET_PEAK_HEIGHT))
TARGET_PEAK_HEIGHT)
for x in range(-sub_left_bases[pos], sub_right_bases[pos]):
img_pixel = sub_image[(pos + x) % len(sub_image)]
......
......@@ -503,7 +503,7 @@ def centroid_correction(image, peak_image, low_prominence=TARGET_PROMINENCE,
NumPy array with the positions of all detected peak positions corrected
with the centroid calculation.
"""
gpu_image = cupy.array(image, dtype='float32')
gpu_image = normalize(cupy.array(image, dtype='float32'))
if peak_image is not None:
gpu_peak_image = cupy.array(peak_image, dtype='uint8')
else:
......
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