use groupItem for tracked object
This commit is contained in:
@@ -289,7 +289,7 @@ class WndFixTarget(QWidget):
|
|||||||
# with open(filename, 'rb') as f:
|
# with open(filename, 'rb') as f:
|
||||||
# data=pickle.load(f)
|
# data=pickle.load(f)
|
||||||
|
|
||||||
self._data=data
|
#self._data=data
|
||||||
self._tree.setData(data)
|
self._tree.setData(data)
|
||||||
try:
|
try:
|
||||||
wnd=app._mainWnd
|
wnd=app._mainWnd
|
||||||
@@ -297,9 +297,12 @@ class WndFixTarget(QWidget):
|
|||||||
_log.info('_mainWnd not handeled')
|
_log.info('_mainWnd not handeled')
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
grp=wnd._goTracked
|
||||||
for go in data:
|
for go in data:
|
||||||
wnd.vb.addItem(go)
|
grp.addItem(go)
|
||||||
wnd._goTracked['objLst']=self._data
|
data=grp.childItems()
|
||||||
|
self._tree.setData(data)
|
||||||
|
#wnd._goTracked['objLst']=self._data
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@@ -356,6 +359,7 @@ class WndFixTarget(QWidget):
|
|||||||
self.dataFileLoaded.emit(filename)
|
self.dataFileLoaded.emit(filename)
|
||||||
|
|
||||||
def save_file(self, filename=None):
|
def save_file(self, filename=None):
|
||||||
|
app = QApplication.instance()
|
||||||
# filename = folders.get_file("prelocated-save.dat")
|
# filename = folders.get_file("prelocated-save.dat")
|
||||||
#data_folder = settings.value("folders/last_prelocation_folder")
|
#data_folder = settings.value("folders/last_prelocation_folder")
|
||||||
data_folder=''
|
data_folder=''
|
||||||
@@ -373,9 +377,18 @@ class WndFixTarget(QWidget):
|
|||||||
#df.to_csv(filename, float_format="%.6f")
|
#df.to_csv(filename, float_format="%.6f")
|
||||||
#import numpy as np
|
#import numpy as np
|
||||||
ext=filename.rsplit('.',1)[1].lower()
|
ext=filename.rsplit('.',1)[1].lower()
|
||||||
|
try:
|
||||||
|
wnd=app._mainWnd
|
||||||
|
except AttributeError:
|
||||||
|
_log.info('_mainWnd not handeled')
|
||||||
|
data=self._data
|
||||||
|
else:
|
||||||
|
grp=wnd._goTracked
|
||||||
|
data=grp.childItems()
|
||||||
|
|
||||||
if ext=='json':
|
if ext=='json':
|
||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
json.dump(self._data, f,cls=MyJsonEncoder, indent=2)#separators=(',', ':')
|
json.dump(data, f,cls=MyJsonEncoder, indent=2)#separators=(',', ':')
|
||||||
else:
|
else:
|
||||||
raise(IOError('unsupported file type'))
|
raise(IOError('unsupported file type'))
|
||||||
#elif ext=='yaml':
|
#elif ext=='yaml':
|
||||||
|
|||||||
@@ -182,10 +182,10 @@ class Fiducial(pg.ROI):
|
|||||||
class Grid(pg.ROI):
|
class Grid(pg.ROI):
|
||||||
'''a grid'''
|
'''a grid'''
|
||||||
|
|
||||||
def __init__( self, pos=(0,0), size=(30,20), cnt=(6,4), ficucialScale=5, **kargs):
|
def __init__( self, pos=(0,0), size=(30,20), cnt=(6,4), fiducialSize=.2, **kargs):
|
||||||
pg.ROI.__init__(self, pos, size, **kargs)
|
pg.ROI.__init__(self, pos, size, **kargs)
|
||||||
self._cnt=cnt
|
self._cnt=cnt
|
||||||
self._fidScl=ficucialScale
|
self._fidSz=fiducialSize
|
||||||
self.addScaleHandle([1, 1], [0, 0])
|
self.addScaleHandle([1, 1], [0, 0])
|
||||||
self.addScaleHandle([0, 0], [1, 1])
|
self.addScaleHandle([0, 0], [1, 1])
|
||||||
self.addScaleRotateHandle([1, 0], [0, 0])
|
self.addScaleRotateHandle([1, 0], [0, 0])
|
||||||
@@ -206,9 +206,8 @@ class Grid(pg.ROI):
|
|||||||
y=i*py
|
y=i*py
|
||||||
p.drawLine(pg.Point(0, y), pg.Point(sz[0] ,y ))
|
p.drawLine(pg.Point(0, y), pg.Point(sz[0] ,y ))
|
||||||
|
|
||||||
fidScl=self._fidScl
|
fidSz=self._fidSz
|
||||||
rx=fidScl*r.width()/sz[0]
|
rx=ry=fidSz/2
|
||||||
ry=fidScl*r.height()/sz[1]
|
|
||||||
p.setPen(pg.mkPen(width=1, color=(255, 0, 0)))
|
p.setPen(pg.mkPen(width=1, color=(255, 0, 0)))
|
||||||
for j in range(ny):
|
for j in range(ny):
|
||||||
y=j*py
|
y=j*py
|
||||||
@@ -222,7 +221,7 @@ class Grid(pg.ROI):
|
|||||||
#p.drawRect(0, 0, 1, 1)
|
#p.drawRect(0, 0, 1, 1)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
s=f'{self.__class__.__name__}:(pos:{itr2str(self.pos())}, size:{itr2str(self.size())}, cnt:{self._cnt}, ficucialScale:{self._fidScl}}}'
|
s=f'{self.__class__.__name__}:(pos:{itr2str(self.pos())}, size:{itr2str(self.size())}, cnt:{self._cnt}, fidSize:{self._fidSz}}}'
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def obj2json(self,encoder):
|
def obj2json(self,encoder):
|
||||||
@@ -231,7 +230,7 @@ class Grid(pg.ROI):
|
|||||||
'pos':tuple(self.pos()),
|
'pos':tuple(self.pos()),
|
||||||
'size':tuple(self.size()),
|
'size':tuple(self.size()),
|
||||||
'cnt':self._cnt,
|
'cnt':self._cnt,
|
||||||
'ficucialScale':self._fidScl
|
'fiducialSize':self._fidSz
|
||||||
}
|
}
|
||||||
return jsn
|
return jsn
|
||||||
|
|
||||||
@@ -406,7 +405,8 @@ class FixTargetFrame(pg.ROI):
|
|||||||
r=QtCore.QRectF(0, 0, sz[0], sz[1]).normalized()
|
r=QtCore.QRectF(0, 0, sz[0], sz[1]).normalized()
|
||||||
p.setRenderHint(QtGui.QPainter.Antialiasing)
|
p.setRenderHint(QtGui.QPainter.Antialiasing)
|
||||||
p.setPen(self.currentPen)
|
p.setPen(self.currentPen)
|
||||||
p.drawRect(0, 0, int(sz[0]), int(sz[1]))
|
#p.drawRect(0, 0, int(sz[0]), int(sz[1]))
|
||||||
|
p.drawRect(r)
|
||||||
|
|
||||||
dscr=self._dscr
|
dscr=self._dscr
|
||||||
objSz=dscr['size']
|
objSz=dscr['size']
|
||||||
|
|||||||
197
swissmx.py
197
swissmx.py
@@ -421,15 +421,15 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
#--- beam marker ---
|
#--- beam marker ---
|
||||||
bm_sz=np.array((50, 40)) # it is immidiatly repositioned in cb_zoom_changed
|
bm_sz=np.array((50, 40)) # it is immidiatly repositioned in cb_zoom_changed
|
||||||
self._goBeamMarker=bm=UsrGO.Marker(-opt_ctr-bm_sz/2,bm_sz,mode=0)
|
self._goBeamMarker=obj=UsrGO.Marker(-opt_ctr-bm_sz/2,bm_sz,mode=0)
|
||||||
bm._size_eu=cfg.value(AppCfg.GEO_BEAM_SZ)
|
obj._size_eu=cfg.value(AppCfg.GEO_BEAM_SZ)
|
||||||
bm._pos_eu=cfg.value(AppCfg.GEO_BEAM_POS)
|
obj._pos_eu=cfg.value(AppCfg.GEO_BEAM_POS)
|
||||||
bm.sigRegionChangeFinished.connect(self.cb_marker_moved)
|
obj.sigRegionChangeFinished.connect(self.cb_marker_moved)
|
||||||
#bm.setTransform(tr) # assign transform
|
#bm.setTransform(tr) # assign transform
|
||||||
vb.addItem(bm)
|
vb.addItem(obj)
|
||||||
|
|
||||||
#--- testing scan grid ---
|
#--- testing scan grid ---
|
||||||
self.track_objects() # first call is needed to initialize the structure self._goTracked
|
#self.track_objects() # first call is needed to initialize the structure self._goTracked
|
||||||
# #go=UsrGO.Grid((120, -100), (200, 150), (30, 22), 2)
|
# #go=UsrGO.Grid((120, -100), (200, 150), (30, 22), 2)
|
||||||
# go=UsrGO.Grid((120, -100), (1000, 500), (10, 5), 2)
|
# go=UsrGO.Grid((120, -100), (1000, 500), (10, 5), 2)
|
||||||
# go.setTransform(tr) # assign transform
|
# go.setTransform(tr) # assign transform
|
||||||
@@ -508,6 +508,11 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
action.triggered.connect(self._OLD_escape_goToTellMountPosition)
|
action.triggered.connect(self._OLD_escape_goToTellMountPosition)
|
||||||
self.toolBar.addAction(action)
|
self.toolBar.addAction(action)
|
||||||
|
|
||||||
|
action = QAction(icon, "Test\nCode", self)
|
||||||
|
action.triggered.connect(self.cb_testcode)
|
||||||
|
self.toolBar.addAction(action)
|
||||||
|
|
||||||
|
|
||||||
self.toolBar.addWidget(qutilities.horiz_spacer())
|
self.toolBar.addWidget(qutilities.horiz_spacer())
|
||||||
|
|
||||||
icon = qtawesome.icon("material.sync")
|
icon = qtawesome.icon("material.sync")
|
||||||
@@ -1165,50 +1170,72 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
fy=fast_y.get_val()
|
fy=fast_y.get_val()
|
||||||
try:
|
try:
|
||||||
tracked=self._goTracked
|
tracked=self._goTracked
|
||||||
zoom_old,fx_old,fy_old=tracked['state']
|
zoom_old,fx_old,fy_old=tracked._state
|
||||||
except AttributeError: # at initialization
|
except AttributeError: # at initialization
|
||||||
self._goTracked={'objLst':list(), 'state':(zoom,fx,fy)}
|
self._goTracked=grp=pg.ItemGroup()
|
||||||
return
|
grp.setZValue(20) #higher than beam marker and opt ctr that have z=10
|
||||||
|
self.vb.addItem(grp)
|
||||||
|
grp._state=(zoom,fx,fy)
|
||||||
|
zoom_old=fx_old=fy_old=None
|
||||||
_log.debug(f"zoom:{zoom_old}->{zoom} fx:{fx_old}->{fx} fy:{fy_old}->{fy}")
|
_log.debug(f"zoom:{zoom_old}->{zoom} fx:{fx_old}->{fx} fy:{fy_old}->{fy}")
|
||||||
opt_ctr=geo._opt_ctr
|
opt_ctr=geo._opt_ctr
|
||||||
if zoom_old!=zoom:
|
if zoom_old!=zoom:
|
||||||
geo.interp_zoom(zoom_old)
|
#geo.interp_zoom(zoom_old)
|
||||||
pix2pos_old=geo._pix2pos
|
#pix2pos_old=geo._pix2pos
|
||||||
geo.interp_zoom(zoom)
|
geo.interp_zoom(zoom)
|
||||||
pix2pos_new=geo._pix2pos
|
pix2pos=geo._pix2pos
|
||||||
for o in tracked['objLst']:
|
# pos2pix: np.asarray(geo._pix2pos.I*np.mat(p).T).ravel()
|
||||||
# names consists of abrevations
|
A=np.asarray(pix2pos.I)
|
||||||
# part 0: po=position sz=size dt=delta
|
|
||||||
# part 1: px=pixel eu=engineering units (e.g. mm)
|
|
||||||
po_px=o.pos()
|
|
||||||
sz_px=o.size()
|
|
||||||
tr=o.transform()
|
|
||||||
geo._pix2pos=pix2pos_old
|
|
||||||
dt_px=-opt_ctr-po_px
|
|
||||||
dt_eu=geo.pix2pos(dt_px)
|
|
||||||
sz_eu=geo.pix2pos(sz_px)
|
|
||||||
|
|
||||||
geo._pix2pos=pix2pos_new
|
grp=self._goTracked
|
||||||
dt_px2=geo.pos2pix(dt_eu)
|
tr=grp.transform()
|
||||||
sz_px2=geo.pos2pix(sz_eu)
|
#UsrGO.obj_info(tr)
|
||||||
po_px2=-opt_ctr-dt_px2
|
bm=self._goBeamMarker
|
||||||
o.setPos(po_px2)
|
bm_pos=bm._pos_eu
|
||||||
o.setSize(sz_px2)
|
bm_sz=bm._size_eu
|
||||||
|
|
||||||
#np.asarray(self._pix2pos*np.mat(p).T).ravel()
|
pos=(-fx,-fy)-bm_pos
|
||||||
geo.interp_zoom(zoom)
|
#fx_px,fy_px=geo.pos2pix((fx,fy)-bm_pos)-opt_ctr
|
||||||
|
|
||||||
if fx_old!=fx or fy_old!=fy:
|
fx_px,fy_px=geo.pos2pix(pos)-opt_ctr
|
||||||
p1=geo.pos2pix((fx_old,fy_old))
|
tr.setMatrix(A[0,0], A[0,1], 0, #. . 100
|
||||||
p2=geo.pos2pix((fx,fy))
|
A[1,0], A[1,1], 0,
|
||||||
d=p1-p2
|
fx_px, fy_px, 1) #100 . . pixel right
|
||||||
|
grp.setTransform(tr)
|
||||||
|
|
||||||
for o in tracked['objLst']:
|
#for o in tracked['objLst']:
|
||||||
pos=o.pos()
|
# # names consists of abrevations
|
||||||
sz=o.size()
|
# # part 0: po=position sz=size dt=delta
|
||||||
tr=o.transform()
|
# # part 1: px=pixel eu=engineering units (e.g. mm)
|
||||||
o.setPos(pos+d)
|
# po_px=o.pos()
|
||||||
tracked['state']=(zoom, fx, fy)
|
# sz_px=o.size()
|
||||||
|
# tr=o.transform()
|
||||||
|
# geo._pix2pos=pix2pos_old
|
||||||
|
# dt_px=-opt_ctr-po_px
|
||||||
|
# dt_eu=geo.pix2pos(dt_px)
|
||||||
|
# sz_eu=geo.pix2pos(sz_px)
|
||||||
|
|
||||||
|
# geo._pix2pos=pix2pos_new
|
||||||
|
# dt_px2=geo.pos2pix(dt_eu)
|
||||||
|
# sz_px2=geo.pos2pix(sz_eu)
|
||||||
|
# po_px2=-opt_ctr-dt_px2
|
||||||
|
# o.setPos(po_px2)
|
||||||
|
# o.setSize(sz_px2)
|
||||||
|
|
||||||
|
#np.asarray(self._pix2pos*np.mat(p).T).ravel()
|
||||||
|
#geo.interp_zoom(zoom)
|
||||||
|
|
||||||
|
#if fx_old!=fx or fy_old!=fy:
|
||||||
|
# p1=geo.pos2pix((fx_old,fy_old))
|
||||||
|
# p2=geo.pos2pix((fx,fy))
|
||||||
|
# d=p1-p2
|
||||||
|
|
||||||
|
# for o in tracked['objLst']:
|
||||||
|
# pos=o.pos()
|
||||||
|
# sz=o.size()
|
||||||
|
# tr=o.transform()
|
||||||
|
# o.setPos(pos+d)
|
||||||
|
#tracked._state=(zoom, fx, fy)
|
||||||
#imgPos=self._goImg.mapFromScene(event.scenePos())
|
#imgPos=self._goImg.mapFromScene(event.scenePos())
|
||||||
#x=imgPos.x();y=imgPos.y()
|
#x=imgPos.x();y=imgPos.y()
|
||||||
|
|
||||||
@@ -1262,7 +1289,9 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
fx=fast_x.get_val()
|
fx=fast_x.get_val()
|
||||||
fy=fast_y.get_val()
|
fy=fast_y.get_val()
|
||||||
opt_ctr=geo._opt_ctr
|
opt_ctr=geo._opt_ctr
|
||||||
for go in self._goTracked['objLst']:
|
grp=self._goTracked
|
||||||
|
cldLst=grp.childItems()
|
||||||
|
for go in cldLst:
|
||||||
if type(go)!=UsrGO.FixTargetFrame:
|
if type(go)!=UsrGO.FixTargetFrame:
|
||||||
_log.warning(f'for now: ONLY FixTargetFrame are supported ->skipped:{go}')
|
_log.warning(f'for now: ONLY FixTargetFrame are supported ->skipped:{go}')
|
||||||
continue
|
continue
|
||||||
@@ -1312,7 +1341,9 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
fx=fast_x.get_val()
|
fx=fast_x.get_val()
|
||||||
fy=fast_y.get_val()
|
fy=fast_y.get_val()
|
||||||
opt_ctr=geo._opt_ctr
|
opt_ctr=geo._opt_ctr
|
||||||
for go in self._goTracked['objLst']:
|
grp=self._goTracked
|
||||||
|
cldLst=grp.childItems()
|
||||||
|
for go in cldLst:
|
||||||
points=go.get_points() #points in coordinate system of ROI
|
points=go.get_points() #points in coordinate system of ROI
|
||||||
# names consists of abrevations
|
# names consists of abrevations
|
||||||
# part 0: po=position sz=size dt=delta
|
# part 0: po=position sz=size dt=delta
|
||||||
@@ -1594,9 +1625,13 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
def build_tab_module_fix_target(self):
|
def build_tab_module_fix_target(self):
|
||||||
#tab = self._tab_daq_method_prelocated
|
#tab = self._tab_daq_method_prelocated
|
||||||
data=self._goTracked['objLst']
|
try:
|
||||||
|
objLst=self._goTracked.childItems()
|
||||||
|
except AttributeError:
|
||||||
|
_log.debug('NOT YET INITIALIZED')
|
||||||
|
objLst=None
|
||||||
|
|
||||||
self._moduleFixTarget =mft = ModuleFixTarget.WndFixTarget(self,data)
|
self._moduleFixTarget =mft = ModuleFixTarget.WndFixTarget(self,objLst)
|
||||||
tab = self._tabs_daq_methods.insertTab(0,mft,'Fix Target')
|
tab = self._tabs_daq_methods.insertTab(0,mft,'Fix Target')
|
||||||
mft.setAccessibleName(TASK_FIX_TARGET)
|
mft.setAccessibleName(TASK_FIX_TARGET)
|
||||||
self._tabs_daq_methods.setCurrentWidget(mft) #set this as the active tabs
|
self._tabs_daq_methods.setCurrentWidget(mft) #set this as the active tabs
|
||||||
@@ -1690,49 +1725,59 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
#cb.addItems(["Fiducial", "FixTarget(12.5x12.5)", "FixTarget(23.0x23.0)", "FixTarget(<param>)", "Grid(<param>)"])
|
#cb.addItems(["Fiducial", "FixTarget(12.5x12.5)", "FixTarget(23.0x23.0)", "FixTarget(<param>)", "Grid(<param>)"])
|
||||||
|
|
||||||
|
bm_pos_eu=self._goBeamMarker._pos_eu
|
||||||
|
bm_size_eu=self._goBeamMarker._size_eu
|
||||||
|
|
||||||
if idx==0:
|
if idx==0:
|
||||||
go=UsrGO.Fiducial(bm_pos+bm_sz/2-(20, 20), (40, 40),(fx,fy,bz))
|
#go=UsrGO.Fiducial(bm_pos+bm_sz/2-(20, 20), (40, 40),(fx,fy,bz))
|
||||||
|
l=.120
|
||||||
|
go=UsrGO.Fiducial((fx-l/2,fy-l/2), (l, l),(fx,fy,bz))
|
||||||
elif idx==1:
|
elif idx==1:
|
||||||
v=geo.pos2pix((12.5, 0))
|
v=geo.pos2pix((12.5, 0))
|
||||||
l=np.linalg.norm(v)
|
l=np.linalg.norm(v)
|
||||||
go=UsrGO.FixTargetFrame(bm_pos+bm_sz/2-(l/2,l/2), (l, l), tpl='12.5x12.5')
|
l=12.5
|
||||||
|
#ctr=bm_pos+bm_sz/2
|
||||||
|
go=UsrGO.FixTargetFrame((fx-l/2,fy-l/2), (l, l), tpl='12.5x12.5')
|
||||||
elif idx==2:
|
elif idx==2:
|
||||||
v=geo.pos2pix((23, 0))
|
v=geo.pos2pix((23, 0))
|
||||||
l=np.linalg.norm(v)
|
l=np.linalg.norm(v)
|
||||||
go=UsrGO.FixTargetFrame(bm_pos+bm_sz/2-(l/2,l/2), (l, l), tpl='23.0x23.0')
|
l=23
|
||||||
|
go=UsrGO.FixTargetFrame((fx-l/2,fx-l/2), (l, l), tpl='23.0x23.0')
|
||||||
elif idx==3:
|
elif idx==3:
|
||||||
go=UsrGO.FixTargetFrame(bm_pos+bm_sz/2-(200/2,150/2), (200, 150), tpl='test')
|
w,h=(.120*12, .120*8)
|
||||||
|
go=UsrGO.FixTargetFrame((fx-w/2,fx-h/2), (w, h), tpl='test')
|
||||||
elif idx==4:
|
elif idx==4:
|
||||||
go=UsrGO.Grid(bm_pos+bm_sz/2-(200/2,150/2), (200, 150), (30, 22), 2)
|
w,h=(30, 22)
|
||||||
|
go=UsrGO.Grid((fx-w/2,fx-h/2), (w, h), (30, 22), .1)
|
||||||
else:
|
else:
|
||||||
_log.error('index not handeled')
|
_log.error('index not handeled')
|
||||||
|
|
||||||
self.vb.addItem(go)
|
grp=self._goTracked
|
||||||
obj=self._goTracked['objLst']
|
grp.addItem(go)
|
||||||
obj.append(go)
|
mft._tree.setData(grp.childItems())
|
||||||
mft._tree.setData(obj)
|
|
||||||
|
|
||||||
def module_fix_target_del_all_obj(self):
|
def module_fix_target_del_all_obj(self):
|
||||||
mft=self._moduleFixTarget
|
mft=self._moduleFixTarget
|
||||||
vb=self.vb
|
vb=self.vb
|
||||||
objLst=self._goTracked['objLst']
|
grp=self._goTracked
|
||||||
for go in objLst:
|
for go in grp.childItems():
|
||||||
vb.removeItem(go)
|
vb.removeItem(go)
|
||||||
objLst.clear()
|
#grp.clear()
|
||||||
mft._tree.setData(objLst)
|
mft._tree.setData(None)
|
||||||
|
|
||||||
def module_fix_target_fit_fiducial(self):
|
def module_fix_target_fit_fiducial(self):
|
||||||
mft=self._moduleFixTarget
|
mft=self._moduleFixTarget
|
||||||
vb=self.vb
|
vb=self.vb
|
||||||
objLst=self._goTracked['objLst']
|
grp=self._goTracked
|
||||||
|
cldLst=grp.childItems()
|
||||||
n=0
|
n=0
|
||||||
for go in objLst:
|
for go in cldLst:
|
||||||
if type(go)==UsrGO.Fiducial:
|
if type(go)==UsrGO.Fiducial:
|
||||||
n+=1
|
n+=1
|
||||||
ptFitTrf=np.ndarray((4,2)) # 4 (x,y) points to fit a transformation of a parallelogram
|
ptFitTrf=np.ndarray((4,2)) # 4 (x,y) points to fit a transformation of a parallelogram
|
||||||
ptFitPlane=np.ndarray((n,3)) #n (x,y,z) points to fit a plane transformation z=ax+by+c
|
ptFitPlane=np.ndarray((n,3)) #n (x,y,z) points to fit a plane transformation z=ax+by+c
|
||||||
i=j=0
|
i=j=0
|
||||||
for go in reversed(objLst):
|
for go in reversed(cldLst):
|
||||||
if type(go)==UsrGO.FixTargetFrame:
|
if type(go)==UsrGO.FixTargetFrame:
|
||||||
if j==4:
|
if j==4:
|
||||||
#fid=np.array(((0.1, 0.1), (0.1, 1.1), (1.1, 0.1), (1.1, 1.1)))
|
#fid=np.array(((0.1, 0.1), (0.1, 1.1), (1.1, 0.1), (1.1, 1.1)))
|
||||||
@@ -1811,6 +1856,36 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
#plt.show(block=True)
|
#plt.show(block=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def cb_testcode(self):
|
||||||
|
try:
|
||||||
|
tc=self._testCode
|
||||||
|
tc['idx']+=1
|
||||||
|
except AttributeError:
|
||||||
|
self._testCode=tc={'idx':0}
|
||||||
|
step=tc['idx']
|
||||||
|
vb=self.vb
|
||||||
|
|
||||||
|
if step==0:
|
||||||
|
grp=pg.ItemGroup()
|
||||||
|
vb.addItem(grp)
|
||||||
|
obj=UsrGO.Marker((100,100), (100,100),mode=1)
|
||||||
|
grp.addItem(obj)
|
||||||
|
obj=UsrGO.Marker((150, 100), (50, 50), mode=1)
|
||||||
|
grp.addItem(obj)
|
||||||
|
obj=UsrGO.Marker((200, 100), (100, 100), mode=1)
|
||||||
|
grp.addItem(obj)
|
||||||
|
tc['grp']=grp
|
||||||
|
elif step==1:
|
||||||
|
grp=tc['grp']
|
||||||
|
tr=grp.transform()
|
||||||
|
#UsrGO.obj_info(tr)
|
||||||
|
tr.setMatrix(1, .2, 0,
|
||||||
|
-.2, 1, 0,
|
||||||
|
0, 0, 1)
|
||||||
|
grp.setTransform(tr)
|
||||||
|
|
||||||
|
print(vb.childGroup.childItems())
|
||||||
|
pass
|
||||||
# **************** OBSOLETE AND/OR OLD STUFF ****************
|
# **************** OBSOLETE AND/OR OLD STUFF ****************
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user