#include <creaImageIODicomImageReader.h>
-#include <gdcmFile.h>
+
#include <vtkGdcmReader.h>
#include <creaImageIOSystem.h>
#include "boost/filesystem/path.hpp"
#include <creaImageIOTreeAttributeDescriptor.h>
#include <vtkStringArray.h>
+#include <creaImageIOGimmick.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
}
if (str[str.size()-1]==' ')
{
- return str.substr(0,str.size()-1);
+ return irclean(str.substr(0,str.size()-1));
}
if (str[str.size()-1]==0)
{
- return str.substr(0,str.size()-1);
+ return irclean(str.substr(0,str.size()-1));
}
}
return str;
}
//========================================================================
-
+
//=====================================================================
void DicomImageReader::ReadAttributes(const std::string& filename,
std::map<std::string,std::string>& attr)
GimmickMessage(2,"Reading attributes from DICOM file '"
<<filename<<"'"<<std::endl);
- GDCM_NAME_SPACE::File* file = GDCM_NAME_SPACE::File::New();
+ //GDCM_NAME_SPACE::File* file = GDCM_NAME_SPACE::File::New();
+ boost::shared_ptr<GDCM_NAME_SPACE::File> file(GDCM_NAME_SPACE::File::New(), DicomImageReader::deleter());
GDCM_NAME_SPACE::Document *doc= GDCM_NAME_SPACE::File::New();
doc->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
file->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
file->SetFileName(filename.c_str());
file->Load();
- if (file->IsReadable() ||((GDCM_NAME_SPACE::Document*) file)->IsReadable())
+ if (file->IsReadable())// ||((GDCM_NAME_SPACE::Document*) file)->IsReadable())
{
std::map<std::string,std::string>::iterator i;
for (i=attr.begin();i!=attr.end();++i)
}
else
{
- uint16_t gr;
uint16_t el;
+ uint16_t gr;
+
tree::AttributeDescriptor::GetDicomGroupElementFromKey(i->first,gr,el);
if ( ( gr!=0 ) && ( el!=0 ) )
{
- std::string val = file->GetEntryString(gr,el);
+ std::string val = file->GetEntryString(gr,el);
i->second = irclean(val);
}
}
}
}
- file->Delete();
}
//=====================================================================