/usr/include/ITK-4.5/itkBioCell.hxx is in libinsighttoolkit4-dev 4.5.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | /*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef __itkBioCell_hxx
#define __itkBioCell_hxx
#include "itkBioCell.h"
#include "vnl/vnl_math.h"
#include "vnl/vnl_sample.h"
#include <new>
namespace itk
{
namespace bio
{
/**
* Constructor Lonely Cell
*/
template< unsigned int NSpaceDimension >
Cell< NSpaceDimension >
::Cell()
{
m_Force.Fill(0.0f);
// Genome pointers are set to NULL in the superclass.
}
/**
* Destructor
*/
template< unsigned int NSpaceDimension >
Cell< NSpaceDimension >
::~Cell()
{
// Genomes are released in the destructor of the superclass.
}
/**
* Cell Division
*/
template< unsigned int NSpaceDimension >
void
Cell< NSpaceDimension >
::Mitosis(void)
{
// Create the two daughters.
Cell *siblingA = new Cell;
Cell *siblingB = new Cell;
// Broad compensation for Volume distribution among daugthers.
// The type of root should depend on the Dimension...
siblingA->m_Radius = m_Radius / vcl_sqrt(2.0f);
siblingB->m_Radius = m_Radius / vcl_sqrt(2.0f);
// Update Teleomeres
siblingA->m_Generation = m_Generation + 1;
siblingB->m_Generation = m_Generation + 1;
// Prepare to separate them by a specific distance.
// This helps to avoid infinite interaction forces
// just after cellular division.
const double perturbationLength = m_Radius * 0.75;
// Register the parent
siblingA->m_ParentIdentifier = m_SelfIdentifier;
siblingB->m_ParentIdentifier = m_SelfIdentifier;
// Pass the genome to each daughter cell
siblingA->m_Genome = m_Genome;
siblingB->m_Genome = m_GenomeCopy;
// Mark that the genome pointer is not owned by this cell anymore.
m_Genome = NULL;
m_GenomeCopy = NULL;
// Register both daughter cells with the CellularAggregate.
CellularAggregateBase *aggregate = this->GetCellularAggregate();
aggregate->Add(siblingA, siblingB, perturbationLength);
// Mark this cell for being removed from the Aggregate and deleted.
this->MarkForRemoval();
}
/**
* Create a New Egg Cell
* This method behaves like a factory. It is
* intended to be overloaded in any class
* deriving from Cell.
*/
template< unsigned int NSpaceDimension >
Cell< NSpaceDimension > *
Cell< NSpaceDimension >
::CreateEgg(void)
{
Cell *cell = new Cell;
cell->m_ParentIdentifier = 0;
cell->m_SelfIdentifier = 1;
cell->m_Generation = 0;
cell->m_Genome = new GenomeType;
cell->ComputeGeneNetwork();
cell->SecreteProducts();
return cell;
}
/**
* Clear the cumulator for applied forces
*/
template< unsigned int NSpaceDimension >
void
Cell< NSpaceDimension >
::ClearForce(void)
{
m_Force.Fill(0.0f);
m_Pressure = 0.0f;
}
/**
* Return the cumulated force
*/
template< unsigned int NSpaceDimension >
const typename Cell< NSpaceDimension >::VectorType &
Cell< NSpaceDimension >
::GetForce(void) const
{
return m_Force;
}
/**
* Return a pointer to the Cellular Aggregate
*/
template< unsigned int NSpaceDimension >
CellularAggregateBase *
Cell< NSpaceDimension >
::GetCellularAggregate(void)
{
return m_Aggregate;
}
/**
* Return a const pointer to the Cellular Aggregate
*/
template< unsigned int NSpaceDimension >
const CellularAggregateBase *
Cell< NSpaceDimension >
::GetCellularAggregate(void) const
{
return m_Aggregate;
}
/**
* Set Cellular Aggregate
*/
template< unsigned int NSpaceDimension >
void
Cell< NSpaceDimension >
::SetCellularAggregate(CellularAggregateBase *cells)
{
m_Aggregate = cells;
}
/**
* Add a force to the cumulator
*/
template< unsigned int NSpaceDimension >
void
Cell< NSpaceDimension >
::AddForce(const VectorType & force)
{
if ( m_ChemoAttractantLevel > ChemoAttractantLowThreshold
&& m_ChemoAttractantLevel < ChemoAttractantHighThreshold )
{
double factor = 1.0 / vcl_pow( m_Radius, (double)( NSpaceDimension ) );
m_Force += force;
m_Pressure += force.GetNorm() * factor;
}
else
{
// no force so it is fixed in place....
}
}
/**
* Programmed Cell Death
* This is the cellular equivalent of suicide.
*/
template< unsigned int NSpaceDimension >
void
Cell< NSpaceDimension >
::Apoptosis(void)
{
// This call will release the Genomes
this->Superclass::Apoptosis();
CellularAggregateBase *aggregate = GetCellularAggregate();
// "this" cell will be destroyed here
aggregate->Remove(this);
}
/**
* Execute a time step in the life of the cell.
* This is one step in the cell cycle.
*
* Nutrients are acquired
* Energy is acquired
* If conditions allow it, the cell will grow
* The position will be updated according to
* applied forces
*/
template< unsigned int NSpaceDimension >
void
Cell< NSpaceDimension >
::AdvanceTimeStep(void)
{
// get input from the environment
this->ReceptorsReading();
// update the level of expression of all the
// genes in the gene network
this->ComputeGeneNetwork();
// this method produces the effects of gene
// activation and protein synthesis. It is
// mostly used for secreting proteins already
// synthetized in the ComputeGeneNetwork method.
this->SecreteProducts();
// If this happens, it is an
// emergency situation: Do it first.
if ( this->CheckPointApoptosis() )
{
m_CycleState = Apop;
}
switch ( m_CycleState )
{
case M: // Mitosis
m_CycleState = Gap1;
break;
case Gap1:
{
// Gap 1 : growing
if ( this->CheckPointDNAReplication() )
{
m_CycleState = S;
}
break;
}
case S:
m_CycleState = Gap2;
break;
case Gap2:
if ( this->CheckPointMitosis() )
{
m_CycleState = M;
}
break;
case Gap0:
// The cell is in cell cycle arrest
m_CycleState = Gap0;
break;
case Apop:
m_CycleState = Apop;
break;
}
// Atomaton : Execute action
switch ( m_CycleState )
{
case M: // Mitosis
// This is a terminal action. The implementation of the cell
// is destroyed after division. Our abstraction assumes that
// the cell disapears and two new cell are created.
this->Mitosis();
break;
case Gap1:
// Eat and grow
this->NutrientsIntake();
this->EnergyIntake();
this->Grow();
break;
case Gap0:
this->NutrientsIntake();
this->EnergyIntake();
break;
case S:
this->DNAReplication();
break;
case Gap2:
break;
case Apop:
this->Apoptosis();
break;
}
}
/**
* Reading substrate using receptors
*/
template< unsigned int NSpaceDimension >
void
Cell< NSpaceDimension >
::ReceptorsReading(void)
{
m_Genome->SetExpressionLevel(Pressurin, m_Pressure);
float substrate0 = m_Aggregate->GetSubstrateValue(m_SelfIdentifier, 0);
m_ChemoAttractantLevel = substrate0;
}
} // end namespace bio
} // end namespace itk
#endif
|