saving document, plane and fiducal fitter
This commit is contained in:
@@ -12,6 +12,8 @@ TODO: Dimension of pyqtgraph is in um not pixel (as now)
|
||||
'''
|
||||
|
||||
#import initExample ## Add path to library (just for examples; you do not need this)
|
||||
import logging
|
||||
_log=logging.getLogger(__name__)
|
||||
|
||||
import pyqtgraph as pg
|
||||
from pyqtgraph.Qt import QtCore, QtGui
|
||||
@@ -316,7 +318,8 @@ class Path(pg.ROI):
|
||||
p.drawLines(lh,lv)
|
||||
|
||||
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())}, numFid:{self._fiducial.shape[0]}, numPts:{self._path.shape[0]}, ficucialScale:{self._fidScl}}}'
|
||||
|
||||
return s
|
||||
|
||||
def obj2json(self,encoder):
|
||||
@@ -373,7 +376,15 @@ class FixTargetFrame(pg.ROI):
|
||||
}
|
||||
|
||||
def __init__( self, pos=(0,0), size=(100,100), tpl='test', dscr=None, **kwargs):
|
||||
trf=kwargs.pop('trf',None)
|
||||
pg.ROI.__init__(self, pos, size, **kwargs)
|
||||
if trf is not None:
|
||||
t=self.transform()
|
||||
t.setMatrix(trf[0][0], trf[0][1], 0,
|
||||
trf[1][0], trf[1][1], 0,
|
||||
0, 0, 1)
|
||||
self.setTransform(t)
|
||||
|
||||
#fiducial type 0: 5 squares with pitch 120 um
|
||||
if dscr is not None:
|
||||
self._dscr=dscr
|
||||
@@ -383,6 +394,9 @@ class FixTargetFrame(pg.ROI):
|
||||
self.addScaleHandle([1, 1], [0, 0])
|
||||
self.addScaleHandle([0, 0], [1, 1])
|
||||
self.addScaleRotateHandle([1, 0], [0, 0])
|
||||
#self.sigHoverEvent.connect(self.hover)
|
||||
# def hover(self):
|
||||
# _log.debug(f'hover {self}')
|
||||
|
||||
def paint(self, p, *args):
|
||||
#pg.ROI.paint(self, p, *args)
|
||||
@@ -445,6 +459,11 @@ class FixTargetFrame(pg.ROI):
|
||||
'size':tuple(self.size()),
|
||||
'dscr': self._dscr
|
||||
}
|
||||
trf=self.transform()
|
||||
if not trf.isIdentity():
|
||||
obj_info(trf)
|
||||
trf=((trf.m11(),trf.m12()),(trf.m21(),trf.m22()))
|
||||
jsn['trf']=trf
|
||||
return jsn
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user