Namespace defining the cell system division algorithm and model. More...
Classes | |
class | CellSystem |
Full cell-system model. More... | |
class | CellSystemCell |
Content of a vertex for the 2D cell system. More... | |
class | CellSystemDivisionParams |
Parameters for cell-system division. More... | |
class | CellSystemJunction |
Content of a vertex for the 2D cell system. More... | |
class | DivisionParams |
Structure storing the right hand side of a division rule. More... | |
Typedefs | |
typedef int | label_t |
Type of the label of a cell (for full cell-system only). | |
Functions | |
template<class Complex > | |
DivisionData< typename Complex::junction_content > | findDivisionPoints (const typename Complex::cell &c, Complex &T, const CellSystemDivisionParams ¶ms) |
Division algorithm for cell-system. | |
template<class Complex > | |
DivisionData< typename Complex::junction_content > | findDivisionPoints (const typename Complex::cell &c, Point3d ¢er, Complex &T, const Point3d &direction) |
Find the division points for a wall going through a given point. | |
std::string | removeWhitespace (std::string s) |
Convenience function that removes white spaces before and after the string. | |
template<class Complex > | |
double | volumeLeftCell (const typename Complex::cell &c, Complex &T, const Point3d ¢er, const DivisionData< typename Complex::junction_content > &result) |
Compute the volume of the left cell of a division. |
Namespace defining the cell system division algorithm and model.
typedef int cell_system::label_t |
Type of the label of a cell (for full cell-system only).
Definition at line 304 of file cellsystem.h.
DivisionData<typename Complex::junction_content> cell_system::findDivisionPoints | ( | const typename Complex::cell & | c, | |
Complex & | T, | |||
const CellSystemDivisionParams & | params | |||
) | [inline] |
Division algorithm for cell-system.
Definition at line 213 of file cellsystem.h.
References cell_system::CellSystemDivisionParams::angle, tissue::cellPinching(), cell_system::CellSystemDivisionParams::direction, cell_system::CellSystemDivisionParams::epsilon, findDivisionPoints(), forall, IMPORT_COMPLEX_MODEL, IMPORT_COMPLEX_VERTICES, cell_system::CellSystemDivisionParams::minCellWall, cell_system::CellSystemDivisionParams::pinching, cell_system::CellSystemDivisionParams::pinchingParam, cell_system::CellSystemDivisionParams::ratio, vvcomplex::testDivisionOnVertices(), and volumeLeftCell().
00215 { 00216 IMPORT_COMPLEX_VERTICES(Complex); 00217 IMPORT_COMPLEX_MODEL(Complex, T); 00218 const Point3d& cell_normal = model.normal(c); 00219 Point3d direction = util::Matrix<3,3,double>::rotation(cell_normal, params.angle) * params.direction; 00220 // cout << "Z = " << params.direction << " - angle = " << params.angle << " => direction = " << direction << endl; 00221 // cout << "Polygon: "; 00222 // forall(const vertex& j, S.neighbors(cell)) 00223 // { 00224 // cout << model.vertexPosition(j) << "; "; 00225 // } 00226 // cout << endl; 00227 Point3d center = model.position(c); 00228 // First, find the division points going through the center 00229 DivisionData<typename Complex::junction_content> result = 00230 findDivisionPoints(c, center, T, direction); 00231 if(!result) 00232 { 00233 return DivisionData<typename Complex::junction_content>(); 00234 } 00235 00236 // Then, if ratio != 0 then adjust volume by dichotomy 00237 if(params.ratio) 00238 { 00239 // Volume of the cell 00240 double total_volume = model.area(c); 00241 double target_volume = total_volume*params.ratio; 00242 double vol_epsilon = params.epsilon * target_volume; 00243 double proj_min = HUGE_VAL, proj_max = -HUGE_VAL; 00244 Point3d pos_max, pos_min; 00245 forall(const junction& j, T.S.neighbors(c)) 00246 { 00247 const Point3d& jpos = model.position(j); 00248 double proj = (jpos - center) * direction; 00249 if(proj > proj_max) 00250 { 00251 proj_max = proj; 00252 pos_max = jpos; 00253 } 00254 if(proj < proj_min) 00255 { 00256 proj_min = proj; 00257 pos_min = jpos; 00258 } 00259 } 00260 double current_volume = volumeLeftCell(c, T, center, result); 00261 Point3d delta; 00262 if(current_volume < target_volume) 00263 { 00264 delta = proj_max*direction; 00265 } 00266 else 00267 { 00268 delta = -proj_min*direction; 00269 } 00270 // cout << endl << endl; 00271 // cout << "Total volume = " << total_volume << " => target_volume = " << target_volume << endl; 00272 // cout << "Pos max = " << pos_max << " - Pos min = " << pos_min << endl; 00273 // cout << "delta = " << delta << endl; 00274 while(std::abs(current_volume - target_volume) > vol_epsilon) 00275 { 00276 delta /= 2; 00277 if(current_volume < target_volume) 00278 { 00279 center += delta; 00280 } 00281 else 00282 { 00283 center -= delta; 00284 } 00285 // cout << "New delta = " << delta << " - new center = " << center << 00286 // endl; 00287 result = findDivisionPoints(c, center, T, direction); 00288 current_volume = volumeLeftCell(c, T, center, result); 00289 // cout << "pu = " << result.pu << " - pv = " << result.pv << endl; 00290 } 00291 // cout << "Volume = " << current_volume << endl; 00292 } 00293 if(params.pinching) 00294 { 00295 tissue::cellPinching(c, T, result, params.pinchingParam); 00296 } 00297 testDivisionOnVertices(c, result, T, std::max(params.epsilon,params.minCellWall)); 00298 return result; 00299 }
DivisionData<typename Complex::junction_content> cell_system::findDivisionPoints | ( | const typename Complex::cell & | c, | |
Point3d & | center, | |||
Complex & | T, | |||
const Point3d & | direction | |||
) | [inline] |
Find the division points for a wall going through a given point.
[in] | c | Cell to be divided |
[out] | center | Point defining the line of the division wall. At the end, center is the center of the division wall. |
[in] | T | Complex containing the cell to divide |
[in] | direction | Normal to the division wall |
The division wall is a segment on the line going through center
and with direction
as normal.
Definition at line 127 of file cellsystem.h.
References forall, IMPORT_COMPLEX_MODEL, IMPORT_COMPLEX_VERTICES, geometry::planeLineIntersection(), vvcomplex::DivisionData< JunctionContent >::pu, vvcomplex::DivisionData< JunctionContent >::pv, vvcomplex::DivisionData< JunctionContent >::u1, and vvcomplex::DivisionData< JunctionContent >::v1.
Referenced by findDivisionPoints().
00129 { 00130 IMPORT_COMPLEX_VERTICES(Complex); 00131 IMPORT_COMPLEX_MODEL(Complex, T); 00132 DivisionData<typename Complex::junction_content> result; 00133 // cout << "Finding points for center: " << center << endl; 00134 forall(const junction& v, T.S.neighbors(c)) 00135 { 00136 const junction& n = T.S.nextTo(c, v); 00137 const Point3d& p1 = model.position(v); 00138 const Point3d& p2 = model.position(n); 00139 Point3d u; 00140 double s; 00141 if(geometry::planeLineIntersection(u, s, center, direction, p1, p2) && s >= 0 && s <= 1) 00142 { 00143 // cout << "Intersection between " << p1 << " and " << p2 << " at " << u << " with s = " << s << endl; 00144 if((p1-center)*direction > 0) 00145 { 00146 // cout << "Found v1 at " << model.vertexPosition(v) << " with pv = " << u << endl; 00147 // if(result.v1) 00148 // { 00149 // cout << "Warning, finding v1 again" << endl; 00150 // } 00151 result.v1 = v; 00152 result.pv = u; 00153 } 00154 else 00155 { 00156 // cout << "Found u1 at " << model.vertexPosition(v) << " with pu = " << u << endl; 00157 // if(result.u1) 00158 // { 00159 // cout << "Warning, finding v1 again" << endl; 00160 // } 00161 result.u1 = v; 00162 result.pu = u; 00163 } 00164 if(result.v1 && result.u1) 00165 break; 00166 } 00167 } 00168 if(result.u1 && result.v1) 00169 { 00170 center = (result.pu+result.pv)/2; 00171 } 00172 return result; 00173 }
std::string cell_system::removeWhitespace | ( | std::string | s | ) |
Convenience function that removes white spaces before and after the string.
double cell_system::volumeLeftCell | ( | const typename Complex::cell & | c, | |
Complex & | T, | |||
const Point3d & | center, | |||
const DivisionData< typename Complex::junction_content > & | result | |||
) | [inline] |
Compute the volume of the left cell of a division.
Do so with just the division data.
c | Cell being divided | |
T | Complex containing the cell c | |
center | A point on the division wall | |
result | Division data being used | |
model | Model is use |
Definition at line 187 of file cellsystem.h.
References IMPORT_COMPLEX_MODEL, IMPORT_COMPLEX_VERTICES, vvcomplex::DivisionData< JunctionContent >::pu, vvcomplex::DivisionData< JunctionContent >::pv, geometry::triangleArea(), vvcomplex::DivisionData< JunctionContent >::u1, and vvcomplex::DivisionData< JunctionContent >::v1.
Referenced by findDivisionPoints().
00189 { 00190 IMPORT_COMPLEX_VERTICES(Complex); 00191 IMPORT_COMPLEX_MODEL(Complex, T); 00192 double area = 0; 00193 junction v = result.v1; 00194 Point3d prev = result.pv; 00195 do 00196 { 00197 v = T.S.nextTo(c, v); 00198 const Point3d& cur = model.position(v); 00199 area += geometry::triangleArea(center, prev, cur); 00200 prev = cur; 00201 } while(v != result.u1); 00202 area += geometry::triangleArea(center, prev, result.pu); 00203 return area; 00204 }