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

Method ExtractCESTOffset

Modules/CEST/src/mitkExtractCESTOffset.cpp:54–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54std::vector<mitk::ScalarType> mitk::ExtractCESTOffset(const BaseData* image)
55{
56 std::vector<ScalarType> result;
57
58 auto prop = image->GetProperty(CEST_PROPERTY_NAME_OFFSETS().c_str());
59 if (prop.IsNotNull())
60 {
61 auto valueStr = prop->GetValueAsString();
62
63 std::istringstream iss;
64 iss.imbue(std::locale("C"));
65 iss.str(valueStr);
66 double d;
67
68 while (iss >> d)
69 {
70 if (!iss.fail())
71 {
72 result.emplace_back(d);
73 }
74 }
75
76 if (result.size() != image->GetTimeSteps()) mitkThrow() << "Cannot determine offset. Selected input has an property \"" << CEST_PROPERTY_NAME_OFFSETS() << "\" that don't match the number of time steps of input.";
77
78 }
79 else mitkThrow() << "Cannot determine frequency. Selected input has no property \"" << CEST_PROPERTY_NAME_OFFSETS() << "\"";
80
81 return result;
82}

Callers

nothing calls this directly

Calls 5

IsNotNullMethod · 0.80
GetTimeStepsMethod · 0.80
GetPropertyMethod · 0.45
GetValueAsStringMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected