Пример #1
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(self)

        # this is the output
        self._transformStack = transformStackClass(self)

        # we're going to use this to know when to actually read the data
        self._md5HexDigest = ''

        # we now have a viewFrame in self._viewFrame
        self._createViewFrame(
            'Select a filename to load',
            '2D Transform Stack file (*.2ts)|*.2ts|All files (*)|*',
            objectDict=None)

        # set up some defaults
        self._config.filename = ''
        self.config_to_logic()
        # make sure these filter through from the bottom up
        self.logic_to_config()
        self.config_to_view()
Пример #2
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(self)

        # this is the output
        self._transformStack = transformStackClass(self)

        # we're going to use this to know when to actually read the data
        self._md5HexDigest = ''

        # we now have a viewFrame in self._viewFrame
        self._createViewFrame(
            'Select a filename to load',
            '2D Transform Stack file (*.2ts)|*.2ts|All files (*)|*',
            objectDict=None)

        # set up some defaults
        self._config.filename = ''
        self.config_to_logic()
        # make sure these filter through from the bottom up
        self.logic_to_config()
        self.config_to_view()
Пример #3
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._writer = vtk.vtkXMLImageDataWriter()
        
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'VTK Image Data (*.vti)|*.vti|All files (*)|*',
            {'vtkXMLImageDataWriter': self._writer},
            fileOpen=False)



        module_utils.setup_vtk_object_progress(
            self, self._writer,
            'Writing VTK ImageData')

        self._writer.SetDataModeToBinary()

        # set up some defaults
        self._config.filename = ''
        self._module_manager.sync_module_logic_with_config(self)
Пример #4
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._writer = vtk.vtkStructuredPointsWriter()

        module_utils.setup_vtk_object_progress(
            self, self._writer, 'Writing vtk structured points data')

        # we do this to save space - if you're going to be transporting files
        # to other architectures, change this to ASCII
        # we've set this back to ASCII.  Seems the binary mode is screwed
        # for some files and manages to produce corrupt files that segfault
        # VTK on Windows.
        self._writer.SetFileTypeToASCII()

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'VTK data (*.vtk)|*.vtk|All files (*)|*',
            {'vtkStructuredPointsWriter': self._writer},
            fileOpen=False)

        # set up some defaults
        self._config.filename = ''

        self.sync_module_logic_with_config()
Пример #5
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._writer = vtk.vtkXMLPolyDataWriter()

        module_utils.setup_vtk_object_progress(
            self, self._writer,
            'Writing VTK PolyData')

        

        self._writer.SetDataModeToBinary()

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'VTK PolyData (*.vtp)|*.vtp|All files (*)|*',
            {'vtkXMLPolyDataWriter': self._writer},
            fileOpen=False)
            

        # set up some defaults
        self._config.filename = ''

        self.sync_module_logic_with_config()
Пример #6
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._input = None
        self._writer = None
        self._writer_type = None

        wildCardString = 'Meta Image all-in-one (*.mha)|*.mha|' \
                         'Meta Image separate header/data (*.mhd)|*.mhd|' \
                         'Analyze separate header/data (*.hdr)|*.hdr|' \
                         'NIfTI (*.nii)|*.nii|' \
                         'NIfTI compressed (*.nii.gz)|*.nii.gz|' \
                         'All files (*)|*'

        # we now have a viewFrame in self._viewFrame
        FilenameViewModuleMixin.__init__(self,
                                         'Select a filename',
                                         wildCardString,
                                         {'Module (self)': self},
                                         fileOpen=False)

        # set up some defaults
        self._config.filename = ''

        self.sync_module_logic_with_config()
Пример #7
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._input = None
        self._writer = None
        self._writer_type = None

        wildCardString = 'Meta Image all-in-one (*.mha)|*.mha|' \
                         'Meta Image separate header/data (*.mhd)|*.mhd|' \
                         'Analyze separate header/data (*.hdr)|*.hdr|' \
                         'NIfTI (*.nii)|*.nii|' \
                         'NIfTI compressed (*.nii.gz)|*.nii.gz|' \
                         'All files (*)|*'

        # we now have a viewFrame in self._viewFrame
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            wildCardString,
            {'Module (self)': self},
            fileOpen=False)

        # set up some defaults
        self._config.filename = ''

        self.sync_module_logic_with_config()
Пример #8
0
    def __init__(self, module_manager):
        """Constructor (initialiser) for the PD reader.

        This is almost standard code for most of the modules making use of
        the FilenameViewModuleMixin mixin.
        """
        
        # call the constructor in the "base"
        ModuleBase.__init__(self, module_manager)

        # setup necessary VTK objects
	self._reader = vtk.vtkOBJReader()
        
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'Wavefront OBJ data (*.obj)|*.obj|All files (*)|*',
            {'vtkOBJReader': self._reader})

        module_utils.setup_vtk_object_progress(self, self._reader,
                                           'Reading Wavefront OBJ data')

        # set up some defaults
        self._config.filename = ''

	self.sync_module_logic_with_config()
Пример #9
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._writer = vtk.vtkIVWriter()
        # sorry about this, but the files get REALLY big if we write them
        # in ASCII - I'll make this a gui option later.
        #self._writer.SetFileTypeToBinary()

        # following is the standard way of connecting up the devide progress
        # callback to a VTK object; you should do this for all objects in
        module_utils.setup_vtk_object_progress(
            self, self._writer, 'Writing polydata to Inventor Viewer format')

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'InventorViewer data (*.iv)|*.iv|All files (*)|*',
            {'vtkIVWriter': self._writer},
            fileOpen=False)
        
        # set up some defaults
        self._config.filename = ''
        self.sync_module_logic_with_config()
Пример #10
0
    def __init__(self, module_manager):
        """Constructor (initialiser) for the PD reader.

        This is almost standard code for most of the modules making use of
        the FilenameViewModuleMixin mixin.
        """

        # call the constructor in the "base"
        ModuleBase.__init__(self, module_manager)

        # setup necessary VTK objects
        self._reader = vtk.vtkSTLReader()

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self, 'Select a filename',
            'STL data (*.stl)|*.stl|All files (*)|*',
            {'vtkSTLReader': self._reader})

        module_utils.setup_vtk_object_progress(self, self._reader,
                                               'Reading STL data')

        # set up some defaults
        self._config.filename = ''
        self.sync_module_logic_with_config()
Пример #11
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._writer = vtk.vtkStructuredPointsWriter()

        module_utils.setup_vtk_object_progress(
            self, self._writer,
            'Writing vtk structured points data')

        

        # we do this to save space - if you're going to be transporting files
        # to other architectures, change this to ASCII
        # we've set this back to ASCII.  Seems the binary mode is screwed
        # for some files and manages to produce corrupt files that segfault
        # VTK on Windows.
        self._writer.SetFileTypeToASCII()
        
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'VTK data (*.vtk)|*.vtk|All files (*)|*',
            {'vtkStructuredPointsWriter': self._writer},
            fileOpen=False)


        # set up some defaults
        self._config.filename = ''

        self.sync_module_logic_with_config()
Пример #12
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._writer = vtk.vtkPolyDataWriter()
        # sorry about this, but the files get REALLY big if we write them
        # in ASCII - I'll make this a gui option later.
        self._writer.SetFileTypeToBinary()

        module_utils.setup_vtk_object_progress(
            self, self._writer,
            'Writing VTK Polygonal data')

        
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'VTK data (*.vtk)|*.vtk|All files (*)|*',
            {'vtkPolyDataWriter': self._writer},
            fileOpen=False)

        # set up some defaults
        self._config.filename = ''

        self.sync_module_logic_with_config()
Пример #13
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self, "Select a filename", "MATLAB file (*.m)|*.m|All files (*)|*", {"Module (self)": self}, fileOpen=False
        )

        # set up some defaults
        self._config.filename = ""

        self._input_points = None

        self.sync_module_logic_with_config()
Пример #14
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'MATLAB file (*.m)|*.m|All files (*)|*',
            {'Module (self)': self},
            fileOpen=False)
            
        # set up some defaults
        self._config.filename = ''

        self._input_points = None

        self.sync_module_logic_with_config()
Пример #15
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'DeVIDE points (*.dvp)|*.dvp|All files (*)|*',
            {'Module (self)': self},
            fileOpen=False)
            
        # set up some defaults
        self._config.filename = ''

        self._input_points = None

        self.sync_module_logic_with_config()
Пример #16
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._reader = vtk.vtkStructuredPointsReader()

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self, 'Select a filename',
            'VTK data (*.vtk)|*.vtk|All files (*)|*',
            {'vtkStructuredPointsReader': self._reader})

        module_utils.setup_vtk_object_progress(
            self, self._reader, 'Reading vtk structured points data')

        # set up some defaults
        self._config.filename = ''
        self.sync_module_logic_with_config()
Пример #17
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._reader = vtk.vtkXMLPolyDataReader()

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self, 'Select a filename',
            'VTK Poly Data (*.vtp)|*.vtp|All files (*)|*',
            {'vtkXMLPolyDataReader': self._reader})

        module_utils.setup_vtk_object_progress(self, self._reader,
                                               'Reading VTK PolyData')

        self._viewFrame = None

        # set up some defaults
        self._config.filename = ''
        self.sync_module_logic_with_config()
Пример #18
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._reader = vtk.vtkStructuredPointsReader()
        
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'VTK data (*.vtk)|*.vtk|All files (*)|*',
            {'vtkStructuredPointsReader': self._reader})


        module_utils.setup_vtk_object_progress(
            self, self._reader,
            'Reading vtk structured points data')

        # set up some defaults
        self._config.filename = ''
        self.sync_module_logic_with_config()
Пример #19
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(self)

        # this is the input
        self._transformStack = None

        # we now have a viewFrame in self._viewFrame
        self._createViewFrame(
            'Select a filename',
            '2D Transform Stack file (*.2ts)|*.2ts|All files (*)|*',
            objectDict=None)

        # set up some defaults
        self._config.filename = ''
        self.configToLogic()
        # make sure these filter through from the bottom up
        self.logicToConfig()
        self.configToView()
Пример #20
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(self)

        # this is the input
        self._transformStack = None

        # we now have a viewFrame in self._viewFrame
        self._createViewFrame(
            'Select a filename',
            '2D Transform Stack file (*.2ts)|*.2ts|All files (*)|*',
            objectDict=None)

        # set up some defaults
        self._config.filename = ''
        self.configToLogic()
        # make sure these filter through from the bottom up
        self.logicToConfig()
        self.configToView()
Пример #21
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._reader = vtk.vtkPLYReader()

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self, 'Select a filename',
            '(Stanford) Polygon File Format (*.ply)|*.ply|All files (*)|*', {
                'vtkPLYReader': self._reader,
                'Module (self)': self
            })

        module_utils.setup_vtk_object_progress(self, self._reader,
                                               'Reading PLY PolyData')

        # set up some defaults
        self._config.filename = ''

        # there is no view yet...
        self._module_manager.sync_module_logic_with_config(self)
Пример #22
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._triFilter = vtk.vtkTriangleFilter()

        module_utils.setup_vtk_object_progress(self, self._triFilter,
                                               'Converting to triangles')

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'brep files (*.brep)|*.brep|All files (*)|*', {
                'Module (self)': self,
                'vtkTriangleFilter': self._triFilter
            },
            fileOpen=False)

        # set up some defaults
        self._config.filename = ''
        self.sync_module_logic_with_config()
Пример #23
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._reader = vtk.vtkXMLPolyDataReader()

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'VTK Poly Data (*.vtp)|*.vtp|All files (*)|*',
            {'vtkXMLPolyDataReader': self._reader})

        module_utils.setup_vtk_object_progress(
            self, self._reader,
            'Reading VTK PolyData')

        self._viewFrame = None

        # set up some defaults
        self._config.filename = ''
        self.sync_module_logic_with_config()
Пример #24
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._triFilter = vtk.vtkTriangleFilter()

        module_utils.setup_vtk_object_progress(
            self, self._triFilter,
            'Converting to triangles')

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'brep files (*.brep)|*.brep|All files (*)|*',
            {'Module (self)' : self,
             'vtkTriangleFilter': self._triFilter},
            fileOpen=False)

        # set up some defaults
        self._config.filename = ''
        self.sync_module_logic_with_config()
Пример #25
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        # need to make sure that we're all happy triangles and stuff
        self._cleaner = vtk.vtkCleanPolyData()
        self._tf = vtk.vtkTriangleFilter()
        self._tf.SetInput(self._cleaner.GetOutput())
        self._writer = vtk.vtkSTLWriter()
        self._writer.SetInput(self._tf.GetOutput())
        # sorry about this, but the files get REALLY big if we write them
        # in ASCII - I'll make this a gui option later.
        #self._writer.SetFileTypeToBinary()

        # following is the standard way of connecting up the devide progress
        # callback to a VTK object; you should do this for all objects in
        mm = self._module_manager        
        for textobj in (('Cleaning data', self._cleaner),
                        ('Converting to triangles', self._tf),
                        ('Writing STL data', self._writer)):
            module_utils.setup_vtk_object_progress(self, textobj[1],
                                               textobj[0])

            
        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'STL data (*.stl)|*.stl|All files (*)|*',
            {'vtkSTLWriter': self._writer},
            fileOpen=False)

        # set up some defaults
        self._config.filename = ''

        self.sync_module_logic_with_config()
Пример #26
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        self._reader = vtk.vtkPLYReader()

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            '(Stanford) Polygon File Format (*.ply)|*.ply|All files (*)|*',
            {'vtkPLYReader': self._reader,
             'Module (self)' : self})

        module_utils.setup_vtk_object_progress(
            self, self._reader,
            'Reading PLY PolyData')

        # set up some defaults
        self._config.filename = ''

        # there is no view yet...
        self._module_manager.sync_module_logic_with_config(self)
Пример #27
0
    def __init__(self, module_manager):

        # call parent constructor
        ModuleBase.__init__(self, module_manager)

        # need to make sure that we're all happy triangles and stuff
        self._cleaner = vtk.vtkCleanPolyData()
        self._tf = vtk.vtkTriangleFilter()
        self._tf.SetInput(self._cleaner.GetOutput())
        self._writer = vtk.vtkSTLWriter()
        self._writer.SetInput(self._tf.GetOutput())
        # sorry about this, but the files get REALLY big if we write them
        # in ASCII - I'll make this a gui option later.
        #self._writer.SetFileTypeToBinary()

        # following is the standard way of connecting up the devide progress
        # callback to a VTK object; you should do this for all objects in
        mm = self._module_manager
        for textobj in (('Cleaning data',
                         self._cleaner), ('Converting to triangles', self._tf),
                        ('Writing STL data', self._writer)):
            module_utils.setup_vtk_object_progress(self, textobj[1],
                                                   textobj[0])

        # ctor for this specific mixin
        FilenameViewModuleMixin.__init__(
            self,
            'Select a filename',
            'STL data (*.stl)|*.stl|All files (*)|*',
            {'vtkSTLWriter': self._writer},
            fileOpen=False)

        # set up some defaults
        self._config.filename = ''

        self.sync_module_logic_with_config()