30 #include <vtkGdcmReader.h>
32 #include "boost/filesystem/path.hpp"
35 #include <vtkStringArray.h>
66 GDCM_NAME_SPACE::Document*doc;
67 GDCM_NAME_SPACE::File* file = GDCM_NAME_SPACE::File::New();
68 file->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
69 file->SetFileName(filename.c_str());
71 bool ok = file->IsReadable();
74 doc = (GDCM_NAME_SPACE::Document*)file;
75 ok = doc->IsReadable();
88 mReader->SetFileName(filename.c_str());
90 im = vtkImageData::New();
91 im->ShallowCopy(
mReader->GetOutput());
95 if (im!=0) im->Delete();
114 if (str ==
"GDCM::Unfound")
118 if (str[str.size()-1]==
' ')
120 return irclean(str.substr(0,str.size()-1));
122 if (str[str.size()-1]==0)
124 return irclean(str.substr(0,str.size()-1));
132 std::map <std::string , std::string> &infos, std::vector<std::string> i_attr)
134 std::vector<std::string>::iterator it = i_attr.begin();
135 for(; it != i_attr.end(); it++)
143 std::map<std::string,std::string>& attr)
146 <<filename<<
"'"<<std::endl);
148 GDCM_NAME_SPACE::File* file = GDCM_NAME_SPACE::File::New();
151 GDCM_NAME_SPACE::Document *doc= GDCM_NAME_SPACE::File::New();
152 doc->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
153 doc->SetFileName(filename.c_str());
155 file->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
156 file->SetFileName(filename.c_str());
158 if (file->IsReadable())
160 std::map<std::string,std::string>::iterator i;
161 for (i=attr.begin();i!=attr.end();++i)
163 if ( i->first ==
"D0004_1500" )
165 boost::filesystem::path full_path(filename);
166 std::string f = full_path.leaf().string();
169 else if ( i->first ==
"FullFileName" )
171 i->second = filename;
173 else if ( i->first ==
"FullFileDirectory" )
175 std::string::size_type last_pos = filename.find_last_of(
"//");
177 i->second = filename.substr(0, last_pos);
185 if ( ( gr!=0 ) && ( el!=0 ) )
187 std::string val = file->GetEntryString(gr,el);