当前位置: 首页>>代码示例>>Python>>正文


Python ModuleBase.__init__方法代码示例

本文整理汇总了Python中module_base.ModuleBase.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleBase.__init__方法的具体用法?Python ModuleBase.__init__怎么用?Python ModuleBase.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在module_base.ModuleBase的用法示例。


在下文中一共展示了ModuleBase.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:29,代码来源:objRDR.py

示例2: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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})
开发者ID:fvpolpeta,项目名称:devide,代码行数:30,代码来源:metaImageWRT.py

示例3: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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)
开发者ID:fvpolpeta,项目名称:devide,代码行数:28,代码来源:vtiWRT.py

示例4: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:36,代码来源:extractImageComponents.py

示例5: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:32,代码来源:DanielssonDistance.py

示例6: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:sanguinariojoe,项目名称:devide,代码行数:33,代码来源:tpgac.py

示例7: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:sanguinariojoe,项目名称:devide,代码行数:37,代码来源:nbCurvesLevelSet.py

示例8: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:32,代码来源:closing.py

示例9: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:30,代码来源:TransferFunctionEditor.py

示例10: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:34,代码来源:transformImageToTarget.py

示例11: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:36,代码来源:probeFilter.py

示例12: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:28,代码来源:ShepardMethod.py

示例13: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:27,代码来源:Measure2D.py

示例14: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:sanguinariojoe,项目名称:devide,代码行数:37,代码来源:gaussianKernel.py

示例15: __init__

# 需要导入模块: from module_base import ModuleBase [as 别名]
# 或者: from module_base.ModuleBase import __init__ [as 别名]
    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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:37,代码来源:sigmoid.py


注:本文中的module_base.ModuleBase.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。