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

Method ReadAsciiFloat

Utilities/DICOMParser/DICOMFile.cxx:229–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229float DICOMFile::ReadAsciiFloat(int len)
230{
231 float ret = 0.0;
232
233 char* val = new char[len + 1];
234 this->Read(val, len);
235 val[len] = '\0';
236
237#if 0
238 //
239 // istrstream destroys the data during formatted input.
240 //
241 int len2 = static_cast<int> (strlen((char*) val));
242 char* val2 = new char[len2];
243 strncpy(val2, (char*) val, len2);
244
245 std::istrstream data(val2);
246 data >> ret;
247 delete [] val2;
248#else
249 ret = vtk::scan_value<float>(std::string_view(val, len))->value();
250#endif
251
252 std::cout << "Read ASCII float: " << ret << std::endl;
253
254 delete[] val;
255 return (ret);
256}
257
258int DICOMFile::ReadAsciiInt(int len)
259{

Callers

nothing calls this directly

Calls 2

ReadMethod · 0.95
valueMethod · 0.45

Tested by

no test coverage detected