add showing peaks with scatterplot

This commit is contained in:
2021-07-23 14:34:08 +02:00
parent 44deec91a9
commit 188dc62fad
4 changed files with 133 additions and 62 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -10,6 +10,7 @@ setup(name='situr',
packages=find_namespace_packages(include=['situr.*']), packages=find_namespace_packages(include=['situr.*']),
install_requires=[ install_requires=[
'numpy>=1.21.0', 'numpy>=1.21.0',
'matplotlib>=3.4.0',
'open3d>=0.13.0', 'open3d>=0.13.0',
'Pillow>=8.3.1', 'Pillow>=8.3.1',
'scikit-image>=0.18.2', 'scikit-image>=0.18.2',
+13
View File
@@ -3,6 +3,7 @@ from PIL import Image, ImageDraw
from skimage import img_as_float from skimage import img_as_float
from skimage.feature import blob_dog from skimage.feature import blob_dog
import numpy as np import numpy as np
from matplotlib import pyplot as plt
from situr.image.situ_image import SituImage from situr.image.situ_image import SituImage
@@ -30,6 +31,18 @@ class PeakFinder:
""" """
return self.find_peaks(img.get_data()[channel, focus_level, :, :]) return self.find_peaks(img.get_data()[channel, focus_level, :, :])
def scatterplot_channel_peaks(self,
img: SituImage,
channel: int,
focus_level: int = 0,
color='b'):
peaks = self.get_channel_peaks(img, channel, focus_level)
# TODO: test with non square image if right coordinates
plt.xlim(0, img.get_focus_level(0, 0).shape[1])
plt.ylim(0, img.get_focus_level(0, 0).shape[0])
plt.scatter(peaks[:, 0], peaks[:, 1], color=color)
def show_channel_peaks(self, def show_channel_peaks(self,
img: SituImage, img: SituImage,
channel: int, channel: int,