コード例 #1
0
class vtkLocalPointCloud( vtkPointCloud ):

    def __init__( self, istart, **args ):
        vtkPointCloud.__init__( self )
        self.point_collection = MultiVarPointCollection()
        self.point_collection.setDataSlice( istart, **args )

    def getPointCollection( self ):
        return self.point_collection
    
    def setROI( self, roi ):
        self.point_collection.setROI( roi )
        self.initialize()
        
    def getMetadata( self ):
        return self.point_collection.getMetadata()

    def generateZScaling(self, **args ):
        z_subset_spec = args.get('spec', None )
        op_specs = [ 'points' ] + list( z_subset_spec )
        self.point_collection.execute( op_specs ) 
        self.setPointHeights( self.point_collection.getPointHeights()  )   
        self.grid_bounds = self.point_collection.getAxisBounds()
#        print "generateZScaling: Set grid bounds: %s " % str( self.grid_bounds )
        self.polydata.Modified()
        self.mapper.Modified()
        self.actor.Modified()
        self.actor.SetVisibility( True  )

    def generateSubset(self, **args ):
#        print " ++++++++++++++++++++++ vtkLocalPointCloud[%d].generateSubset: current_subset_specs: %s (%s) " % ( self.pcIndex, self.current_subset_specs, str(args) )
        self.current_subset_specs = args.get('spec', self.current_subset_specs)
#         if self.current_subset_specs[0] == 'Z3':
#             print " vtkLocalPointCloud[%d]: current_subset_specs: %s (%s) " % ( self.pcIndex, self.current_subset_specs, str(args) )
#        self.threshold_target = self.current_subset_specs[0]
        op_specs = [ spec for spec in  self.current_subset_specs.values() ]
        op_specs.insert( 0, 'indices' )
        vmin, vmax = self.point_collection.execute( op_specs )       
        self.np_index_seq = self.point_collection.selected_index_array
#        if self.threshold_target == "vardata": self.trange = ( vmin, vmax )
#        else: 
#            self.crange = ( vmin, vmax )
#            print "Set crange: ", str( self.crange )
        self.grid = self.point_collection.getGridType()
        self.current_scalar_range = self.vrange
        self.updateVertices() 
        self.updated_subset_specs = self.current_subset_specs
        
    def getNumberOfInputPoints(self): 
        return self.point_collection.getNumberOfInputPoints()
    
    def getSkipIndex(self): 
        return self.point_collection.istep
        
    def initialize(self, init_args = None, **args ):
        if init_args: self.point_collection.initialize( init_args, **args )
        else: self.point_collection.initPoints() 
        self.np_points_data = self.point_collection.getPoints()
        self.vrange = self.point_collection.getVarDataRange()
        self.initPoints( **args ) 
        self.createPolydata( **args )
        self.vardata = self.point_collection.getVarData()
        self.updateScalars() 
        self.grid_bounds = self.point_collection.getAxisBounds()
#        print "initialize: Set grid bounds: %s " % str( self.grid_bounds )
        self.nlevels = self.point_collection.getNLevels()
        self.actor.VisibilityOff()
        
    def getCenter(self):
        return ( self.point_collection.xcenter, self.point_collection.ycenter, self.point_collection.xwidth, self.point_collection.ywidth )
    
    def stepTime(self, **args): 
        if self.point_collection.stepTime( **args ):
            update_points = args.get( 'update_points', True )
            self.vardata = self.point_collection.getVarData()
            if update_points: self.generateSubset()
            self.updateScalars() 
コード例 #2
0
class vtkLocalPointCloud(vtkPointCloud):
    def __init__(self, istart, **args):
        vtkPointCloud.__init__(self)
        self.point_collection = MultiVarPointCollection()
        self.point_collection.setDataSlice(istart, **args)

    def getPointCollection(self):
        return self.point_collection

    def setROI(self, roi):
        self.point_collection.setROI(roi)
        self.initialize()

    def getMetadata(self):
        return self.point_collection.getMetadata()

    def generateZScaling(self, **args):
        z_subset_spec = args.get('spec', None)
        op_specs = ['points'] + list(z_subset_spec)
        self.point_collection.execute(op_specs)
        self.setPointHeights(self.point_collection.getPointHeights())
        self.grid_bounds = self.point_collection.getAxisBounds()
        #        print "generateZScaling: Set grid bounds: %s " % str( self.grid_bounds )
        self.polydata.Modified()
        self.mapper.Modified()
        self.actor.Modified()
        self.actor.SetVisibility(True)

    def generateSubset(self, **args):
        #        print " ++++++++++++++++++++++ vtkLocalPointCloud[%d].generateSubset: current_subset_specs: %s (%s) " % ( self.pcIndex, self.current_subset_specs, str(args) )
        self.current_subset_specs = args.get('spec', self.current_subset_specs)
        #         if self.current_subset_specs[0] == 'Z3':
        #             print " vtkLocalPointCloud[%d]: current_subset_specs: %s (%s) " % ( self.pcIndex, self.current_subset_specs, str(args) )
        #        self.threshold_target = self.current_subset_specs[0]
        op_specs = [spec for spec in self.current_subset_specs.values()]
        op_specs.insert(0, 'indices')
        vmin, vmax = self.point_collection.execute(op_specs)
        self.np_index_seq = self.point_collection.selected_index_array
        #        if self.threshold_target == "vardata": self.trange = ( vmin, vmax )
        #        else:
        #            self.crange = ( vmin, vmax )
        #            print "Set crange: ", str( self.crange )
        self.grid = self.point_collection.getGridType()
        self.current_scalar_range = self.vrange
        self.updateVertices()
        self.updated_subset_specs = self.current_subset_specs

    def getNumberOfInputPoints(self):
        return self.point_collection.getNumberOfInputPoints()

    def getSkipIndex(self):
        return self.point_collection.istep

    def initialize(self, init_args=None, **args):
        if init_args: self.point_collection.initialize(init_args, **args)
        else: self.point_collection.initPoints()
        self.np_points_data = self.point_collection.getPoints()
        self.vrange = self.point_collection.getVarDataRange()
        self.initPoints(**args)
        self.createPolydata(**args)
        self.vardata = self.point_collection.getVarData()
        self.updateScalars()
        self.grid_bounds = self.point_collection.getAxisBounds()
        #        print "initialize: Set grid bounds: %s " % str( self.grid_bounds )
        self.nlevels = self.point_collection.getNLevels()
        self.actor.VisibilityOff()

    def getCenter(self):
        return (self.point_collection.xcenter, self.point_collection.ycenter,
                self.point_collection.xwidth, self.point_collection.ywidth)

    def stepTime(self, **args):
        if self.point_collection.stepTime(**args):
            update_points = args.get('update_points', True)
            self.vardata = self.point_collection.getVarData()
            if update_points: self.generateSubset()
            self.updateScalars()