本文整理汇总了Python中module_utils.setup_vtk_object_progress函数的典型用法代码示例。如果您正苦于以下问题:Python setup_vtk_object_progress函数的具体用法?Python setup_vtk_object_progress怎么用?Python setup_vtk_object_progress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup_vtk_object_progress函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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()
示例2: __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()
示例3: __init__
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self._writer = vtk.vtkPolyDataWriter()
# sorry about this, but the files get REALLY big if we write them
# in ASCII - I'll make this a gui option later.
self._writer.SetFileTypeToBinary()
module_utils.setup_vtk_object_progress(
self, self._writer,
'Writing VTK Polygonal data')
# ctor for this specific mixin
FilenameViewModuleMixin.__init__(
self,
'Select a filename',
'VTK data (*.vtk)|*.vtk|All files (*)|*',
{'vtkPolyDataWriter': self._writer},
fileOpen=False)
# set up some defaults
self._config.filename = ''
self.sync_module_logic_with_config()
示例4: __init__
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
# we'll be playing around with some vtk objects, this could
# be anything
self._triangleFilter = vtk.vtkTriangleFilter()
self._curvatures = vtk.vtkCurvatures()
self._curvatures.SetCurvatureTypeToMaximum()
self._curvatures.SetInput(self._triangleFilter.GetOutput())
# initialise any mixins we might have
NoConfigModuleMixin.__init__(self,
{'Module (self)' : self,
'vtkTriangleFilter' : self._triangleFilter,
'vtkCurvatures' : self._curvatures})
module_utils.setup_vtk_object_progress(self, self._triangleFilter,
'Triangle filtering...')
module_utils.setup_vtk_object_progress(self, self._curvatures,
'Calculating curvatures...')
self.sync_module_logic_with_config()
示例5: __init__
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self._writer = vtk.vtkIVWriter()
# sorry about this, but the files get REALLY big if we write them
# in ASCII - I'll make this a gui option later.
#self._writer.SetFileTypeToBinary()
# following is the standard way of connecting up the devide progress
# callback to a VTK object; you should do this for all objects in
module_utils.setup_vtk_object_progress(
self, self._writer, 'Writing polydata to Inventor Viewer format')
# ctor for this specific mixin
FilenameViewModuleMixin.__init__(
self,
'Select a filename',
'InventorViewer data (*.iv)|*.iv|All files (*)|*',
{'vtkIVWriter': self._writer},
fileOpen=False)
# set up some defaults
self._config.filename = ''
self.sync_module_logic_with_config()
示例6: __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()
示例7: __init__
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()
示例8: __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()
示例9: __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()
示例10: __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()
示例11: __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()
示例12: __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()
示例13: _create_pipeline
def _create_pipeline(self):
# setup our pipeline
self._otf = vtk.vtkPiecewiseFunction()
self._ctf = vtk.vtkColorTransferFunction()
self._volume_property = vtk.vtkVolumeProperty()
self._volume_property.SetScalarOpacity(self._otf)
self._volume_property.SetColor(self._ctf)
self._volume_property.ShadeOn()
self._volume_property.SetAmbient(0.1)
self._volume_property.SetDiffuse(0.7)
self._volume_property.SetSpecular(0.2)
self._volume_property.SetSpecularPower(10)
self._volume_raycast_function = vtk.vtkVolumeRayCastMIPFunction()
self._volume_mapper = vtk.vtkVolumeRayCastMapper()
# can also used FixedPoint, but then we have to use:
# SetBlendModeToMaximumIntensity() and not SetVolumeRayCastFunction
#self._volume_mapper = vtk.vtkFixedPointVolumeRayCastMapper()
self._volume_mapper.SetVolumeRayCastFunction(
self._volume_raycast_function)
module_utils.setup_vtk_object_progress(self, self._volume_mapper,
'Preparing render.')
self._volume = vtk.vtkVolume()
self._volume.SetProperty(self._volume_property)
self._volume.SetMapper(self._volume_mapper)
示例14: __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()
示例15: __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()