Esempio n. 1
0
 def __init__(self, location):
     '''
     Constructor
     '''
     super(SegmentationStep, self).__init__('Segmentation', location)
     self._identifier = ''
     # self._icon = QtGui.QImage(':/segmentation/icons/seg.gif')
     self._icon = QtGui.QImage(':/segmentation/icons/segmentationicon.png')
     self.addPort(
         ('http://physiomeproject.org/workflow/1.0/rdf-schema#port',
          'http://physiomeproject.org/workflow/1.0/rdf-schema#uses',
          'http://physiomeproject.org/workflow/1.0/rdf-schema#images'))
     self.addPort(
         ('http://physiomeproject.org/workflow/1.0/rdf-schema#port',
          'http://physiomeproject.org/workflow/1.0/rdf-schema#provides',
          'http://physiomeproject.org/workflow/1.0/rdf-schema#pointcloud'))
     self._model = SegmentationModel()
     self._category = 'Segmentation'
     self._view = None
     self._dataIn = None
     #        self._configured = True
     self._state = ConfigureDialogState()
Esempio n. 2
0
    def __init__(self, location):
        '''
        Constructor
        '''
        super(SegmentationStep, self).__init__('Segmentation', location)
        self._identifier = ''
        self._icon = QtGui.QImage(':/segmentation/icons/seg.gif')
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port', 'http://physiomeproject.org/workflow/1.0/rdf-schema#uses', 'http://physiomeproject.org/workflow/1.0/rdf-schema#images'))
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port', 'http://physiomeproject.org/workflow/1.0/rdf-schema#provides', 'http://physiomeproject.org/workflow/1.0/rdf-schema#pointcloud'))
        self._model = SegmentationModel()
        self._category = 'Segmentation'
        self._view = None
        self._dataIn = None
#        self._configured = True
        self._state = ConfigureDialogState()
Esempio n. 3
0
class SegmentationStep(WorkflowStepMountPoint):
    '''
    A step that acts like the step plugin duck
    '''

    def __init__(self, location):
        '''
        Constructor
        '''
        super(SegmentationStep, self).__init__('Segmentation', location)
        self._identifier = ''
        self._icon = QtGui.QImage(':/segmentation/icons/seg.gif')
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port', 'http://physiomeproject.org/workflow/1.0/rdf-schema#uses', 'http://physiomeproject.org/workflow/1.0/rdf-schema#images'))
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port', 'http://physiomeproject.org/workflow/1.0/rdf-schema#provides', 'http://physiomeproject.org/workflow/1.0/rdf-schema#pointcloud'))
        self._model = SegmentationModel()
        self._category = 'Segmentation'
        self._view = None
        self._dataIn = None
#        self._configured = True
        self._state = ConfigureDialogState()

    def configure(self):
        
        d = ConfigureDialog(self._state, QtGui.QApplication.activeWindow().currentWidget())
        d.setModal(True)
        if d.exec_():
            self._state = d.getState()

        self._configured = d.validate()
        if self._configured and self._configuredObserver != None:
            self._configuredObserver()

    def getIdentifier(self):
        return self._state.identifier()

    def setIdentifier(self, identifier):
        self._state.setIdentifier(identifier)

    def serialize(self):
        return self._state.serialize()

    def deserialize(self, string):
        self._state.deserialize(string)
        d = ConfigureDialog(self._state)
        self._configured = d.validate()

    def setPortData(self, portId, dataIn):
        self._dataIn = dataIn

    def getPortData(self, portId):
        return self._model.getPointCloud()

    def execute(self):
        if self._view is None:
            self._model.loadImages(self._dataIn)
            self._model.initialize()
            self._view = SegmentationWidget(self._model)
            self._view.setSerializationLocation(os.path.join(self._location, self.getIdentifier()))
            self._view._ui.doneButton.clicked.connect(self._doneExecution)

        self._setCurrentUndoRedoStack(self._model.getUndoRedoStack())
        self._setCurrentWidget(self._view)
Esempio n. 4
0
class SegmentationStep(WorkflowStepMountPoint):
    '''
    A step that acts like the step plugin duck
    '''
    def __init__(self, location):
        '''
        Constructor
        '''
        super(SegmentationStep, self).__init__('Segmentation', location)
        self._identifier = ''
        # self._icon = QtGui.QImage(':/segmentation/icons/seg.gif')
        self._icon = QtGui.QImage(':/segmentation/icons/segmentationicon.png')
        self.addPort(
            ('http://physiomeproject.org/workflow/1.0/rdf-schema#port',
             'http://physiomeproject.org/workflow/1.0/rdf-schema#uses',
             'http://physiomeproject.org/workflow/1.0/rdf-schema#images'))
        self.addPort(
            ('http://physiomeproject.org/workflow/1.0/rdf-schema#port',
             'http://physiomeproject.org/workflow/1.0/rdf-schema#provides',
             'http://physiomeproject.org/workflow/1.0/rdf-schema#pointcloud'))
        self._model = SegmentationModel()
        self._category = 'Segmentation'
        self._view = None
        self._dataIn = None
        #        self._configured = True
        self._state = ConfigureDialogState()

    def configure(self):

        d = ConfigureDialog(self._state,
                            QtGui.QApplication.activeWindow().currentWidget())
        d.setModal(True)
        if d.exec_():
            self._state = d.getState()

        self._configured = d.validate()
        if self._configured and self._configuredObserver is not None:
            self._configuredObserver()

    def getIdentifier(self):
        return self._state.identifier()

    def setIdentifier(self, identifier):
        self._state.setIdentifier(identifier)

    def serialize(self):
        return self._state.serialize()

    def deserialize(self, string):
        self._state.deserialize(string)
        d = ConfigureDialog(self._state)
        self._configured = d.validate()

    def setPortData(self, portId, dataIn):
        self._dataIn = dataIn

    def getPortData(self, portId):
        return self._model.getPointCloud()

    def execute(self):
        if self._view is None:
            self._model.loadImages(self._dataIn)
            self._model.initialize()
            self._view = SegmentationWidget(self._model)
            self._view.setSerializationLocation(
                os.path.join(self._location, self.getIdentifier()))
            self._view.registerDoneExecution(self._doneExecution)

        self._setCurrentUndoRedoStack(self._model.getUndoRedoStack())
        self._setCurrentWidget(self._view)
Esempio n. 5
0
class SegmentationStep(WorkflowStepMountPoint):
    '''
    A step that acts like the step plugin duck
    '''

    def __init__(self, location):
        '''
        Constructor
        '''
        super(SegmentationStep, self).__init__('Segmentation', location)
        self._identifier = ''
        # self._icon = QtGui.QImage(':/segmentation/icons/seg.gif')
        self._icon = QtGui.QImage(':/segmentation/icons/segmentationicon.png')
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port',
                      'http://physiomeproject.org/workflow/1.0/rdf-schema#uses',
                      'http://physiomeproject.org/workflow/1.0/rdf-schema#images'))
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port',
                      'http://physiomeproject.org/workflow/1.0/rdf-schema#provides',
                      'ju#pointcoordinates'))
        self._model = SegmentationModel()
        self._category = 'Segmentation'
        self._view = None
        self._dataIn = None
#        self._configured = True
        self._state = ConfigureDialogState()

    def configure(self):
        d = ConfigureDialog(self._state)
        d.setModal(True)
        if d.exec_():
            self._state = d.getState()

        self._configured = d.validate()
        if self._configured and self._configuredObserver != None:
            self._configuredObserver()

    def getIdentifier(self):
        return self._state.identifier()

    def setIdentifier(self, identifier):
        self._state.setIdentifier(identifier)

    def _setStepLocation(self, location):
        self._step_location = os.path.join(location, self._state.identifier())

    def serialize(self, location):
        self._setStepLocation(location)
        if not os.path.exists(self._step_location):
            os.mkdir(self._step_location)

        s = QtCore.QSettings(os.path.join(self._step_location, STEP_SERIALISATION_FILENAME), QtCore.QSettings.IniFormat)
        self._state.save(s)

    def deserialize(self, location):
        self._setStepLocation(location)
        s = QtCore.QSettings(os.path.join(self._step_location, STEP_SERIALISATION_FILENAME), QtCore.QSettings.IniFormat)
        self._state.load(s)
        d = ConfigureDialog(self._state)
        self._configured = d.validate()

    def setPortData(self, portId, dataIn):
        self._dataIn = dataIn

    def getPortData(self, portId):
        return self._model.getPointCloud()

    def execute(self):
        if not self._view:
            self._model.loadImages(self._dataIn)
            self._model.initialize()
            self._view = SegmentationWidget(self._model)
            self._view.setSerializationLocation(self._step_location)
            self._view._ui.doneButton.clicked.connect(self._doneExecution)

        self._setCurrentUndoRedoStack(self._model.getUndoRedoStack())
        self._setCurrentWidget(self._view)