本文整理汇总了Python中module_base.ModuleBase类的典型用法代码示例。如果您正苦于以下问题:Python ModuleBase类的具体用法?Python ModuleBase怎么用?Python ModuleBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
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,代码行数:27,代码来源:objRDR.py
示例2: __init__
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,代码行数:28,代码来源:metaImageWRT.py
示例3: __init__
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,代码行数:26,代码来源:vtiWRT.py
示例4: __init__
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,代码行数:34,代码来源:extractImageComponents.py
示例5: __init__
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,代码行数:30,代码来源:DanielssonDistance.py
示例6: __init__
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,代码行数:31,代码来源:tpgac.py
示例7: __init__
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,代码行数:35,代码来源:nbCurvesLevelSet.py
示例8: __init__
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,代码行数:30,代码来源:closing.py
示例9: __init__
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,代码行数:28,代码来源:TransferFunctionEditor.py
示例10: __init__
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,代码行数:32,代码来源:transformImageToTarget.py
示例11: __init__
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,代码行数:34,代码来源:probeFilter.py
示例12: __init__
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,代码行数:26,代码来源:ShepardMethod.py
示例13: __init__
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,代码行数:25,代码来源:Measure2D.py
示例14: __init__
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,代码行数:35,代码来源:gaussianKernel.py
示例15: __init__
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,代码行数:35,代码来源:sigmoid.py
示例16: __init__
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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:30,代码来源:DICOMReader.py
示例17: __init__
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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:31,代码来源:manualTransform.py
示例18: __init__
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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:35,代码来源:curvatureAnisotropicDiffusion.py
示例19: __init__
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
开发者ID:fvpolpeta,项目名称:devide,代码行数:32,代码来源:histogram2D.py
示例20: __init__
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()
开发者ID:fvpolpeta,项目名称:devide,代码行数:33,代码来源:LarynxMeasurement.py
注:本文中的module_base.ModuleBase类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论