MCPcopy Create free account
hub / github.com/MITK/MITK / ReadPoints

Method ReadPoints

Modules/ContourModel/src/IO/mitkContourModelReader.cpp:135–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void mitk::ContourModelReader::ReadPoints(mitk::ContourModel::Pointer newContourModel,
136 const tinyxml2::XMLElement *currentTimeSeries,
137 unsigned int currentTimeStep)
138{
139 // check if the timesteps in contourModel have to be expanded
140 if (currentTimeStep != newContourModel->GetTimeSteps())
141 {
142 newContourModel->Expand(currentTimeStep + 1);
143 }
144
145 // read all points within controlPoints tag
146 if (currentTimeSeries->FirstChildElement("controlPoints")->FirstChildElement("point") != nullptr)
147 {
148 for (auto *currentPoint =
149 currentTimeSeries->FirstChildElement("controlPoints")->FirstChildElement("point")->ToElement();
150 currentPoint != nullptr;
151 currentPoint = currentPoint->NextSiblingElement())
152 {
153 double x(0.0);
154 double y(0.0);
155 double z(0.0);
156
157 x = atof(currentPoint->FirstChildElement("x")->GetText());
158 y = atof(currentPoint->FirstChildElement("y")->GetText());
159 z = atof(currentPoint->FirstChildElement("z")->GetText());
160
161 int isActivePoint;
162 currentPoint->QueryIntAttribute("isActive", &isActivePoint);
163
164 mitk::Point3D point;
165 mitk::FillVector3D(point, x, y, z);
166 newContourModel->AddVertex(point, isActivePoint, currentTimeStep);
167 }
168 }
169 else
170 {
171 // nothing to read
172 }
173}

Callers 1

DoReadMethod · 0.95

Calls 5

FillVector3DFunction · 0.85
GetTimeStepsMethod · 0.80
ExpandMethod · 0.45
GetTextMethod · 0.45
AddVertexMethod · 0.45

Tested by

no test coverage detected