本文整理汇总了Python中PyQt4.QtGui.QTransform.m21方法的典型用法代码示例。如果您正苦于以下问题:Python QTransform.m21方法的具体用法?Python QTransform.m21怎么用?Python QTransform.m21使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QTransform
的用法示例。
在下文中一共展示了QTransform.m21方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_loader
# 需要导入模块: from PyQt4.QtGui import QTransform [as 别名]
# 或者: from PyQt4.QtGui.QTransform import m21 [as 别名]
def run_loader(self):
filename = self.result
try:
self.retryObject = None
# First, prepare the data by getting the images and computing how big they
# should be
f = open(filename)
first_line = f.readline()
f.close()
if first_line.startswith("TRKR_VERSION"):
result = Result(None)
result.load(self.result, **self._loading_arguments)
result_type = "Growth"
else:
result = TrackingData()
result.load(self.result, **self._loading_arguments)
result_type = "Data"
self.result = result
self.result_type = result_type
if result_type == "Data":
data = result
images = data.images_name
if data.cells:
self.has_cells = True
self.has_walls = True
else:
self.has_cells = False
self.has_walls = False
self.has_points = bool(data.cell_points)
else:
data = result.data
images = result.images
self.has_cells = False
self.has_walls = False
self.has_points = False
self.images = images
cache = image_cache.cache
self.update_nb_images(len(result))
bbox = QRectF()
ms = data.minScale()
for i in range(len(result)):
img_name = images[i]
img_data = data[img_name]
img = cache.image(data.image_path(img_name))
matrix = QTransform()
matrix = img_data.matrix()
sc = QTransform()
sc.scale(1.0/ms, 1.0/ms)
matrix *= sc
r = QRectF(img.rect())
rbox = matrix.map(QPolygonF(r)).boundingRect()
bbox |= rbox
log_debug("Image '%s':\n\tSize = %gx%g\n\tTransformed = %gx%g %+g %+g\n\tGlobal bbox = %gx%g %+g %+g\n" %
(img_name, r.width(), r.height(), rbox.width(), rbox.height(), rbox.left(), rbox.top(),
bbox.width(), bbox.height(), bbox.left(), bbox.top()))
log_debug("Matrix:\n%g\t%g\t%g\n%g\t%g\t%g\n" %
(matrix.m11(), matrix.m12(), matrix.dx(), matrix.m21(), matrix.m22(), matrix.dy()))
if result_type == "Growth":
if result.cells[i]:
self.has_cells = True
if result.walls[i]:
self.has_walls = True
self.has_points = bool(result.data.cell_points)
self.nextImage()
translate = bbox.topLeft()
translate *= -1
self.translate = translate
size = bbox.size().toSize()
self.img_size = size
self._crop = QRect(QPoint(0,0), size)
self.finished()
self._loading_arguments = {} # All done, we don't need that anymore
except RetryTrackingDataException as ex:
ex.filename = filename
self.retryObject = ex
self.finished()
return
except Exception as ex:
_, _, exceptionTraceback = sys.exc_info()
self.abort(ex, traceback=exceptionTraceback)
raise