예제 #1
0
    def close(self):
        """Clean-up method called on all DeVIDE modules when they are
        deleted.
        FIXME: Still get a nasty X error :(
        """

        # with this complicated de-init, we make sure that VTK is 
        # properly taken care of
        self.ren.RemoveAllViewProps()
        self.ren2.RemoveAllViewProps()
        self.ren3.RemoveAllViewProps()

        # this finalize makes sure we don't get any strange X
        # errors when we kill the module.
        self.slice_viewer1.close()
        self.slice_viewer2.close()
        self.slice_viewer3.close()
        self._view_frame.rwi.GetRenderWindow().Finalize()
        self._view_frame.rwi.SetRenderWindow(None)
        self._view_frame.overlay.GetRenderWindow().Finalize()
        self._view_frame.overlay.SetRenderWindow(None)
        self._view_frame.original.GetRenderWindow().Finalize()
        self._view_frame.original.SetRenderWindow(None)
        del self._view_frame.rwi
        del self._view_frame.overlay
        del self._view_frame.original
        del self.slice_viewer3
        del self.slice_viewer2
        del self.slice_viewer1
        # done with VTK de-init

        # now take care of the wx window
        self._view_frame.close()
        # then shutdown our introspection mixin
        IntrospectModuleMixin.close(self)
예제 #2
0
    def close(self):
        # we play it safe... (the graph_editor/module_manager should have
        # disconnected us by now)
        for input_idx in range(len(self.get_input_descriptions())):
            self.set_input(input_idx, None)

        # get rid of our reference
        del self._splatMapper
        del self._otf
        del self._ctf
        del self._volumeProperty
        del self._volume

        del self._object_dict

        ColourDialogMixin.close(self)
        # we have to call this mixin close so that all inspection windows
        # can be taken care of.  They should be taken care of in anycase
        # when the viewFrame is destroyed, but we like better safe than
        # sorry
        IntrospectModuleMixin.close(self)

        # take care of our own window
        if self._view_frame is not None:
            self._view_frame.Destroy()
            del self._view_frame
예제 #3
0
    def close(self):
        IntrospectModuleMixin.close(self)

        if self._view_frame is not None:
            self._view_frame.Destroy()

        ModuleBase.close(self) 
예제 #4
0
 def close(self):
     # we play it safe... (the graph_editor/module_manager should have
     # disconnected us by now)
     self.set_input(0, None)
     # close down the vtkPipeline stuff
     IntrospectModuleMixin.close(self)
     # take out our view interface
     if self._view_frame is not None:
         self._view_frame.Destroy()
         
     # get rid of our reference
     del self._imageThreshold
예제 #5
0
    def close(self):
        if self._fileDialog is not None:
            del self._fileDialog
            
        # this will take care of all the vtkPipeline windows
        IntrospectModuleMixin.close(self)

        if self._viewFrame is not None:
            # take care of our own window
            self._viewFrame.Destroy()
            
        # also remove the binding we have to our reader
        del self._reader
예제 #6
0
 def close(self):
     # we play it safe... (the graph_editor/module_manager should have
     # disconnected us by now)
     self.set_input(0, None)
     # don't forget to call the close() method of the vtkPipeline mixin
     IntrospectModuleMixin.close(self)
     # take out our view interface
     if self._view_frame is not None:
         self._view_frame.Destroy()
         
     # get rid of our reference
     del self._imageGaussianSmooth
     # and finally call our base dtor
     ModuleBase.close(self)
예제 #7
0
파일: CoMedI.py 프로젝트: fvpolpeta/devide
    def close(self):
        """Clean-up method called on all DeVIDE modules when they are
        deleted.
        """

        # get rid of match_mode
        self.match_mode.close()

        self._close_vis()
        
        # now take care of the wx window
        self._view_frame.close()
        # then shutdown our introspection mixin
        IntrospectModuleMixin.close(self)
예제 #8
0
파일: mixins.py 프로젝트: fvpolpeta/devide
    def close(self):
        # we play it safe... (the graph_editor/module_manager should have
        # disconnected us by now)
        for input_idx in range(len(self.get_input_descriptions())):
            self.set_input(input_idx, None)
        
        PickleVTKObjectsModuleMixin.close(self)
        IntrospectModuleMixin.close(self)

        if self._viewFrame is not None:
            self._configVtkObj.close()
            self._viewFrame.Destroy()
            
        ModuleBase.close(self)
        # get rid of our binding to the vtkObject
        del self._theFilter
예제 #9
0
    def close(self):
        IntrospectModuleMixin.close(self)

        # we just delete our binding.  Destroying the view_frame
        # should also take care of this one.
        del self._file_dialog

        if self._view_frame is not None:
            self._view_frame.Destroy()

        self._output_mmd.close() 
        del self._output_mmd

        del self._reader

        ModuleBase.close(self) 
예제 #10
0
    def close(self):
        
        # with this complicated de-init, we make sure that VTK is 
        # properly taken care of
        self._image_viewer.GetRenderer().RemoveAllViewProps()
        self._image_viewer.SetupInteractor(None)
        self._image_viewer.SetRenderer(None)
        # this finalize makes sure we don't get any strange X
        # errors when we kill the module.
        self._image_viewer.GetRenderWindow().Finalize()
        self._image_viewer.SetRenderWindow(None)
        del self._image_viewer
        # done with VTK de-init

        self._view_frame.close()
        self._view_frame = None
        IntrospectModuleMixin.close(self)
    def close(self):
        """Clean-up method called on all DeVIDE modules when they are
        deleted.
        FIXME: Still get a nasty X error :(
        """        
        #THE FRAME (reference)
        frame = self.frame

        # with this complicated de-init, we make sure that VTK is 
        # properly taken care of
        self.renderer_top.RemoveAllViewProps()
        self.renderer_side.RemoveAllViewProps()
        self.renderer_front.RemoveAllViewProps()
        self.renderer_3d.RemoveAllViewProps()

        # this finalize makes sure we don't get any strange X
        # errors when we kill the module.
        self.slice_viewer_top.close()
        self.slice_viewer_side.close()
        self.slice_viewer_front.close()
        frame.top.GetRenderWindow().Finalize()
        frame.top.SetRenderWindow(None)
        frame.side.GetRenderWindow().Finalize()
        frame.side.SetRenderWindow(None)
        frame.front.GetRenderWindow().Finalize()
        frame.front.SetRenderWindow(None)
        frame.view3d.GetRenderWindow().Finalize()
        frame.view3d.SetRenderWindow(None)
        del frame.top
        del frame.side
        del frame.front
        del frame.view3d
        del self.slice_viewer_top
        del self.slice_viewer_side
        del self.slice_viewer_front
        # done with VTK de-init

        # now take care of the wx window
        frame.close()
        # then shutdown our introspection mixin
        IntrospectModuleMixin.close(self)
예제 #12
0
    def close(self):
        """Clean-up method called on all DeVIDE modules when they are
        deleted.
        """
        
        # we have to take care of de-initialising the timer as well
        if self.timer:
            self.timer.Stop()
            del self.timer
        
        # with this complicated de-init, we make sure that VTK is 
        # properly taken care of
        self.ren.RemoveAllViewProps()
        # this finalize makes sure we don't get any strange X
        # errors when we kill the module.
        self._view_frame.rwi.GetRenderWindow().Finalize()
        self._view_frame.rwi.SetRenderWindow(None)
        del self._view_frame.rwi
        # done with VTK de-init

        # now take care of the wx window
        self._view_frame.close()
        # then shutdown our introspection mixin
        IntrospectModuleMixin.close(self)
예제 #13
0
    def close(self):
        """Clean-up method called on all DeVIDE modules when they are
        deleted.
        """

        # we have to take care of de-initialising the timer as well
        if self.timer:
            self.timer.Stop()
            del self.timer

        # with this complicated de-init, we make sure that VTK is
        # properly taken care of
        self.ren.RemoveAllViewProps()
        # this finalize makes sure we don't get any strange X
        # errors when we kill the module.
        self._view_frame.rwi.GetRenderWindow().Finalize()
        self._view_frame.rwi.SetRenderWindow(None)
        del self._view_frame.rwi
        # done with VTK de-init

        # now take care of the wx window
        self._view_frame.close()
        # then shutdown our introspection mixin
        IntrospectModuleMixin.close(self)
예제 #14
0
    def close(self):
        # shut down the orientationWidget/Actor stuff
        self._orientation_widget.Off()
        self._orientation_widget.SetInteractor(None)
        self._orientation_widget.SetOrientationMarker(None)
        del self._orientation_widget
        del self._annotated_cube_actor
        
        # take care of scalarbar
        self._showScalarBarForProp(None)
        
        # this is standard behaviour in the close method:
        # call set_input(idx, None) for all inputs
        for idx in range(self._numDataInputs):
            self.set_input(idx, None)

        # take care of the sliceDirections
        self.sliceDirections.close()
        del self.sliceDirections

        # the points
        self.selectedPoints.close()
        del self.selectedPoints

        # take care of the threeD objects
        self._tdObjects.close()
        del self._tdObjects

        # the implicits
        self._implicits.close()
        del self._implicits

        # don't forget to call the mixin close() methods
        IntrospectModuleMixin.close(self)
        ColourDialogMixin.close(self)
        
        # unbind everything that we bound in our __init__
        del self._outline_source
        del self._outline_actor
        del self._cube_axes_actor2d

        del self._voi_widget
        #del self._extractVOI

        del self._cInteractorStyle

        # make SURE there are no props in the Renderer
        self._threedRenderer.RemoveAllViewProps()
        # take care of all our bindings to renderers
        del self._threedRenderer

        if BACKGROUND_RENDERER:
            # also do the background renderer
            self._background_renderer.RemoveAllViewProps()
            del self._background_renderer

        # the remaining bit of logic is quite crucial:
        # we can't explicitly Destroy() the frame, as the RWI that it contains
        # will only disappear when it's reference count reaches 0, and we
        # can't really force that to happen either.  If you DO Destroy() the
        # frame before the RW destructs, it will cause the application to
        # crash because the RW assumes a valid WindowId in its dtor
        #
        # we have two solutions:
        # 1. call a WindowRemap on the RenderWindows so that they reparent
        #    themselves to newly created windowids
        # 2. attach event handlers to the RenderWindow DeleteEvent and
        #    destroy the containing frame from there
        #
        # method 2 doesn't alway work, so we use WindowRemap

        # hide it so long
        #self.threedFrame.Show(0)

        #self.threedFrame.threedRWI.GetRenderWindow().SetSize(10,10)
        #self.threedFrame.threedRWI.GetRenderWindow().WindowRemap()

        # finalize should be available everywhere
        self.threedFrame.threedRWI.GetRenderWindow().Finalize()
        # zero the RenderWindow
        self.threedFrame.threedRWI.SetRenderWindow(None)
        # and get rid of the threedRWI interface
        del self.threedFrame.threedRWI
        
        # all the RenderWindow()s are now reparented, so we can destroy
        # the containing frame
        self.threedFrame.Destroy()
        # unbind the _view_frame binding
        del self.threedFrame

        # take care of the objectAnimationFrame
        self.objectAnimationFrame.Destroy()
        del self.objectAnimationFrame

        # take care of the controlFrame too
        self.controlFrame.Destroy()
        del self.controlFrame

        # if we don't give time up here, things go wrong (BadWindow error,
        # invalid glcontext, etc).  we'll have to integrate this with the
        # eventual module front-end / back-end split.  This time-slice
        # allows wx time to destroy all windows which somehow also leads
        # to VTK being able to deallocate everything that it has.
        wx.SafeYield()
예제 #15
0
    def close(self):
        # shut down the orientationWidget/Actor stuff
        self._orientation_widget.Off()
        self._orientation_widget.SetInteractor(None)
        self._orientation_widget.SetOrientationMarker(None)
        del self._orientation_widget
        del self._annotated_cube_actor

        # take care of scalarbar
        self._showScalarBarForProp(None)

        # this is standard behaviour in the close method:
        # call set_input(idx, None) for all inputs
        for idx in range(self._numDataInputs):
            self.set_input(idx, None)

        # take care of the sliceDirections
        self.sliceDirections.close()
        del self.sliceDirections

        # the points
        self.selectedPoints.close()
        del self.selectedPoints

        # take care of the threeD objects
        self._tdObjects.close()
        del self._tdObjects

        # the implicits
        self._implicits.close()
        del self._implicits

        # don't forget to call the mixin close() methods
        IntrospectModuleMixin.close(self)
        ColourDialogMixin.close(self)

        # unbind everything that we bound in our __init__
        del self._outline_source
        del self._outline_actor
        del self._cube_axes_actor2d

        del self._voi_widget
        #del self._extractVOI

        del self._cInteractorStyle

        # make SURE there are no props in the Renderer
        self._threedRenderer.RemoveAllViewProps()
        # take care of all our bindings to renderers
        del self._threedRenderer

        if BACKGROUND_RENDERER:
            # also do the background renderer
            self._background_renderer.RemoveAllViewProps()
            del self._background_renderer

        # the remaining bit of logic is quite crucial:
        # we can't explicitly Destroy() the frame, as the RWI that it contains
        # will only disappear when it's reference count reaches 0, and we
        # can't really force that to happen either.  If you DO Destroy() the
        # frame before the RW destructs, it will cause the application to
        # crash because the RW assumes a valid WindowId in its dtor
        #
        # we have two solutions:
        # 1. call a WindowRemap on the RenderWindows so that they reparent
        #    themselves to newly created windowids
        # 2. attach event handlers to the RenderWindow DeleteEvent and
        #    destroy the containing frame from there
        #
        # method 2 doesn't alway work, so we use WindowRemap

        # hide it so long
        #self.threedFrame.Show(0)

        #self.threedFrame.threedRWI.GetRenderWindow().SetSize(10,10)
        #self.threedFrame.threedRWI.GetRenderWindow().WindowRemap()

        # finalize should be available everywhere
        self.threedFrame.threedRWI.GetRenderWindow().Finalize()
        # zero the RenderWindow
        self.threedFrame.threedRWI.SetRenderWindow(None)
        # and get rid of the threedRWI interface
        del self.threedFrame.threedRWI

        # all the RenderWindow()s are now reparented, so we can destroy
        # the containing frame
        self.threedFrame.Destroy()
        # unbind the _view_frame binding
        del self.threedFrame

        # take care of the objectAnimationFrame
        self.objectAnimationFrame.Destroy()
        del self.objectAnimationFrame

        # take care of the controlFrame too
        self.controlFrame.Destroy()
        del self.controlFrame

        # if we don't give time up here, things go wrong (BadWindow error,
        # invalid glcontext, etc).  we'll have to integrate this with the
        # eventual module front-end / back-end split.  This time-slice
        # allows wx time to destroy all windows which somehow also leads
        # to VTK being able to deallocate everything that it has.
        wx.SafeYield()