what's the meaning of neighborAddress?


104
views
1
4 months ago by
Yuan  
Hi, everyone. I am just reading the CC3D code in Ph.D. thesis 'Modeling interactions between a tumor cell and its host epithelium', Eline Boghaert, Princeton University (2014).
There are some puzzles for me in the following code, what're the properties of  neighborAddress ?
diameters?

 
#for each LEP calculate the number of cells that are 2.5 cell diameters away (2nd order neighbors)
class ApoptosisSteppable(SteppableBasePy):
    def __init__(self,_simulator,_frequency=1):
        SteppableBasePy.__init__(self,_simulator,_frequency)
    def step(self,mcs):
        if mcs>10:
            cell_apoptosis=[]
            for cell in self.cellListByType(1):
                neighbors=[]
                a=cell.id
                id=[cell.id]
                cellNeighborList=self.getCellNeighbors(cell)
                for neighbor in cellNeighborList:
                    if neighbor.neighborAddress and neighbor.neighborAddress.type==1:
                        neighbors.append(neighbor.neighborAddress)
                        id.append(neighbor.neighborAddress.id)
                        
                for cell in neighbors:
                    cellNeighborList=self.getCellNeighbors(cell)
                    for neighbor in cellNeighborList:
                        if neighbor.neighborAddress and neighbor.neighborAddress.type==1:
                            if neighbor.neighborAddress.id in id:
                                pass
                            else:
                                id.append(neighbor.neighborAddress.id)
            #if there are more than 10 cells within a 2.5 cell diameter radius the LEP undergoes apoptosis with a given probability
            #the randint function is used to specify this probability
                if len(id)>10 and randint(1,1000)<=10:
                    cell_apoptosis.append(a)
            
            for cell in self.cellListByType(1):
                if cell.id in cell_apoptosis:
                    cell.targetVolume=0
                    cell.lambdaVolume=1000
                ​
Community: CompuCell3D

2 Answers


4
4 months ago by
strictly speaking neighborAddress is a C++ address of the neighbor cell object. In Python neighborAddress is simply a neighbor cell so if you type:

neighborAddress.id
you will get id of th neighbor cell

if you type
neighborAddress.volume

you will get volume of the neighbor cell

etc..


One thing to keep in mind is that Medium can be a neighbor too and Medium is a zero pointer in C++ so the neighbor address of it will be 0 and you cannot as for id or volume of the Medium. This is why you often see the if statement that checks if neighbor address is NULL or not

Also , the new examples in 3.7.6 + use somewhat cleaner terminology w.r.t. iteration over neghbors

  
Oh,I see, thank you. I still have a puzzle, when I meet some commands which don't appear in the manuals, how can I know its usage and function, in addition to asking in the community?
written 4 months ago by Yuan  
Usually the best thing is to ask people in this forum. We are working to fix the documentation but sometimes  code development cycle is ahead of the documentation cycle. Any questions you post here will get incorporated into the manuals. It also help us understand what aspects of CC3D are most confusing to people
written 4 months ago by Maciek Swat  
0
4 months ago by
I found the new Python Scripting Manual helpful in this particular case http://pythonscriptingmanual.readthedocs.io/en/latest/SteppableBasePy_class.html .
Most of the simulation is done on self.cellList, and I was able to understand the Python scripting more once I knew more about the basic class.

I like the particular example you posted. I am also doing simulations involving logic based on cell neighbors.
Please login to add an answer/comment or follow this question.

Similar posts:
Search »