public void run() { PhysicalSphere sphere = cell.getSomaElement().getPhysicalSphere(); if (sphere.getDiameter() > 20) { cell.divide(); } else { sphere.changeVolume(300); } }
public static void main(String[] args) { Param.NEURITE_MAX_LENGTH = 20; double pi = Math.PI; // get a 2.5D ECM ECM ecm = ECM.getInstance(); ECM.setRandomSeed(5L); ecm.setArtificialWallsForCylinders(true); ecm.setArtificialWallsForSpheres(true); ecm.setBoundaries(-10000, 10000, -10000, 10000, -5, 5); // eighteen extra PhysicalNodes : for (int i = 0; i < 12; i++) { double[] loc = concat(randomNoise(600, 2), randomNoise(100, 1)); ecm.getPhysicalNodeInstance(loc); } // set the inter object force X_Adhesive_Force nogo = new X_Adhesive_Force(); nogo.setAttractionRange(3); nogo.setAttractionStrength(5); PhysicalObject.setInterObjectForce(nogo); // generate cells int nbOfCells = 20; int minNbOfNeurites = 4; int maxNbOfNeurites = 8; for (int i = 0; i < nbOfCells; i++) { Color c = Param.X_SOLID_GRAY; double[] cellLocation = new double[] { -200 + ECM.getRandomDouble() * 400, -200 + ECM.getRandomDouble() * 400, -5 + ECM.getRandomDouble() * 10 }; if (i == 0) { c = Param.X_SOLID_RED; cellLocation = new double[] {0, 0, 0}; } Cell cell = CellFactory.getCellInstance(cellLocation); SomaElement soma = cell.getSomaElement(); PhysicalSphere sphere = soma.getPhysicalSphere(); if (i == 0) { cell.setNeuroMLType(Cell.InhibitoryCell); } else { cell.setNeuroMLType(Cell.ExcitatoryCell); } sphere.setColor(c); sphere.setAdherence(100); int nbOfNeurites = minNbOfNeurites + ((int) ((maxNbOfNeurites - minNbOfNeurites) * ECM.getRandomDouble())); for (int j = 0; j < nbOfNeurites; j++) { double angleOfAxon = pi * 2 * ECM.getRandomDouble(); double growthSpeed = 75; double probaToBranch = 0.003; double linearDiameterDecrease = 0.001; NeuriteElement ne; if (j == 0) { ne = cell.getSomaElement().extendNewNeurite(3.0, Math.PI * 0.5, angleOfAxon); ne.setIsAnAxon(true); growthSpeed = 150; probaToBranch = 0.009; linearDiameterDecrease = 0; ne.getPhysicalCylinder().setDiameter(1.5); } else if (j == 1) { ne = cell.getSomaElement() .extendNewNeurite( 3.0, Math.PI * 0.5, angleOfAxon + Math.PI - 0.5 + ECM.getRandomDouble()); ne.setIsAnAxon(false); } else { ne = cell.getSomaElement() .extendNewNeurite(3.0, Math.PI * 0.5, Math.PI * 2 * ECM.getRandomDouble()); ne.setIsAnAxon(false); } X_Bifurcation_Module br = new X_Bifurcation_Module(); br.shift = probaToBranch; ne.addLocalBiologyModule(br); X_Movement_Module mr = new X_Movement_Module(); mr.setRandomness(0.7); mr.setSpeed(growthSpeed); mr.setLinearDiameterDecrease(linearDiameterDecrease); ne.addLocalBiologyModule(mr); } } for (int i = 0; i < 350; i++) { // 350 Scheduler.simulateOneStep(); } TestSynapses.extendExcressencesAndSynapseOnEveryNeuriteElement(0.4); Exporter.saveExport(); }