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


Python CompuCell.getMediumCell方法代码示例

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


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

示例1: moveCell

# 需要导入模块: import CompuCell [as 别名]
# 或者: from CompuCell import getMediumCell [as 别名]
    def moveCell(self, cell, shiftVector):
        #we have to make two list of pixels :
        pixelsToDelete=[] #used to hold pixels to delete
        pixelsToMove=[] #used to hold pixels to move
        
        # If we try to reassign pixels in the loop where we iterate over pixel data we will corrupt the container so in the loop below all we will do is to populate the two list mentioned above
        pixelList=self.getCellPixelList(cell)
        pt=CompuCell.Point3D()
        print " Moving ",pixelList.numberOfPixels()," pixels of cell.id=",cell.id," . Shift vector=",shiftVector
        for pixelTrackerData in pixelList:
            pt.x = pixelTrackerData.pixel.x + shiftVector.x
            pt.y = pixelTrackerData.pixel.y + shiftVector.y
            pt.z = pixelTrackerData.pixel.z + shiftVector.z
            # here we are making a copy of the cell 
            print "adding pt=",pt
            pixelsToDelete.append(CompuCell.Point3D(pixelTrackerData.pixel))
            
            if self.checkIfInTheLattice(pt):
                pixelsToMove.append(CompuCell.Point3D(pt))
                # self.cellField.set(pt,cell)
         
        # Now we will move cell
        for pixel in pixelsToMove:
#             self.cellField.set(pixel,cell)
             self.cellField[pixel.x,pixel.y,pixel.z]=cell
             
        # Now we will delete old pixels    
        pixelList=self.getCellPixelList(cell)
        pt=CompuCell.Point3D()
        
        self.mediumCell=CompuCell.getMediumCell()
        print " Deleting ",len(pixelsToDelete)," pixels of cell.id=",cell.id
        for pixel in pixelsToDelete:            
            self.cellField[pixel.x,pixel.y,pixel.z]=self.mediumCell
开发者ID:AngeloTorelli,项目名称:CompuCell3D,代码行数:36,代码来源:CellManipulationSteppables.py

示例2: deleteCell

# 需要导入模块: import CompuCell [as 别名]
# 或者: from CompuCell import getMediumCell [as 别名]
    def  deleteCell(self,cell):
#         pixelsToDelete=self.getCopyOfCellPixels(cell,SteppableBasePy.CC3D_FORMAT) # returns list of Point3D
        pixelsToDelete=self.getCopyOfCellPixels(cell,SteppableBasePy.TUPLE_FORMAT) # returns list of tuples
        
        
        self.mediumCell=CompuCell.getMediumCell()    
        for pixel in pixelsToDelete:            
            print "CELL.volume=",cell.volume
            self.cellField[pixel[0],pixel[1],pixel[2]]=self.mediumCell
开发者ID:AngeloTorelli,项目名称:CompuCell3D,代码行数:11,代码来源:CellManipulationSteppables.py

示例3: start

# 需要导入模块: import CompuCell [as 别名]
# 或者: from CompuCell import getMediumCell [as 别名]
    def start(self):
        radi = self.dim.x/2
        # Assign Property for Cell ID = 1
        cells_to_die=[]
        for cell in self.cellListByType(1):
            cell.targetVolume = tVol
            cell.lambdaVolume = 5
        # Basal Membrane Generation
        radi = int(self.dim.x/2)
        pt=CompuCell.Point3D(0,0,0)
        Wall = self.potts.createCellG(pt) # the arguments are (type,pt,xSize,ySize,zSize)  
        Wall.type = 2
        totalNumOfSeg = 15
        segm = []   
        cellsToDelete=[]
        for pty in range(0,self.dim.y):
            for ptx in range(0,self.dim.x):
                for ptz in range(0,self.dim.z):
                    pt.y=pty
                    pt.x=ptx
                    pt.z=ptz        
                    # Generate Tube structure
                    if pty>= radi:
                        if ((ptx-radi)**2+(ptz-radi)**2)<=radi**2 and ((ptx-radi)**2+(ptz-radi)**2)>=(radi-5)**2:
                            overwrittenCell=self.cellField.get(pt)  

                            self.cellField.set(pt,Wall)
                            self.cleanDeadCells()
                            
                            ang = math.atan2(ptx-radi,ptz-radi)*(180./math.pi)+180
                            segN= int(ang/(360/totalNumOfSeg))
                            if segN ==15:
                                segN = 0
                            segm.append([segN,pt])
                        
                        elif ((ptx-radi)**2+(ptz-radi)**2)>radi**2:
                            self.cellField.set(pt,CompuCell.getMediumCell())
                            self.cleanDeadCells()
                    # Generate Semi-Sphere Sturcture ((Bottom of the crypt)
                 
                    elif pty < radi:
                        if ((ptx-radi)**2+(pty-radi)**2+(ptz-radi)**2)<=radi**2 and ((ptx-radi)**2+(pty-radi)**2+(ptz-radi)**2)>=(radi-5)**2:
                            self.cellField.set(pt,Wall)
                            self.cleanDeadCells()
                        elif ((ptx-radi)**2+(pty-radi)**2+(ptz-radi)**2)>radi**2:
                            overwrittenCell=self.cellField.get(pt)
                            if pt.x!=0 and pt.y!=0 and pt.z!=0: # this line is essential because you do not wan to remove wall cell which sits at (0,0,0)
                                self.cellField.set(pt,CompuCell.getMediumCell())
                                self.cleanDeadCells()
        # now we can overwrite (0,0,0) with medium
        pt.x=0
        pt.y=0
        pt.z=0
        self.cellField.set(pt,CompuCell.getMediumCell())
        self.divideCellOrientationVectorBased(Wall,0,0,1)
        for divN in range(0,3):        
            cell_to_divide=[]    
            # iterating over cells of type 2        
            for cell in self.cellListByType(2):
                cell_to_divide.append(cell)
            for cell in cell_to_divide:
                DiviVectorX = (cell.xCOM-radi)
                DiviVectorZ = (cell.zCOM-radi) 
                self.divideCellOrientationVectorBased(cell,-DiviVectorZ,0,DiviVectorX) 
        for divN in range(0,4):
            cell_to_divide=[]    
            # iterating over cells of type 2        
            for cell in self.cellListByType(2):
                cell_to_divide.append(cell)
            for cell in cell_to_divide:
                self.divideCellOrientationVectorBased(cell,0,1,0)   
        # Assign property for Cell type = 2
        for cell in self.cellListByType(2): 
            cell.targetVolume = cell.volume
            cell.lambdaVolume = 10000000
        cells_to_die=[]
        for cell in self.cellList:
            if cell.type == 1:                    
                # Program Cell Death
                # Set up threshold to kill cells when cells go above the threshold
                if cell.yCOM > self.dim.y-10:
                    cells_to_die.append(cell)
                cellNeighborList=self.getCellNeighbors(cell) # generates list of neighbors of cell 'cell'
                wallflag=0
                # Kill cells when the cells not touching BM
                for neighbor in cellNeighborList:
                    # neighborSurfaceData.neighborAddress is a pointer to one of 'cell' neighbors stired in cellNeighborList
                    #IMPORTANT: cell may have Medium (NULL pointer) as a neighbor. therefore before accessing neighbor we first check if it is no Medium
                    if neighbor.neighborAddress: 
                        # Detect the cells touching BM
                        if neighbor.neighborAddress.type == 2:
                            wallflag=1
                if wallflag==0:
                    # Delete the cells without contacting BM
                    cells_to_die.append(cell)
                   
        # Cell Killing program
        for cell in cells_to_die:    
            cell.targetVolume = 0
            self.deleteCell(cell)
#.........这里部分代码省略.........
开发者ID:KaiYChen,项目名称:DeltaNotch_cc3d,代码行数:103,代码来源:DeltaNotchSteppables.py

示例4: start

# 需要导入模块: import CompuCell [as 别名]
# 或者: from CompuCell import getMediumCell [as 别名]
 def start(self):
     self.pixelAssigned=False
     self.mediumCell=CompuCell.getMediumCell()   
     self.boundaryArray=self.boundaryMonitorPlugin.getBoundaryArray()
     print 'self.boundaryArray=',self.boundaryArray
     print 'dir(self.boundaryArray)=',dir(self.boundaryArray)
开发者ID:AngeloTorelli,项目名称:CompuCell3D,代码行数:8,代码来源:BoundaryMonitorExampleSteppables.py


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