22 if( !this->ReadDiffusionHeader( filename ) )
24 MITK_ERROR <<
"Using MOSAIC Reader for non-mosaic files ";
27 gdcm::Reader gdcmReader;
28 gdcmReader.SetFileName( filename.c_str() );
31 const gdcm::DataSet& dataset = gdcmReader.GetFile().GetDataSet();
35 std::string spacing_between_slices;
36 if(
RevealBinaryTag( gdcm::Tag(0x0018, 0x0088 ), dataset, spacing_between_slices ) )
38 std::istringstream ifs_spacing(spacing_between_slices );
39 ifs_spacing >> this->m_MosaicDescriptor.spacing[2];
43 std::string inplace_spacing;
44 if(
RevealBinaryTag( gdcm::Tag(0x0028, 0x0030 ), dataset, inplace_spacing ) )
46 std::stringstream iplss( inplace_spacing );
49 while( std::getline( iplss, buffer,
'\\' ) )
51 std::istringstream substream(buffer);
52 substream >> this->m_MosaicDescriptor.spacing[idx++];
57 std::string position_patient;
58 if(
RevealBinaryTag( gdcm::Tag( 0x0028, 0x0032), dataset, position_patient) )
60 std::stringstream ppass( inplace_spacing );
63 while( std::getline( ppass, buffer,
'\\' ) )
65 std::istringstream substream(buffer);
66 substream >> this->m_MosaicDescriptor.origin[idx++];
75 gdcm::Reader gdcmReader;
76 gdcmReader.SetFileName( filename.c_str() );
82 const gdcm::DataSet& dataset = gdcmReader.GetFile().GetDataSet();
84 const gdcm::Tag t_sie_diffusion( 0x0029,0x1010 );
85 const gdcm::Tag t_sie_diffusion_alt( 0x0029,0x1110 );
86 std::string siemens_diffusionheader_str;
88 if(
RevealBinaryTag( t_sie_diffusion, dataset, siemens_diffusionheader_str )
89 ||
RevealBinaryTag( t_sie_diffusion_alt, dataset, siemens_diffusionheader_str) )
93 if( !this->ExtractSiemensDiffusionTagInformation( siemens_diffusionheader_str, header_values ))
99 std::string::size_type tag_position = siemens_diffusionheader_str.find(
"NumberOfImagesInMosaic", 0 );
100 if( tag_position != std::string::npos )
102 std::vector<double> value_array;
103 ParseInputString( siemens_diffusionheader_str.substr( tag_position, siemens_diffusionheader_str.size() - tag_position + 1 ),
108 header_values.
n_images = value_array[0];
109 this->m_MosaicDescriptor.nimages = value_array[0];
112 tag_position = siemens_diffusionheader_str.find(
"SliceNormalVector", 0);
113 if( tag_position != std::string::npos )
115 std::vector<double> value_array;
116 ParseInputString( siemens_diffusionheader_str.substr( tag_position, siemens_diffusionheader_str.size() - tag_position + 1 ),
122 for(
unsigned int i=0; i<value_array.size(); i++)
127 if( value_array.size() > 2 )
130 this->m_MosaicDescriptor.slicenormalup = ( value_array[2] > 0);
137 m_HeaderInformationList.push_back( header_values );
141 return (m_HeaderInformationList.size() > 0);
bool ParseInputString(std::string input, std::vector< double > &values, Siemens_Header_Format format_specs)
bool RevealBinaryTag(const gdcm::Tag tag, const gdcm::DataSet &dataset, std::string &target)
Retrieve the value of a gdcm tag to the given string.
SiemensDiffusionHeaderType
static const std::string filename
SiemensDiffusionHeaderType GetHeaderType(std::string header)