コード例 #1
0
ファイル: manualTransform.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._config.scale = (1.0, 1.0, 1.0)
        self._config.orientation = (0.0, 0.0, 0.0)
        self._config.translation = (0.0, 0.0, 0.0)

        configList = [
            ('Scaling:', 'scale', 'tuple:float,3', 'tupleText',
             'Scale factor in the x, y and z directions in world units.'),
            ('Orientation:', 'orientation', 'tuple:float,3', 'tupleText',
             'Rotation, in order, around the x, the new y and the new z axes '
             'in degrees.'),            
            ('Translation:', 'translation', 'tuple:float,3', 'tupleText',
             'Translation in the x,y,z directions.')]



        self._transform = vtk.vtkTransform()
        # we want changes here to happen AFTER the transformations
        # represented by the input
        self._transform.PostMultiply()
        
        # has no progress!

        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'vtkTransform' : self._transform})
            
        self.sync_module_logic_with_config()
コード例 #2
0
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._imageSepConvolution = vtktud.vtkImageSepConvolution()

        #        module_utils.setup_vtk_object_progress(self, self._clipper,
        #                                           'Reading PNG images.')

        # set information for ScriptedConfigModuleMixin
        self._config.axis = 0

        # FIXME: include options for kernel normalisation?
        configList = [('Axis:', 'axis', 'base:int', 'choice',
                       'Axis over which convolution is to be performed.',
                       ("X", "Y", "Z"))]

        ScriptedConfigModuleMixin.__init__(self, configList)

        self._viewFrame = self._createViewFrame({
            'Module (self)':
            self,
            'vtkImageSepConvolution':
            self._imageSepConvolution
        })

        # pass the data down to the underlying logic
        self.config_to_logic()
        # and all the way up from logic -> config -> view to make sure
        self.syncViewWithLogic()
コード例 #3
0
    def __init__(self, module_manager, contourFilterText):

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

        self._contourFilterText = contourFilterText
        if contourFilterText == 'marchingCubes':
            self._contourFilter = vtk.vtkMarchingCubes()
        else:  # contourFilter == 'contourFilter'
            self._contourFilter = vtk.vtkContourFilter()

        module_utils.setup_vtk_object_progress(self, self._contourFilter,
                                               'Extracting iso-surface')

        # now setup some defaults before our sync
        self._config.isoValue = 128

        self._viewFrame = None
        self._createViewFrame()

        # transfer these defaults to the logic
        self.config_to_logic()

        # then make sure they come all the way back up via self._config
        self.logic_to_config()
        self.config_to_view()
コード例 #4
0
ファイル: vtiWRT.py プロジェクト: fvpolpeta/devide
    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)
コード例 #5
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._extract = vtk.vtkImageExtractComponents()

        module_utils.setup_vtk_object_progress(self, self._extract,
                                           'Extracting components.')
        

        self._config.component1 = 0
        self._config.component2 = 1
        self._config.component3 = 2
        self._config.numberOfComponents = 1
        self._config.fileLowerLeft = False

        configList = [
            ('Component 1:', 'component1', 'base:int', 'text',
             'Zero-based index of first component to extract.'),
            ('Component 2:', 'component2', 'base:int', 'text',
             'Zero-based index of second component to extract.'),
            ('Component 3:', 'component3', 'base:int', 'text',
             'Zero-based index of third component to extract.'),
            ('Number of components:', 'numberOfComponents', 'base:int',
             'choice',
             'Number of components to extract.  Only this number of the '
             'above-specified component indices will be used.',
             ('1', '2', '3'))]

        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'vtkImageExtractComponents' : self._extract})

        self.sync_module_logic_with_config()
コード例 #6
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._config.scale = (1.0, 1.0, 1.0)
        self._config.orientation = (0.0, 0.0, 0.0)
        self._config.translation = (0.0, 0.0, 0.0)

        configList = [
            ('Scaling:', 'scale', 'tuple:float,3', 'tupleText',
             'Scale factor in the x, y and z directions in world units.'),
            ('Orientation:', 'orientation', 'tuple:float,3', 'tupleText',
             'Rotation, in order, around the x, the new y and the new z axes '
             'in degrees.'),
            ('Translation:', 'translation', 'tuple:float,3', 'tupleText',
             'Translation in the x,y,z directions.')
        ]

        self._transform = vtk.vtkTransform()
        # we want changes here to happen AFTER the transformations
        # represented by the input
        self._transform.PostMultiply()

        # has no progress!

        ScriptedConfigModuleMixin.__init__(self, configList, {
            'Module (self)': self,
            'vtkTransform': self._transform
        })

        self.sync_module_logic_with_config()
コード例 #7
0
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._reslicer = vtk.vtkImageReslice()
        self._probefilter = vtk.vtkProbeFilter()

        self._config.paddingValue = 0.0
        
        #This is retarded - we (sometimes, see below) need the padder 
        #to get the image extent big enough to satisfy the probe filter. 
        #No apparent logical reason, but it throws an exception if we don't.
        self._padder = vtk.vtkImageConstantPad()

        configList = [
            ('Padding value:', 'paddingValue', 'base:float', 'text',
             'The value used to pad regions that are outside the supplied volume.')]        
        
        # initialise any mixins we might have
        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)': self,
             'vtkImageReslice': self._reslicer,
             'vtkProbeFilter': self._probefilter,
             'vtkImageConstantPad': self._padder})

        module_utils.setup_vtk_object_progress(self, self._reslicer,
                                               'Transforming image (Image Reslice)')
        module_utils.setup_vtk_object_progress(self, self._probefilter,
                                               'Performing remapping (Probe Filter)')

        self.sync_module_logic_with_config()
コード例 #8
0
ファイル: histogram2D.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._histogram = vtkdevide.vtkImageHistogram2D()
        module_utils.setup_vtk_object_progress(self, self._histogram,
                                           'Calculating 2D histogram')


        self._config.input1Bins = 256
        self._config.input2Bins = 256
        self._config.maxSamplesPerBin = 512

        configList = [
            ('Number of bins for input 1', 'input1Bins', 'base:int', 'text',
             'The full range of input 1 values will be divided into this many '
             'classes.'),
            ('Number of bins for input 2', 'input2Bins', 'base:int', 'text',
             'The full range of input 2 values will be divided into this many '
             'classes.'),
            ('Maximum samples per bin', 'maxSamplesPerBin', 'base:int', 'text',
             'The number of samples per 2D bin/class will be truncated to '
             'this value.')]

        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'vtkImageHistogram2D' : self._histogram})

        self.sync_module_logic_with_config()

        self._input0 = None
        self._input1 = None
コード例 #9
0
ファイル: ShepardMethod.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)


        self._shepardFilter = vtk.vtkShepardMethod()
        
        module_utils.setup_vtk_object_progress(self, self._shepardFilter,
                                           'Applying Shepard Method.')
        
                                           
        self._config.maximum_distance = 1.0
        
                                           
                                           

        configList = [
            ('Kernel size:', 'kernelSize', 'tuple:int,3', 'text',
             'Size of the kernel in x,y,z dimensions.')]

        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'vtkImageContinuousDilate3D' : self._imageDilate})

        self.sync_module_logic_with_config()
コード例 #10
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._reader = vtk.vtkMetaImageReader()

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

        self._config.filename = ''

        configList = [(
            'File name:', 'filename', 'base:str', 'filebrowser',
            'The name of the MetaImage file you want to load.', {
                'fileMode':
                wx.OPEN,
                'fileMask':
                'MetaImage single file (*.mha)|*.mha|MetaImage separate header '
                '(*.mhd)|*.mhd|All files (*.*)|*.*'
            })]

        ScriptedConfigModuleMixin.__init__(self, configList, {
            'Module (self)': self,
            'vtkMetaImageReader': self._reader
        })

        self.sync_module_logic_with_config()
コード例 #11
0
ファイル: Measure2D.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._view_frame = None
        self._viewer = None
        self._input_image = None
        self._dummy_image_source = vtk.vtkImageMandelbrotSource()
        
        self._widgets = M2DWidgetList()

        # build frame
        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, Measure2DFrame.Measure2DFrame)

        # now link up all event handlers
        self._bind_events()

        # then build VTK pipeline
        self._create_vtk_pipeline()

        # set us up with dummy input
        self._setup_new_image()

        # show everything
        self.view()
コード例 #12
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        # this has no progress feedback
        self._icp = vtk.vtkIterativeClosestPointTransform()

        self._config.max_iterations = 50
        self._config.mode = 'RigidBody'
        self._config.align_centroids = True

        config_list = [
            ('Transformation mode:', 'mode', 'base:str', 'choice',
             'Rigid: rotation + translation;\n'
             'Similarity: rigid + isotropic scaling\n'
             'Affine: rigid + scaling + shear', ('RigidBody', 'Similarity',
                                                 'Affine')),
            ('Maximum number of iterations:', 'max_iterations', 'base:int',
             'text', 'Maximum number of iterations for ICP.'),
            ('Align centroids before start', 'align_centroids', 'base:bool',
             'checkbox',
             'Align centroids before iteratively optimizing closest points? (required for large relative translations)'
             )
        ]

        ScriptedConfigModuleMixin.__init__(
            self, config_list, {
                'Module (self)': self,
                'vtkIterativeClosestPointTransform': self._icp
            })

        self.sync_module_logic_with_config()
コード例 #13
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        # setup config
        self._config.order = 0
        self._config.standardDeviation = 1.0
        self._config.support = 3.0 * self._config.standardDeviation

        # and then our scripted config
        configList = [
            ("Order: ", "order", "base:int", "text", "The order of the gaussian kernel (0-2)."),
            (
                "Standard deviation: ",
                "standardDeviation",
                "base:float",
                "text",
                "The standard deviation (width) of the gaussian kernel.",
            ),
            ("Support: ", "support", "base:float", "text", "The support of the gaussian kernel."),
        ]

        # mixin ctor
        ScriptedConfigModuleMixin.__init__(self, configList)

        # now create the necessary VTK modules
        self._gaussianKernel = vtktud.vtkGaussianKernel()

        # setup progress for the processObject
        #        module_utils.setup_vtk_object_progress(self, self._superquadricSource,
        #                                           "Synthesizing polydata.")

        self._createWindow({"Module (self)": self, "vtkGaussianKernel": self._gaussianKernel})

        self.config_to_logic()
        self.syncViewWithLogic()
コード例 #14
0
ファイル: MIPRender.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        #for o in self._objectDict.values():
        #

        # setup some config defaults
        self._config.threshold = 1250
        self._config.interpolation = 0  # nearest
        # this is not in the interface yet, change by introspection
        self._config.mip_colour = (0.0, 0.0, 1.0)
        config_list = [
            ('Threshold:', 'threshold', 'base:float', 'text',
             'Used to generate transfer function if none is supplied'),
            ('Interpolation:', 'interpolation', 'base:int', 'choice',
             'Linear (high quality, slower) or nearest neighbour (lower '
             'quality, faster) interpolation', ('Nearest Neighbour', 'Linear'))
        ]

        ScriptedConfigModuleMixin.__init__(self, config_list,
                                           {'Module (self)': self})

        self._create_pipeline()

        self.sync_module_logic_with_config()
コード例 #15
0
ファイル: vtpWRT.py プロジェクト: nagyistoce/devide
    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()
コード例 #16
0
ファイル: Measure2D.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._view_frame = None
        self._viewer = None
        self._input_image = None
        self._dummy_image_source = vtk.vtkImageMandelbrotSource()

        self._widgets = M2DWidgetList()

        # build frame
        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, Measure2DFrame.Measure2DFrame)

        # now link up all event handlers
        self._bind_events()

        # then build VTK pipeline
        self._create_vtk_pipeline()

        # set us up with dummy input
        self._setup_new_image()

        # show everything
        self.view()
コード例 #17
0
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._reslicer = vtk.vtkImageReslice()
        self._probefilter = vtk.vtkProbeFilter()

        self._config.paddingValue = 0.0

        #This is retarded - we (sometimes, see below) need the padder
        #to get the image extent big enough to satisfy the probe filter.
        #No apparent logical reason, but it throws an exception if we don't.
        self._padder = vtk.vtkImageConstantPad()

        configList = [(
            'Padding value:', 'paddingValue', 'base:float', 'text',
            'The value used to pad regions that are outside the supplied volume.'
        )]

        # initialise any mixins we might have
        ScriptedConfigModuleMixin.__init__(
            self, configList, {
                'Module (self)': self,
                'vtkImageReslice': self._reslicer,
                'vtkProbeFilter': self._probefilter,
                'vtkImageConstantPad': self._padder
            })

        module_utils.setup_vtk_object_progress(
            self, self._reslicer, 'Transforming image (Image Reslice)')
        module_utils.setup_vtk_object_progress(
            self, self._probefilter, 'Performing remapping (Probe Filter)')

        self.sync_module_logic_with_config()
コード例 #18
0
ファイル: stlRDR.py プロジェクト: nagyistoce/devide
    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()
コード例 #19
0
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        # what a lame-assed filter, we have to make dummy inputs!
        # if we don't have a dummy input (but instead a None input) it
        # bitterly complains when we do a GetOutput() (it needs the input
        # to know the type of the output) - and GetPolyDataOutput() also
        # doesn't work.
        # NB: this does mean that our probeFilter NEEDS a PolyData as
        # probe geometry!
        ss = vtk.vtkSphereSource()
        ss.SetRadius(0)
        self._dummyInput = ss.GetOutput()

        #This is also retarded - we (sometimes, see below) need the "padder"
        #to get the image extent big enough to satisfy the probe filter. 
        #No apparent logical reason, but it throws an exception if we don't.
        self._padder = vtk.vtkImageConstantPad()
        self._source = None
        self._input = None
        
        self._probeFilter = vtk.vtkProbeFilter()
        self._probeFilter.SetInput(self._dummyInput)

        NoConfigModuleMixin.__init__(
            self,
            {'Module (self)' : self,
             'vtkProbeFilter' : self._probeFilter})

        module_utils.setup_vtk_object_progress(self, self._probeFilter,
                                           'Mapping source on input')
        
        self.sync_module_logic_with_config()
コード例 #20
0
ファイル: myTubeFilter.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._tubeFilter = vtk.vtkTubeFilter()

        module_utils.setup_vtk_object_progress(self, self._tubeFilter,
                                               'Generating tubes.')

        self._config.NumberOfSides = 3
        self._config.Radius = 0.01

        configList = [('Number of sides:', 'NumberOfSides', 'base:int', 'text',
                       'Number of sides that the tube should have.'),
                      ('Tube radius:', 'Radius', 'base:float', 'text',
                       'Radius of the generated tube.')]
        ScriptedConfigModuleMixin.__init__(self, configList)

        self._viewFrame = self._createWindow({
            'Module (self)': self,
            'vtkTubeFilter': self._tubeFilter
        })

        # pass the data down to the underlying logic
        self.config_to_logic()
        # and all the way up from logic -> config -> view to make sure
        self.syncViewWithLogic()
コード例 #21
0
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._input_mmd = None

        self._output_mmd = MedicalMetaData()
        self._output_mmd.medical_image_properties = \
                vtk.vtkMedicalImageProperties()
        self._output_mmd.direction_cosines = \
                vtk.vtkMatrix4x4()

        # if the value (as it appears in mk.vtk_kit.constants.mipk)
        # appears in the dict, its value refers to the user supplied
        # value.  when the user resets a field, that key is removed
        # from the dict
        self._config.new_value_dict = {}

        # this is the list of relevant properties
        self.mip_attr_l = \
            module_kits.vtk_kit.constants.medical_image_properties_keywords

        # this will be used to keep track of changes made to the prop
        # grid before they are applied to the config
        self._grid_value_dict = {}

        self._view_frame = None
        self.sync_module_logic_with_config()
コード例 #22
0
ファイル: ImageLogic.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._image_logic = vtk.vtkImageLogic()

        module_utils.setup_vtk_object_progress(self, self._image_logic,
                                               'Performing image logic')

        self._image_cast = vtk.vtkImageCast()
        module_utils.setup_vtk_object_progress(
            self, self._image_cast, 'Casting scalar type before image logic')

        self._config.operation = 0
        self._config.output_true_value = 1.0

        # 'choice' widget with 'base:int' type will automatically get cast
        # to index of selection that user makes.
        config_list = [
            ('Operation:', 'operation', 'base:int',
             'choice', 'The operation that should be performed.',
             tuple(self._operations)),
            ('Output true value:', 'output_true_value', 'base:float', 'text',
             'Output voxels that are TRUE will get this value.')
        ]

        ScriptedConfigModuleMixin.__init__(self, config_list, {
            'Module (self)': self,
            'vtkImageLogic': self._image_logic
        })

        self.sync_module_logic_with_config()
コード例 #23
0
ファイル: closing.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._imageDilate = vtk.vtkImageContinuousDilate3D()
        self._imageErode = vtk.vtkImageContinuousErode3D()
        self._imageErode.SetInput(self._imageDilate.GetOutput())
        
        module_utils.setup_vtk_object_progress(self, self._imageDilate,
                                           'Performing greyscale 3D dilation')
        

        module_utils.setup_vtk_object_progress(self, self._imageErode,
                                           'Performing greyscale 3D erosion')
        

        self._config.kernelSize = (3, 3, 3)


        configList = [
            ('Kernel size:', 'kernelSize', 'tuple:int,3', 'text',
             'Size of the kernel in x,y,z dimensions.')]

        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'vtkImageContinuousDilate3D' : self._imageDilate,
             'vtkImageContinuousErode3D' : self._imageErode})
        
        self.sync_module_logic_with_config()
コード例 #24
0
    def __init__(self, module_manager):

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

        self._writer = vtk.vtkMetaImageWriter()

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

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

        config_list = [
                ('Filename:', 'filename', 'base:str', 'filebrowser',
                    'Output filename for MetaImage file.',
                    {'fileMode' : wx.SAVE,
                     'fileMask' : 'MetaImage single file (*.mha)|*.mha|MetaImage separate header/(z)raw files (*.mhd)|*.mhd|All files (*)|*',
                     'defaultExt' : '.mha'}
                    ),
                ('Compression:', 'compression', 'base:bool', 'checkbox',
                    'Compress the image / volume data')
                ]

        ScriptedConfigModuleMixin.__init__(self, config_list,
                {'Module (self)' : self})
コード例 #25
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._volume_input = None

        self._opacity_tf = vtk.vtkPiecewiseFunction()
        self._colour_tf = vtk.vtkColorTransferFunction()
        self._lut = vtk.vtkLookupTable()

        # list of tuples, where each tuple (scalar_value, (r,g,b,a))
        self._config.transfer_function = [
                (0, (0,0,0), 0),
                (255, (255,255,255), 1)
                ]

        self._view_frame = None
        self._create_view_frame()
        self._bind_events()

        self.view()

        # all modules should toggle this once they have shown their
        # stuff.
        self.view_initialised = True

        self.config_to_logic()
        self.logic_to_config()
        self.config_to_view()
コード例 #26
0
ファイル: objRDR.py プロジェクト: fvpolpeta/devide
    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()
コード例 #27
0
ファイル: DICOMReader.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._reader = vtkgdcm.vtkGDCMImageReader()
        # NB NB NB: for now we're SWITCHING off the VTK-compatible
        # Y-flip, until the X-mirror issues can be solved.
        self._reader.SetFileLowerLeft(1)
        self._ici = vtk.vtkImageChangeInformation()
        self._ici.SetInputConnection(0, self._reader.GetOutputPort(0))

        # create output MedicalMetaData and populate it with the
        # necessary bindings.
        mmd = MedicalMetaData()
        mmd.medical_image_properties = \
                self._reader.GetMedicalImageProperties()
        mmd.direction_cosines = \
                self._reader.GetDirectionCosines()
        self._output_mmd = mmd

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

        self._view_frame = None
        self._file_dialog = None
        self._config.dicom_filenames = []
        # if this is true, module will still try to load set even if
        # IPP sorting fails by sorting images alphabetically
        self._config.robust_spacing = False

        self.sync_module_logic_with_config()
コード例 #28
0
ファイル: tpgac.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):

        ModuleBase.__init__(self, module_manager)

        # setup defaults
        self._config.propagationScaling = 1.0
        self._config.curvatureScaling = 1.0
        self._config.advectionScaling = 1.0
        self._config.numberOfIterations = 100

        configList = [
            ('Propagation scaling:', 'propagationScaling', 'base:float',
             'text', 'Propagation scaling parameter for the geodesic active '
             'contour, '
             'i.e. balloon force.  Positive for outwards, negative for '
             'inwards.'),
            ('Curvature scaling:', 'curvatureScaling', 'base:float', 'text',
             'Curvature scaling term weighting.'),
            ('Advection scaling:', 'advectionScaling', 'base:float', 'text',
             'Advection scaling term weighting.'),
            ('Number of iterations:', 'numberOfIterations', 'base:int', 'text',
             'Number of iterations that the algorithm should be run for')
        ]

        ScriptedConfigModuleMixin.__init__(self, configList,
                                           {'Module (self)': self})

        # create all pipeline thingies
        self._createITKPipeline()

        self.sync_module_logic_with_config()
コード例 #29
0
ファイル: cptDistanceField.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):

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

        self._imageInput = None
        self._meshInput = None

        self._flipper = vtk.vtkImageFlip()
        self._flipper.SetFilteredAxis(1)
        module_utils.setup_vtk_object_progress(self, self._flipper,
                                               'Flipping Y axis.')

        self._config.cpt_driver_path = \
                'd:\\misc\\stuff\\driver.bat'
        #'/home/cpbotha/build/cpt/3d/driver/driver.exe'
        self._config.max_distance = 5

        config_list = [
            ('CPT driver path', 'cpt_driver_path', 'base:str', 'filebrowser',
             'Path to CPT driver executable', {
                 'fileMode': module_mixins.wx.OPEN,
                 'fileMask': 'All files (*.*)|*.*'
             }),
            ('Maximum distance', 'max_distance', 'base:float', 'text',
             'The maximum (absolute) distance up to which the field is computed.'
             )
        ]

        ScriptedConfigModuleMixin.__init__(self, config_list,
                                           {'Module (self)': self})

        self.sync_module_logic_with_config()
コード例 #30
0
ファイル: VTKtoITK.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._input = None

        self._image_cast = vtk.vtkImageCast()
        self._vtk2itk = None
        # this stores the short_string of the current converter, e.g.
        # F3 or US3, etc.
        self._vtk2itk_short_string = None

        self._config.autotype = False
        # this will store the current type as full text, e.g. "unsigned char"
        self._config.type = 'float'

        config_list = [
            ('AutoType:', 'autotype', 'base:bool', 'checkbox',
             'If activated, output data type is set to '
             'input type.'),
            ('Data type:', 'type', 'base:str', 'choice',
             'Data will be cast to this type if AutoType is not used.', [
                 'float', 'signed short', 'unsigned short', 'unsigned char',
                 'unsigned long'
             ])
        ]

        ScriptedConfigModuleMixin.__init__(self, config_list,
                                           {'Module (self)': self})

        self.sync_module_logic_with_config()
コード例 #31
0
ファイル: streamTracer.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)
        InputArrayChoiceMixin.__init__(self)

        # 0 = RK2
        # 1 = RK4
        # 2 = RK45
        self._config.integrator = INTEG_TYPE.index('RK2')
        self._config.max_prop = 5.0
        self._config.integration_direction = INTEG_DIR.index('FORWARD')

        configList = [
            ('Vectors selection:', 'vectorsSelection', 'base:str', 'choice',
             'The attribute that will be used as vectors for the warping.',
             (input_array_choice_mixin.DEFAULT_SELECTION_STRING, )),
            ('Max propagation:', 'max_prop', 'base:float', 'text',
             'The streamline will propagate up to this lenth.'),
            ('Integration direction:', 'integration_direction', 'base:int',
             'choice', 'Select an integration direction.', INTEG_DIR_TEXTS),
            ('Integrator type:', 'integrator', 'base:int', 'choice',
             'Select an integrator for the streamlines.', INTEG_TYPE_TEXTS)
        ]

        self._streamTracer = vtk.vtkStreamTracer()

        ScriptedConfigModuleMixin.__init__(
            self, configList, {
                'Module (self)': self,
                'vtkStreamTracer': self._streamTracer
            })

        module_utils.setup_vtk_object_progress(self, self._streamTracer,
                                               'Tracing stream lines.')

        self.sync_module_logic_with_config()
コード例 #32
0
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)
        ColourDialogMixin.__init__(
            self, module_manager.get_module_view_parent_window())

        # setup the whole VTK pipeline that we're going to use
        self._createPipeline()

        # this is a list of all the objects in the pipeline and will
        # be used by the object and pipeline introspection
        self._object_dict = {
            'splatMapper': self._splatMapper,
            'opacity TF': self._otf,
            'colour TF': self._ctf,
            'volumeProp': self._volumeProperty,
            'volume': self._volume
        }

        # setup some config defaults
        # for segmetented data
        self._config.threshold = 1.0
        # bony kind of colour
        self._config.colour = (1.0, 0.937, 0.859)
        # high quality, doh
        self._config.renderMode = 0
        # default.  if you don't understand, forget about it. :)
        self._config.gradientImageIsGradient = 0

        # create the gui
        self._view_frame = None

        self.sync_module_logic_with_config()
コード例 #33
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._config.numberOfIterations = 5
        self._config.conductanceParameter = 3.0

        configList = [
            ('Number of iterations:', 'numberOfIterations', 'base:int', 'text',
             'Number of time-step updates (iterations) the solver will '
             'perform.'),
            ('Conductance parameter:', 'conductanceParameter', 'base:float',
             'text', 'Sensitivity of the  conductance term.  Lower == more '
             'preservation of image features.')]

        



        # setup the pipeline
        if3 = itk.Image[itk.F, 3]
        d = itk.CurvatureAnisotropicDiffusionImageFilter[if3, if3].New()
        d.SetTimeStep(0.0625) # standard for 3D
        self._diffuse = d
        
        itk_kit.utils.setupITKObjectProgress(
            self, self._diffuse,
            'itkCurvatureAnisotropicDiffusionImageFilter',
            'Smoothing data')

        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'itkCurvatureAnisotropicDiffusion' : self._diffuse})

        self.sync_module_logic_with_config()
コード例 #34
0
ファイル: histogram2D.py プロジェクト: nagyistoce/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._histogram = vtkdevide.vtkImageHistogram2D()
        module_utils.setup_vtk_object_progress(self, self._histogram,
                                               'Calculating 2D histogram')

        self._config.input1Bins = 256
        self._config.input2Bins = 256
        self._config.maxSamplesPerBin = 512

        configList = [
            ('Number of bins for input 1', 'input1Bins', 'base:int', 'text',
             'The full range of input 1 values will be divided into this many '
             'classes.'),
            ('Number of bins for input 2', 'input2Bins', 'base:int', 'text',
             'The full range of input 2 values will be divided into this many '
             'classes.'),
            ('Maximum samples per bin', 'maxSamplesPerBin', 'base:int', 'text',
             'The number of samples per 2D bin/class will be truncated to '
             'this value.')
        ]

        ScriptedConfigModuleMixin.__init__(
            self, configList, {
                'Module (self)': self,
                'vtkImageHistogram2D': self._histogram
            })

        self.sync_module_logic_with_config()

        self._input0 = None
        self._input1 = None
コード例 #35
0
	def __init__(self, module_manager):
	# call the parent constructor
		ModuleBase.__init__(self, module_manager)

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

#		module_utils.setup_vtk_object_progress(self, self._reader,
#		                                   'Fetching transformStack from database...')

		self._config.databaseFile = ""
		self._config.reconstructionName = "--- select a value ---"

		configList = [
			('Database:', 'databaseFile', 'base:str', 'filebrowser',
			'Database from which to fetch a reconstruction''s transformStack.',
			{'fileMode' : wx.OPEN,
			'fileMask' :
			'MDB files (*.mdb)|*.mdb|All files (*.*)|*.*'}),
			('Reconstruction:', 'reconstructionName', 'base:str', 'choice',
			'Specific reconstruction to use.', ("--- select a value ---",) ) ] 

		ScriptedConfigModuleMixin.__init__(self, configList)

		self._viewFrame = self._createViewFrame({'Module (self)' : self})

		self.config_to_logic()
		self.syncViewWithLogic()
コード例 #36
0
    def __init__(self, module_manager):

        ModuleBase.__init__(self, module_manager)

        # setup defaults
        self._config.propagationScaling = 1.0
        self._config.advectionScaling = 1.0
        self._config.curvatureScaling = 1.0
        self._config.numberOfIterations = 500

        configList = [
            (
                "Propagation scaling:",
                "propagationScaling",
                "base:float",
                "text",
                "Weight factor for the propagation term",
            ),
            ("Advection scaling:", "advectionScaling", "base:float", "text", "Weight factor for the advection term"),
            ("Curvature scaling:", "curvatureScaling", "base:float", "text", "Weight factor for the curvature term"),
            (
                "Number of iterations:",
                "numberOfIterations",
                "base:int",
                "text",
                "Number of iterations that the algorithm should be run for",
            ),
        ]

        ScriptedConfigModuleMixin.__init__(self, configList, {"Module (self)": self})

        # create all pipeline thingies
        self._createITKPipeline()

        self.sync_module_logic_with_config()
コード例 #37
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._state = STATE_INIT
        self._config.filename = None

        self._current_measurement = None
        # pogo line first
        # outline of larynx second
        self._actors = []

        # list of pointwidgets, first is apex, second is lm, others
        # are others. :)
        self._markers = []

        self._pogo_line_source = None
        self._area_polydata = None

        self._view_frame = None
        self._viewer = None
        self._reader = vtk.vtkJPEGReader()
        self._create_view_frame()
        self._bind_events()

        self.view()

        # all modules should toggle this once they have shown their
        # stuff.
        self.view_initialised = True

        self.config_to_logic()
        self.logic_to_config()
        self.config_to_view()
コード例 #38
0
ファイル: myTubeFilter.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._tubeFilter = vtk.vtkTubeFilter()
        
        module_utils.setup_vtk_object_progress(self, self._tubeFilter,
                                           'Generating tubes.')
                                           
        self._config.NumberOfSides = 3
        self._config.Radius = 0.01

        configList = [
            ('Number of sides:', 'NumberOfSides', 'base:int', 'text',
             'Number of sides that the tube should have.'),
            ('Tube radius:', 'Radius', 'base:float', 'text',
             'Radius of the generated tube.')]
        ScriptedConfigModuleMixin.__init__(self, configList)        
        
        self._viewFrame = self._createWindow(
            {'Module (self)' : self,
             'vtkTubeFilter' : self._tubeFilter})

        # pass the data down to the underlying logic
        self.config_to_logic()
        # and all the way up from logic -> config -> view to make sure
        self.syncViewWithLogic()
コード例 #39
0
    def __init__(self, module_manager):

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

        self._input_image = None
        self._foreground_points = None
        self._background_points = None

        self._config.filename = ''

        configList = [
            ('Result file name:', 'filename', 'base:str', 'filebrowser',
             'Y/N result will be written to this file.', {
                 'fileMode': WX_SAVE,
                 'fileMask': 'All files (*.*)|*.*'
             })
        ]

        ScriptedConfigModuleMixin.__init__(self, configList,
                                           {'Module (self)': self})

        self.sync_module_logic_with_config()
コード例 #40
0
ファイル: testModule2.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)
        # initialise any mixins we might have
        NoConfigModuleMixin.__init__(self)


        self._imageReslice = vtk.vtkImageReslice()
        self._imageReslice.SetInterpolationModeToCubic()

        self._matrixToHT = vtk.vtkMatrixToHomogeneousTransform()
        self._matrixToHT.Inverse()


        module_utils.setup_vtk_object_progress(self, self._imageReslice,
                                           'Resampling volume')

        self._viewFrame = self._createViewFrame(
            {'Module (self)' : self,
             'vtkImageReslice' : self._imageReslice})

        # pass the data down to the underlying logic
        self.config_to_logic()
        # and all the way up from logic -> config -> view to make sure
        self.syncViewWithLogic()     
コード例 #41
0
ファイル: MyGlyph3D.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)


        self._glyph3d = vtktud.vtkMyGlyph3D()
        
        module_utils.setup_vtk_object_progress(self, self._glyph3d,
                                           'Making 3D glyphs')
        
                                           
        self._config.scaling = 1.0
        self._config.scalemode = 1.0

        configList = [
            ('Scaling:', 'scaling', 'base:float', 'text',
             'Glyphs will be scaled by this factor.'),
            ('Scalemode:', 'scalemode', 'base:int', 'text',
             'Scaling will occur by scalar, vector direction or magnitude.')]
        ScriptedConfigModuleMixin.__init__(self, configList)        
        

        self._viewFrame = self._createWindow(
            {'Module (self)' : self,
             'vtkMyGlyph3D' : self._glyph3d})

        # pass the data down to the underlying logic
        self.config_to_logic()
        # and all the way up from logic -> config -> view to make sure
        self.logic_to_config()
        self.config_to_view()
コード例 #42
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._config.squared_distance = False
        self._config.binary_input = True
        self._config.image_spacing = True

        configList = [
            ('Squared distance:', 'squared_distance', 'base:bool', 'checkbox',
             'Should the distance output be squared (faster) or true.'),
            ('Use image spacing:', 'image_spacing', 'base:bool',
             'checkbox', 'Use image spacing in distance calculation.'),
            ('Binary input:', 'binary_input', 'base:bool', 'checkbox',
             'Does the input contain marked objects, or binary (yes/no) '
             'objects.')]
             
        # setup the pipeline
        imageF3 = itk.Image[itk.F, 3]
        self._dist_filter = None
        self._create_pipeline(imageF3)
        
        # THIS HAS TO BE ON.  SO THERE.
        #self._dist_filter.SetUseImageSpacing(True)
        
        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'itkDanielssonDistanceMapImageFilter' : self._dist_filter})

        self.sync_module_logic_with_config()
コード例 #43
0
ファイル: vtkStructPtsWRT.py プロジェクト: nagyistoce/devide
    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()
コード例 #44
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._config.numberOfIterations = 5
        self._config.conductanceParameter = 3.0

        configList = [
            ('Number of iterations:', 'numberOfIterations', 'base:int', 'text',
             'Number of time-step updates (iterations) the solver will '
             'perform.'),
            ('Conductance parameter:', 'conductanceParameter', 'base:float',
             'text', 'Sensitivity of the  conductance term.  Lower == more '
             'preservation of image features.')
        ]

        # setup the pipeline
        if3 = itk.Image[itk.F, 3]
        d = itk.GradientAnisotropicDiffusionImageFilter[if3, if3].New()
        d.SetTimeStep(0.0625)  # standard for 3D
        self._diffuse = d

        module_kits.itk_kit.utils.setupITKObjectProgress(
            self, self._diffuse, 'itkGradientAnisotropicDiffusionImageFilter',
            'Smoothing data')

        ScriptedConfigModuleMixin.__init__(
            self, configList, {
                'Module (self)': self,
                'itkGradientAnisotropicDiffusion': self._diffuse
            })

        self.sync_module_logic_with_config()
コード例 #45
0
    def __init__(self, module_manager):

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

        self._input_image = None
        self._foreground_points = None
        self._background_points = None
       
        self._config.filename = ''

        configList = [
            ('Result file name:', 'filename', 'base:str', 'filebrowser',
             'Y/N result will be written to this file.',
             {'fileMode' : WX_SAVE,
              'fileMask' :
              'All files (*.*)|*.*'})]

        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self})
            
        self.sync_module_logic_with_config()
コード例 #46
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._config.gaussianSigma = 0.7
        self._config.normaliseAcrossScale = False

        configList = [
            ('Gaussian sigma', 'gaussianSigma', 'base:float', 'text',
             'Sigma in terms of image spacing.'),
            ('Normalise across scale', 'normaliseAcrossScale', 'base:bool',
             'checkbox', 'Determine normalisation factor.')
        ]

        # setup the pipeline
        self._gradientMagnitude = None
        img_type = itk.Image.F3
        self._create_pipeline(img_type)

        ScriptedConfigModuleMixin.__init__(
            self, configList, {
                'Module (self)':
                self,
                'itkGradientMagnitudeRecursiveGaussianImageFilter':
                self._gradientMagnitude
            })

        self.sync_module_logic_with_config()
コード例 #47
0
ファイル: hessianDoG.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._config.gaussianSigma = 0.7
        self._config.normaliseAcrossScale = False

        configList = [
            ('Gaussian sigma', 'gaussianSigma', 'base:float', 'text',
             'Sigma in terms of image spacing.'),
            ('Normalise across scale', 'normaliseAcrossScale', 'base:bool',
             'checkbox', 'Determine normalisation factor.')]
        
        ScriptedConfigModuleMixin.__init__(self, configList)

        # setup the pipeline
        g = itk.itkGradientMagnitudeRecursiveGaussianImageFilterF3F3_New()
        self._gradientMagnitude = g
        
        module_utilsITK.setupITKObjectProgress(
            self, g,
            'itkGradientMagnitudeRecursiveGaussianImageFilter',
            'Calculating gradient image')

        self._createWindow(
            {'Module (self)' : self,
             'itkGradientMagnitudeRecursiveGaussianImageFilter' :
             self._gradientMagnitude})

        self.config_to_logic()
        self.syncViewWithLogic()
コード例 #48
0
ファイル: ITKWriter.py プロジェクト: fvpolpeta/devide
    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()
コード例 #49
0
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._imageSepConvolution = vtktud.vtkImageSepConvolution()

#        module_utils.setup_vtk_object_progress(self, self._clipper,
#                                           'Reading PNG images.')

        # set information for ScriptedConfigModuleMixin
        self._config.axis = 0

        # FIXME: include options for kernel normalisation?
        configList = [
            ('Axis:', 'axis', 'base:int', 'choice',
             'Axis over which convolution is to be performed.', ("X", "Y", "Z") ) ] 

        ScriptedConfigModuleMixin.__init__(self, configList)

        self._viewFrame = self._createViewFrame(
            {'Module (self)' : self,
             'vtkImageSepConvolution' : self._imageSepConvolution})

        # pass the data down to the underlying logic
        self.config_to_logic()
        # and all the way up from logic -> config -> view to make sure
        self.syncViewWithLogic()
コード例 #50
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._config.gaussianSigma = 0.7
        self._config.normaliseAcrossScale = False

        configList = [
            ('Gaussian sigma', 'gaussianSigma', 'base:float', 'text',
             'Sigma in terms of image spacing.'),
            ('Normalise across scale', 'normaliseAcrossScale', 'base:bool',
             'checkbox', 'Determine normalisation factor.')]
        


        # setup the pipeline
        self._gradientMagnitude = None
        img_type = itk.Image.F3
        self._create_pipeline(img_type)
        
        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'itkGradientMagnitudeRecursiveGaussianImageFilter' :
             self._gradientMagnitude})
            
        self.sync_module_logic_with_config()
コード例 #51
0
ファイル: sigmoid.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._config.alpha = - 0.5
        self._config.beta = 3.0
        self._config.min = 0.0
        self._config.max = 1.0
        
        configList = [
            ('Alpha:', 'alpha', 'base:float', 'text',
             'Alpha parameter for the sigmoid filter'),
            ('Beta:', 'beta', 'base:float', 'text',
             'Beta parameter for the sigmoid filter'),
            ('Minimum:', 'min', 'base:float', 'text',
             'Minimum output of sigmoid transform'),
            ('Maximum:', 'max', 'base:float', 'text',
             'Maximum output of sigmoid transform')]
        


        if3 = itk.Image[itk.F, 3]
        self._sigmoid = itk.SigmoidImageFilter[if3,if3].New()
        
        itk_kit.utils.setupITKObjectProgress(
            self, self._sigmoid,
            'itkSigmoidImageFilter',
            'Performing sigmoid transformation')

        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'itkSigmoidImageFilter' :
             self._sigmoid})

        self.sync_module_logic_with_config()
コード例 #52
0
ファイル: contourFLTBase.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager, contourFilterText):

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

        self._contourFilterText = contourFilterText
        if contourFilterText == 'marchingCubes':
            self._contourFilter = vtk.vtkMarchingCubes()
        else: # contourFilter == 'contourFilter'
            self._contourFilter = vtk.vtkContourFilter()

        module_utils.setup_vtk_object_progress(self, self._contourFilter,
                                           'Extracting iso-surface')

        # now setup some defaults before our sync
        self._config.isoValue = 128;

        self._viewFrame = None
        self._createViewFrame()

        # transfer these defaults to the logic
        self.config_to_logic()

        # then make sure they come all the way back up via self._config
        self.logic_to_config()
        self.config_to_view()
コード例 #53
0
ファイル: MIPRender.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        #for o in self._objectDict.values():
        #    

        # setup some config defaults
        self._config.threshold = 1250
        self._config.interpolation = 0 # nearest
        # this is not in the interface yet, change by introspection
        self._config.mip_colour = (0.0, 0.0, 1.0)
        config_list = [
            ('Threshold:', 'threshold', 'base:float', 'text',
             'Used to generate transfer function if none is supplied'),
            ('Interpolation:', 'interpolation', 'base:int', 'choice',
             'Linear (high quality, slower) or nearest neighbour (lower '
             'quality, faster) interpolation',
             ('Nearest Neighbour', 'Linear'))]

        ScriptedConfigModuleMixin.__init__(
            self, config_list,
            {'Module (self)' : self})
        
        self._create_pipeline()

        self.sync_module_logic_with_config()