Questions about programming statements


80
views
0
11 weeks ago by
pt.x=int(round(cell.xCOM))
pt.y=int(round(cell.yCOM))
pt.z=int(round(cell.zCOM))
I don't understand the effect of this statement in python.
Community: CompuCell3D

1 Answer


1
11 weeks ago by
A Compucell3D point is an integer triple and pt.x refers to the x-coordinate of that point. The center of mass (COM) coordinates (e.g., cell.xCOM) are floating point numbers since, in general, even with integer coordinates the COM will not consist of integers.

The command "int(round(cell.xCOM))" firsts rounds the COM coordinate to the nearest integer (but the data type is still a float), it then converts the type to integer so the value is compatible with the integer definition of a CC3D pt.

I am not sure if I understand your second question. Do you want the first cell to migrate towards the second cell or do you want to make the first cell part of the second?

To migrate the first cell towards the second you can use focal point plasticity links (FPP). In general though, it is likely that both cells will move towards each other. If you want to keep one cell from moving you can use an additional FPP link between the cell you don't want to move and its initial COM. See the demos of FPP in the folder; C:\CompuCell3D\Demos\PluginDemos Demos/FocalPointPlasticity
I used focal point plasticity plugin and the statement format used are the same as in the demos. But A type cells does not move to B type cells. Is it because the initial distance is too far, or the 3D model needs additional statements?
written 10 weeks ago by dali Zan  
If you do not use int(round(x)) you will often create biases in the simulation that will manifest themselves after few hundreds / thousands of MCS and they would be bad because in some cases they can effectively mimic an external force that is not there. So yes each time you ned to pick pixel that is closest to center of mass you need to use int(round())
written 9 weeks ago by Maciek Swat  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »