<commit_before>#! /usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import unittest

from PyQt4 import QtGui
from PyQt4.QtGui import QApplication
from nose.plugins.attrib import attr

import imtools.sample_data
import imtools.select_label_qt


class MyTestCase(unittest.TestCase):
    def setUp(self):
        pass
        # self.qapp = QApplication(sys.argv)


    @attr('interactive')
    def test_select_labels(self):
        """
        creates VTK file from input data
        :return:
        """
        datap = imtools.sample_data.donut()

        segmentation = datap['segmentation']
        voxelsize_mm = datap['voxelsize_mm']
        slab = datap["slab"]
        slab["label 20"] = 20
        slab["label 19"] = 19
        slab["label 18"] = 18
        slab["label 17"] = 17
        slab["label 16"] = 16
        slab["label 15"] = 15
        slab["label 14"] = 14
        slab["label 13"] = 13
        slab["label 12"] = 12
        slab["label 11"] = 11
        slab["label 10"] = 10
        slab["label 9"] = 9
        slab["label 8"] = 8
        slab["label 7"] = 7
        slab["label 6"] = 6
        slab["label 5"] = 5

        import imtools.show_segmentation_qt as ssqt
        app = QApplication(sys.argv)
        # app.setGraphicsSystem("openvg")
        sw = ssqt.SelectLabelWidget(slab=slab, segmentation=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_()


    def test_pyqtgraph(self):
        """
        creates VTK file from input data
        :return:<commit_msg>pyqtgraph test skipped as interactive<commit_after>#! /usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import unittest

from PyQt4 import QtGui
from PyQt4.QtGui import QApplication
from nose.plugins.attrib import attr

import imtools.sample_data
import imtools.select_label_qt


class MyTestCase(unittest.TestCase):
    def setUp(self):
        pass
        # self.qapp = QApplication(sys.argv)


    @attr('interactive')
    def test_select_labels(self):
        """
        creates VTK file from input data
        :return:
        """
        datap = imtools.sample_data.donut()

        segmentation = datap['segmentation']
        voxelsize_mm = datap['voxelsize_mm']
        slab = datap["slab"]
        slab["label 20"] = 20
        slab["label 19"] = 19
        slab["label 18"] = 18
        slab["label 17"] = 17
        slab["label 16"] = 16
        slab["label 15"] = 15
        slab["label 14"] = 14
        slab["label 13"] = 13
        slab["label 12"] = 12
        slab["label 11"] = 11
        slab["label 10"] = 10
        slab["label 9"] = 9
        slab["label 8"] = 8
        slab["label 7"] = 7
        slab["label 6"] = 6
        slab["label 5"] = 5

        import imtools.show_segmentation_qt as ssqt
        app = QApplication(sys.argv)
        # app.setGraphicsSystem("openvg")
        sw = ssqt.SelectLabelWidget(slab=slab, segmentation=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_()

    @attr('interactive')
    def test_pyqtgraph(self):
        """
        creates VTK file from input data
        :return:
{'fraction_non_alphanumeric': 0.12470238095238095, 'fraction_numerical': 0.033928571428571426, 'mean_word_length': 2.2599418040737147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2233048', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1092, 'n_words': 252}