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

Method ExtractCESTT1Time

Modules/CEST/src/mitkExtractCESTOffset.cpp:20–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19
20std::vector<mitk::ScalarType> mitk::ExtractCESTT1Time(const BaseData* image)
21{
22 std::vector<ScalarType> result;
23
24 auto prop = image->GetProperty(CEST_PROPERTY_NAME_TREC().c_str());
25 if (prop.IsNotNull())
26 {
27 auto valueStr = prop->GetValueAsString();
28
29 std::istringstream iss;
30 iss.imbue(std::locale("C"));
31 iss.str(valueStr);
32 double d;
33
34 while (iss >> d)
35 {
36 if (!iss.fail())
37 {
38 result.emplace_back(d);
39 }
40 }
41
42 if (result.size() != image->GetTimeSteps()) mitkThrow() << "Cannot determine T1 times. Selected input has an property \"" << CEST_PROPERTY_NAME_TREC() << "\" that don't match the number of time steps of input.";
43
44 for (auto& value : result)
45 {
46 value *= 0.001;
47 }
48 }
49 else mitkThrow() << "Cannot determine T1 time grid (TREC). Selected input has no property \"" << CEST_PROPERTY_NAME_TREC() << "\"";
50
51 return result;
52}
53
54std::vector<mitk::ScalarType> mitk::ExtractCESTOffset(const BaseData* image)
55{

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