MCPcopy Create free account
hub / github.com/Kitware/VTK / ParseVector

Function ParseVector

IO/Image/vtkNrrdReader.cxx:116–135  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

114
115//------------------------------------------------------------------------------
116static std::vector<double> ParseVector(std::string s)
117{
118 std::vector<double> result;
119
120 s = trim(s);
121 if ((s[0] != '(') || (s[s.length() - 1] != ')'))
122 return result;
123 s = s.substr(1, s.length() - 2);
124 while (true)
125 {
126 size_t i = s.find(',');
127 std::string value = s.substr(0, i);
128 result.push_back(vtk::scan_value<double>(value)->value());
129 if (i == std::string::npos)
130 break;
131 s = s.substr(i + 1);
132 }
133
134 return result;
135}
136
137//------------------------------------------------------------------------------
138static int NrrdType2VTKType(std::string nrrdType)

Callers 1

ReadHeaderMethod · 0.85

Calls 5

trimFunction · 0.50
lengthMethod · 0.45
findMethod · 0.45
push_backMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected