コード例 #1
0
 def test_show_segmentation_qt_widget(self):
     # from teigen.dictwidgetqt import DictWidget
     # from teigen.generators.cylindersqt import CylindersWidget
     import imtools.show_segmentation_qt as ssqt
     # app = QtGui.QApplication(sys.argv)
     app = QApplication(sys.argv)
     sw = ssqt.ShowSegmentationWidget(None, show_load_interface=True)
     sw.show()
     app.exec_()
コード例 #2
0
    def test_show_donut(self):
        """
        creates VTK file from input data
        :return:
        """
        datap = imtools.sample_data.donut()

        segmentation = datap['segmentation']
        voxelsize_mm = datap['voxelsize_mm']

        import imtools.show_segmentation_qt as ssqt
        app = QApplication(sys.argv)
        # app.setGraphicsSystem("openvg")
        sw = ssqt.ShowSegmentationWidget(None, show_load_button=True, show_load_interface=True)
        sw.smoothing = False
        sw.add_data(segmentation, voxelsize_mm=voxelsize_mm)
        # QTest.mouseClick(sw.ui_buttons['Show volume'], Qt.LeftButton)
        # sw.add_vtk_file("~/projects/imtools/mesh.vtk")
        sw.show()
        app.exec_()
コード例 #3
0
    def test_add_data_and_show(self):
        """
        creates VTK file from input data and show and quit
        :return:
        """
        datap = imtools.sample_data.donut()

        segmentation = datap['segmentation']
        voxelsize_mm = datap['voxelsize_mm']

        import imtools.show_segmentation_qt as ssqt
        app = QApplication(sys.argv)
        # app.setGraphicsSystem("openvg")
        sw = ssqt.ShowSegmentationWidget(None, show_load_button=True)
        sw.smoothing = False
        sw.add_data(segmentation, voxelsize_mm=voxelsize_mm)
        QTest.mouseClick(sw.ui_buttons['Show volume'], Qt.LeftButton)
        # sw.add_vtk_file("~/projects/imtools/mesh.vtk")
        sw.show()
        # app.exec_(exec_)
        sw.close()
        output_vtk_file = sw.vtk_file
        output_vtk_file = sw.get_filename_filled_with_checked_labels("*")
        # sw.
        sw.deleteLater()

        sw = None
        app.quit()
        app.deleteLater()
        # self.qapp.quit()
        # self.qapp.deleteLater()
        # gc.collect()

        # app = QApplication(sys.argv)
        # app.quit()
        # self.qapp.exit()
        # app.exec_()

        output_vtk_file_star = op.abspath(op.expanduser(output_vtk_file))
        filelist = glob.glob(output_vtk_file_star)
        self.assertGreater(len(filelist), 0)
コード例 #4
0
    def test_show_segmentation_qt_widget_hidden_buttons(self):
        # = np.zeros([10, 10, 10])
        # imtools.sam
        # imtools.sample_data.get_sample_data("sliver_training_001")
        # from teigen.dictwidgetqt import DictWidget
        # from teigen.generators.cylindersqt import CylindersWidget
        import imtools.show_segmentation_qt as ssqt
        app = QApplication(sys.argv)
        # app = QApplication([])

        # if "TRAVIS" in os.environ:
        #     app.setGraphicsSystem("openvg")
        # sw = ssqt.ShowSegmentationWidget(None, show_buttons=False)
        sw = ssqt.ShowSegmentationWidget(None, show_load_interface=True)
        self.assertIn("add_data_file", sw.ui_buttons.keys())
        sw.show()
        # app.exec_()
        sw.close()
        sw.deleteLater()
        sw = None
        app.quit()
        app.deleteLater()