Skip to content

Commit

Permalink
fix bug: get_img_id_from_point in vertical
Browse files Browse the repository at this point in the history
  • Loading branch information
nachifur committed Aug 25, 2021
1 parent 6e5f636 commit 73798a9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
21 changes: 18 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,15 +885,30 @@ def change_img_stitch_mode(self, event):
def get_img_id_from_point(self, xy):
# get img_id from grid points
xy_grid = np.array(self.ImgManager.xy_grid)
xy_grid_x = xy_grid[:,0].reshape(2,2)
xy_grid_y = xy_grid[:,1].reshape(2,2)

xy_cur = np.array([xy])
xy_cur = np.repeat(xy_cur, xy_grid.shape[0], axis=0)
res_ = xy_cur - xy_grid
xy_cur_x = xy_cur[:,0].reshape(2,2)
xy_cur_y = xy_cur[:,1].reshape(2,2)

if self.checkBox_orientation.Value:
xy_grid_x = xy_grid_x.T
xy_grid_y = xy_grid_y.T

res_x = xy_cur_x - xy_grid_x
res_y = xy_cur_y - xy_grid_y

res_x = res_x.reshape(-1)
res_y = res_y.reshape(-1)

id_list = []
for i in range(xy_grid.shape[0]):
if res_[i][0] >= 0 and res_[i][1] >= 0:
if res_x[i] >= 0 and res_y[i] >= 0:
id_list.append(i)
else:
id_list.append(0)
id_list.append(-1)
return max(id_list)

def title_down_up_func(self, event):
Expand Down
2 changes: 1 addition & 1 deletion main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __init__( self, parent ):
fgSizer5.SetFlexibleDirection( wx.BOTH )
fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

fgSizer5.SetMinSize( wx.Size( 950,600 ) )
fgSizer5.SetMinSize( wx.Size( 1000,600 ) )
self.scrolledWindow_img = wx.ScrolledWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), wx.HSCROLL|wx.VSCROLL )
self.scrolledWindow_img.SetScrollRate( 5, 5 )
fgSizer4 = wx.FlexGridSizer( 2, 1, 0, 0 )
Expand Down
2 changes: 1 addition & 1 deletion wxFromBuilder/main_gui.fbp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size">950,600</property>
<property name="minimum_size">1000,600</property>
<property name="name">fgSizer5</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
Expand Down

0 comments on commit 73798a9

Please sign in to comment.