VPTissue Reference Manual
SimplyRed.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
19 #include "SimplyRed.h"
20 #include "bio/Cell.h"
21 #include "util/color/hsv.h"
22 #include "util/color/Hsv2Rgb.h"
23 
24 #include <boost/property_tree/ptree.hpp>
25 
26 
27 namespace SimPT_Default {
28 namespace CellColor {
29 
30 using namespace std;
31 using namespace SimPT_Sim::Color;
32 
33 SimplyRed::SimplyRed(const boost::property_tree::ptree& , unsigned int index)
34 : m_index(index)
35 {
36 }
37 
38 std::array<double, 3> SimplyRed::operator()(SimPT_Sim::Cell* cell)
39 {
40  const double c0 = (cell->GetChemicals().size() > m_index) ? (cell->GetChemical(m_index) / cell->GetArea()) : 0.0;
41  return {{1.0,750. / (c0 +750.), 750. / (c0 +750.)}};
42 }
43 
44 } // namespace
45 } // namespace
46 
STL namespace.
A cell contains walls and nodes.
Definition: Cell.h:48
Header for SimplyRed colorizer.
std::array< double, 3 > operator()(SimPT_Sim::Cell *cell)
Return color value.
Definition: SimplyRed.cpp:38
SimplyRed(const boost::property_tree::ptree &pt, unsigned int index)
Straight initialization.
Definition: SimplyRed.cpp:33
Namespace for components of the Default model group.
Interface for Cell.
Header file for HSV colors.
Namespace for color utilities.
Definition: hsv.h:27
Rgb color def to Hsv color def: r,g,b values are from 0 to 1 and h = [0,360], s = [0...
double GetArea() const
Return the area of the cell.
Definition: Cell.cpp:178