Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: linspace accepts integer divisions only + undefined variable bug #94

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions imagepy/tools/Measure/profile_tol.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def profile(self, body, img):
(x1, y1), (x2, y2) = body[0]
dx, dy = x2-x1, y2-y1
n = max(abs(dx), abs(dy)) + 1
xs = np.linspace(x1, x2, n).round().astype(np.int16)
ys = np.linspace(y1, y2, n).round().astype(np.int16)
xs = np.linspace(x1, x2, int(n)).round().astype(np.int16)
ys = np.linspace(y1, y2, int(n)).round().astype(np.int16)
msk = (xs>=0) * (xs<img.shape[1])
msk*= (ys>=0) * (ys<img.shape[0])
ix = np.arange(len(xs))
Expand Down
4 changes: 2 additions & 2 deletions imagepy/tools/Network/graphcut_tol.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def cut(img, lines):
cx, cy = i
dx, dy = cx-ox, cy-oy
n = max(abs(dx), abs(dy)) + 1
xs = np.linspace(cx, ox, n).round().astype(np.int16)
ys = np.linspace(cy, oy, n).round().astype(np.int16)
xs = np.linspace(cx, ox, n.astype(np.uint16)).round().astype(np.int16)
ys = np.linspace(cy, oy, n.astype(np.uint16)).round().astype(np.int16)
for x,y in zip(xs, ys):
for dxy in [(1,0),(0,1)]:
xx = x + dxy[0]
Expand Down
4 changes: 2 additions & 2 deletions imagepy/tools/Network/graphpen_tol.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def draw(img, lines):
cx, cy = i
dx, dy = cx-ox, cy-oy
n = max(abs(dx), abs(dy)) + 1
xs = np.linspace(ox, cx, n).round().astype(np.int16)
ys = np.linspace(oy, cy, n).round().astype(np.int16)
xs = np.linspace(ox, cx, n.astype(np.uint16)).round().astype(np.int16)
ys = np.linspace(oy, cy, n.astype(np.uint16)).round().astype(np.int16)
for x,y in zip(xs, ys):
if x<0 or x>img.shape[1]: continue
if y<0 or y>img.shape[0]: continue
Expand Down
1 change: 1 addition & 0 deletions imagepy/widgets/histogram/channels_wgt.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def on_setback(self, event):
name = self.com_back.GetValue()
if name is None: return
ImageManager.get().back = ImageManager.get(name)
curwin = WindowsManager.get()
curwin.ips.update()

def on_mode(self, event):
Expand Down