当前位置: 首页>>代码示例>>Python>>正文


Python QVTKRenderWindowInteractor.setMinimumSize方法代码示例

本文整理汇总了Python中vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor.setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Python QVTKRenderWindowInteractor.setMinimumSize方法的具体用法?Python QVTKRenderWindowInteractor.setMinimumSize怎么用?Python QVTKRenderWindowInteractor.setMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor的用法示例。


在下文中一共展示了QVTKRenderWindowInteractor.setMinimumSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AppWindow

# 需要导入模块: from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor [as 别名]
# 或者: from vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor import setMinimumSize [as 别名]

#.........这里部分代码省略.........
        #print(dir(mapper))
        mapper.SetInput(self.poly)
        mapper.ScalarVisibilityOn()
        mapper.SetScalarModeToUsePointData()
        mapper.Update()

        self.actor = vtk.vtkActor2D()
        self.actor.SetMapper(mapper)
        self.viewer.GetRenderer().AddActor2D(self.actor)

        self.dist = dist



    def loadSingleFile(self):
        loader = self.fileLoader
        loader.loadFile()

        if loader.accepted:
            loader.setDir(os.path.dirname(str(loader.selectedFile)))
            self.disableSlider()
            self.dicomReader = vtkgdcm.vtkGDCMImageReader()
            self.dicomReader.SetFileName(str(loader.selectedFile))

            print(dir(self.dicomReader))
            print(self.dicomReader.GetScale())

            self.dicomReader.Update()
            imageData = self.dicomReader.GetOutput()
            size = imageData.GetDimensions()
            width = size[0]
            height = size[1]
            self.vtkWidget.setMaximumSize(QtCore.QSize(width, height))
            self.vtkWidget.setMinimumSize(QtCore.QSize(width, height))

            RefDs = dicom.read_file(str(loader.selectedFile))
            ConstPixelDims = (int(RefDs.Rows), int(RefDs.Columns), 1)

            pointData = imageData.GetPointData()
            arrayData = pointData.GetArray(0)
            arrayDicom = numpy_support.vtk_to_numpy(arrayData)
            arrayDicom = arrayDicom.reshape(ConstPixelDims, order='F')
            shape = arrayDicom.shape
            wtf = arrayDicom.reshape(shape[0], shape[1])
            wtf = numpy.fliplr(wtf).transpose()
            max = numpy.max(wtf)
            min = numpy.min(wtf)
            print(numpy.max(wtf))
            print(numpy.min(wtf))
            grad = numpy.gradient(wtf)

            print(wtf)
            computed = numpy.sqrt(numpy.square(grad[0]) + numpy.square(grad[1]))
            #self.proc.start()
            ax = self.figure.add_subplot(111)
            ax.imshow(wtf, interpolation="nearest", cmap=plt.get_cmap('gray'), vmin=0, vmax=max)
            self.canvas.draw()


            #points = vtk.vtkPoints()
            #points.SetNumberOfPoints(2)
            #points.Allocate(2)

            #points.InsertPoint(0, 100, 100, 0.001)
            #points.InsertPoint(0, 200, 200, 0.001)
开发者ID:Nefarin,项目名称:SODM,代码行数:69,代码来源:AppWindow.py

示例2: QVTKRenderWindowInteractor

# 需要导入模块: from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor [as 别名]
# 或者: from vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor import setMinimumSize [as 别名]
 tool2.toggled.connect(editSwc)
 toolbar1.addAction(tool2)
 tool3 = QtGui.QAction(toolbar1)
 tool3_icon = QtGui.QIcon()
 tool3_icon.addFile(r'G:\sulei\workplace\TraceTool\Resource\Science.png')
 tool3.setIcon(tool3_icon)
 tool3.triggered.connect(changeLineWidth)
 toolbar1.addAction(tool3)
 
 
 mainwin.addToolBar(toolbar1)
 mainwin.setMenuBar(menubar1)
 mainwin_location = QtCore.QRect(600, 300, 400, 400)
 mainwin.setMaximumSize(400, 400)
 mainwin.setGeometry(mainwin_location)
 central_widget = QtGui.QWidget(mainwin)
 mainwin.setCentralWidget(central_widget)
 layout1 = QtGui.QHBoxLayout()
 central_widget.setLayout(layout1)
 vtk_widget = QVTKRenderWindowInteractor(central_widget)
 vtk_widget.setMinimumSize(50, 50)
 layout1.addWidget(vtk_widget)
 vtk_widget.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
 ren = vtk.vtkRenderer()
 style1 = SwcEditStyle()
 iren = vtk_widget.GetRenderWindow().GetInteractor()
 iren.SetInteractorStyle(style1)
 vtk_widget.Initialize()
 vtk_widget.Start()
 mainwin.show()
 sys.exit(app.exec_())
开发者ID:sulei1324,项目名称:lab_codes,代码行数:33,代码来源:ui.py


注:本文中的vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor.setMinimumSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。