Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDiffusionHeaderSiemensDICOMFileHelper.cpp
Go to the documentation of this file.
2 
3 #include <cstdlib>
4 #include <cmath>
5 
7 {
8  // The CSA2 format begins with the string ‘SV10’, the CSA1 format does not.
9  if( header.find("SV10") != std::string::npos )
10  {
11  return mitk::SIEMENS_CSA2;
12  }
13  else
14  {
15  return mitk::SIEMENS_CSA1;
16  }
17 }
18 
19 bool mitk::ParseInputString( std::string input, std::vector<double>& values, Siemens_Header_Format format_specs )
20 {
21  // TODO : Compute offset based on the format_specs, where does the 84 come from???
22  int offset = 84;
23  int vm = *(input.c_str() + format_specs.NameLength );
24 
25  for (int k = 0; k < vm; k++)
26  {
27  int itemLength = *(input.c_str() + offset + 4);
28 
29  int strideSize = static_cast<int> (ceil(static_cast<double>(itemLength)/4) * 4);
30  std::string valueString = input.substr( offset+16, itemLength );
31 
32  double value = atof( valueString.c_str() );
33  values.push_back( value );
34 
35  offset += 16+strideSize;
36  }
37 
38  // If there are no values it is invalid
39  return (values.size() > 0 );
40 }
41 
42 
bool ParseInputString(std::string input, std::vector< double > &values, Siemens_Header_Format format_specs)
static Vector3D offset
SiemensDiffusionHeaderType GetHeaderType(std::string header)