#include <creaImageIOSystem.h>
#include "boost/filesystem/path.hpp"
-namespace creaImageIO
-{
-
+namespace creaImageIO{
//=====================================================================
VtkImageReader::VtkImageReader(vtkImageReader2* r,
const std::string& name,
{
if (name.size() == 0)
{
- SetName ( mReader->GetDescriptiveName() );
+ const char *test =mReader->GetDescriptiveName();
+ if(test != "")
+ {
+ SetName ( "toto");// mReader->GetDescriptiveName());
+ }
+
}
else
{
//=====================================================================
VtkImageReader::~VtkImageReader()
{
- GimmickDebugMessage(5,"Destructing vtkImageReader : "<<GetName()
- <<std::endl);
+
mReader->Delete();
}
//=====================================================================
//=====================================================================
bool VtkImageReader::CanRead(const std::string& filename)
{
- // std::cout << "## Reader "<<GetName()
- //<<" ::CanRead("<<filename<<")"
- // <<std::endl;
+
return (mReader->CanReadFile(filename.c_str())!=0);
+/* if(filename != "")
+ {
+ return (mReader->CanReadFile(filename.c_str())!=0);
+ }
+ else
+ {
+ return false;
+ }*/
}
//=====================================================================
//=====================================================================
vtkImageData* VtkImageReader::ReadImage(const std::string& filename)
{
- // std::cout << "## Reader "<<GetName()
- //<<" ::Read("<<filename<<")"
- // <<std::endl;
vtkImageData* im = 0;
try
{
void VtkImageReader::ReadAttributes(const std::string& filename,
std::map<std::string,std::string>& attr)
{
- // std::cout << "VtkImageReader::ReadDicomInfo '"<<filename<<"'"<<std::endl;
GimmickMessage(2,"Reading attributes from '"<<filename<<std::endl);
// Get image dimensions
// How to get the image info without loading it in vtk ?
// Planes
char planes[128];
sprintf(planes,"%i",ext[5]-ext[4]);
-
-
- //
- std::map<std::string,std::string>::iterator i;
+
+ std::map<std::string,std::string>::iterator i;
if ( (i = attr.find("FullFileName")) != attr.end())
{
- // boost::filesystem::path full_path(filename);
- // std::string f = full_path.leaf();
i->second = filename;
}
if ( (i = attr.find("D0004_1500")) != attr.end())
if ( (i = attr.find("D0028_0012")) != attr.end())
{
- i->second = planes;
+ i->second = planes;
}
-
+ if ( (i = attr.find("FullFileDirectory")) != attr.end())
+ {
+ std::string::size_type last_pos = filename.find_last_of("//");
+ i->second = filename.substr(0, last_pos);
+ }
+
GimmickMessage(2,"Attributes map:"<<std::endl<<attr<<std::endl);
}
//=====================================================================