本文整理汇总了Python中module_mixins.ScriptedConfigModuleMixin类的典型用法代码示例。如果您正苦于以下问题:Python ScriptedConfigModuleMixin类的具体用法?Python ScriptedConfigModuleMixin怎么用?Python ScriptedConfigModuleMixin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ScriptedConfigModuleMixin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: close
def close(self):
ScriptedConfigModuleMixin.close(self)
# get rid of our reference
del self._icp
ModuleBase.close(self)
示例2: __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()
示例3: __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})
示例4: __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()
示例5: __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()
示例6: __init__
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()
示例7: __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()
示例8: __init__
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
# setup config
self._config.resolution = 40
# and then our scripted config
configList = [
('Resolution: ', 'resolution', 'base:int', 'text',
'x, y and z resolution of sampled volume. '
'According to the article, should be 40 to be '
'at Nyquist.')]
# now create the necessary VTK modules
self._es = vtk.vtkImageEllipsoidSource()
self._es.SetOutputScalarTypeToFloat()
self._ic = vtk.vtkImageChangeInformation()
self._ic.SetInputConnection(self._es.GetOutputPort())
self._output = vtk.vtkImageData()
# mixin ctor
ScriptedConfigModuleMixin.__init__(
self, configList,
{'Module (self)' : self})
self.sync_module_logic_with_config()
示例9: __init__
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
self._imageMath = vtk.vtkImageMathematics()
self._imageMath.SetInput1(None)
self._imageMath.SetInput2(None)
module_utils.setup_vtk_object_progress(self, self._imageMath,
'Performing image math')
self._config.operation = 'subtract'
self._config.constantC = 0.0
self._config.constantK = 1.0
configList = [
('Operation:', 'operation', 'base:str', 'choice',
'The operation that should be performed.',
tuple(OPS_DICT.keys())),
('Constant C:', 'constantC', 'base:float', 'text',
'The constant C used in some operations.'),
('Constant K:', 'constantK', 'base:float', 'text',
'The constant C used in some operations.')]
ScriptedConfigModuleMixin.__init__(
self, configList,
{'Module (self)' : self,
'vtkImageMathematics' : self._imageMath})
self.sync_module_logic_with_config()
示例10: __init__
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
self._implicitModeller = vtk.vtkImplicitModeller()
module_utils.setup_vtk_object_progress(
self, self._implicitModeller,
'Converting surface to distance field')
self._config.bounds = (-1, 1, -1, 1, -1, 1)
self._config.dimensions = (64, 64, 64)
self._config.maxDistance = 0.1
configList = [
('Bounds:', 'bounds', 'tuple:float,6', 'text',
'The physical location of the sampled volume in space '
'(x0, x1, y0, y1, z0, z1)'),
('Dimensions:', 'dimensions', 'tuple:int,3', 'text',
'The number of points that should be sampled in each dimension.'),
('Maximum distance:', 'maxDistance', 'base:float', 'text',
'The distance will only be calculated up to this maximum.')]
ScriptedConfigModuleMixin.__init__(
self, configList,
{'Module (self)' : self,
'vtkImplicitModeller' : self._implicitModeller})
self.sync_module_logic_with_config()
示例11: __init__
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()
示例12: __init__
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
InputArrayChoiceMixin.__init__(self)
self._config.scaleFactor = 1
configList = [
('Scale factor:', 'scaleFactor', 'base:float', 'text',
'The warping will be scaled by this factor'),
('Vectors selection:', 'vectorsSelection', 'base:str', 'choice',
'The attribute that will be used as vectors for the warping.',
(self._defaultVectorsSelectionString, self._userDefinedString))]
self._warpVector = vtk.vtkWarpVector()
ScriptedConfigModuleMixin.__init__(
self, configList,
{'Module (self)' : self,
'vtkWarpVector' : self._warpVector})
module_utils.setup_vtk_object_progress(self, self._warpVector,
'Warping points.')
self.sync_module_logic_with_config()
示例13: __init__
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._config.numberOfIterations = 3
self._config.timeStep = 0.05
configList = [
('Number of iterations:', 'numberOfIterations', 'base:int',
'text',
'Number of update iterations that will be performed.'),
('Timestep:', 'timeStep', 'base:float',
'text', 'Timestep between update iterations.')]
# setup the pipeline
if3 = itk.Image[itk.F, 3]
self._cfif = itk.CurvatureFlowImageFilter[if3, if3].New()
itk_kit.utils.setupITKObjectProgress(
self, self._cfif, 'itkCurvatureFlowImageFilter',
'Denoising data')
ScriptedConfigModuleMixin.__init__(
self, configList,
{'Module (self)' : self,
'itkCurvatureFlowImageFilter' : self._cfif})
self.sync_module_logic_with_config()
示例14: __init__
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()
示例15: __init__
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()