Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Bugfixes before release
Browse files Browse the repository at this point in the history
  • Loading branch information
RRobert92 committed Jan 6, 2022
1 parent 49cd00b commit 1e1034c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ History
0.3.5 (2022-01-03)
-------------------
* HotFix for folder selection on MacOS
* Bugfix in graph creation
* Fix patch creation in Z -> not cutting patches in Z for given size

0.3.4 (2021-11-28)
Expand Down
23 changes: 14 additions & 9 deletions slcpy/utils/import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ def _remove_close_point(self,
return filter_coord

def find_maximas(self,
clean_close_point: int,
clean_close_point=9,
filter_small_object: Optional[int] = None,
down_sampling: Optional[int] = None):
down_sampling=True):
"""At each z position find point maxims and store their coordinates"""
x, y, z = [], [], []

if filter_small_object is None:
if filter_small_object is not None:
denoise_img = np.zeros(self.image.shape, dtype='int16')

z_iter = tqdm(range(self.image.shape[0]),
Expand All @@ -289,11 +289,15 @@ def find_maximas(self,
leave=False)
for i in z_iter:
slice = self.image[i, :].astype('int16')
_, thresh = cv2.threshold(slice, 0, 255, cv2.THRESH_BINARY)
kernel = np.ones((7, 7),
np.int16)
denoise_img[i, :] = cv2.morphologyEx(
thresh, cv2.MORPH_OPEN, kernel)
_, thresh = cv2.threshold(src=slice,
thresh=0,
maxval=255,
type=cv2.THRESH_BINARY)
kernel = np.ones(shape=(filter_small_object, filter_small_object),
dtype=np.int16)
denoise_img[i, :] = cv2.morphologyEx(src=thresh,
op=cv2.MORPH_OPEN,
kernel=kernel)

denoise_img = abs(denoise_img.astype('int8'))
else:
Expand All @@ -314,6 +318,7 @@ def find_maximas(self,
picked_maxima = peak_local_max(dm_slice,
labels=img_slice,
min_distance=clean_close_point)

z = np.append(z, np.repeat(i, len(picked_maxima)))
y = np.append(y, picked_maxima[:, 0])
x = np.append(x, picked_maxima[:, 1])
Expand All @@ -322,7 +327,7 @@ def find_maximas(self,

""" Down-sampling point cloud by removing closest point """

if down_sampling is not None:
if down_sampling:
coordinates = self._remove_close_point(coordinates=coordinates,
voxal_z=5,
voxal_xy=2)
Expand Down

0 comments on commit 1e1034c

Please sign in to comment.