]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOVtkImageReader.cpp
Remove timestamp_database and timestamp files (now management only with maintenance_d...
[creaImageIO.git] / src2 / creaImageIOVtkImageReader.cpp
index 66f7059314a3096edb1c53ea91e77bf6afeb27ce..cd93e86f9a7c6ffa68042bb35d1f698d9c7b6ad0 100644 (file)
@@ -38,9 +38,6 @@ namespace creaImageIO
   //=====================================================================
   bool VtkImageReader::CanRead(const std::string& filename)
   { 
-    //      std::cout << "## Reader "<<GetName()
-    //<<" ::CanRead("<<filename<<")"
-    //         <<std::endl;
     return (mReader->CanReadFile(filename.c_str())!=0);
   }
   //=====================================================================
@@ -48,9 +45,6 @@ namespace creaImageIO
   //=====================================================================
   vtkImageData* VtkImageReader::ReadImage(const std::string& filename)
   {
-    //      std::cout << "## Reader "<<GetName()
-    //<<" ::Read("<<filename<<")"
-    //         <<std::endl;
     vtkImageData* im = 0;
     try
       {
@@ -108,7 +102,6 @@ namespace creaImageIO
   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 ?
@@ -125,14 +118,10 @@ namespace creaImageIO
     // 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())
@@ -152,9 +141,14 @@ namespace creaImageIO
     
     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);
   }
   //=====================================================================