]> Creatis software - creaImageIO.git/blobdiff - src/creaImageIOWxGimmick.cpp
*** empty log message ***
[creaImageIO.git] / src / creaImageIOWxGimmick.cpp
index 2bcc3ab50c53bc08f25fcdfd1ebbae703b725365..57cf94f1f0ac707a8e0a3cce968615840b61a472 100644 (file)
@@ -859,6 +859,9 @@ namespace creaImageIO
        boost::filesystem::change_extension(filepath,GetDatabaseExtension());
        if ( boost::filesystem::exists(filepath) )
          {
+                 boost::filesystem::remove(filepath);  
+                         /* 
+                         LG : works on Linux but not Windows :
            if ( ! boost::filesystem::remove(filepath) )
              {
                wxMessageBox(_T("Could not overwrite ")
@@ -866,8 +869,10 @@ namespace creaImageIO
                             _T("Error"),
                             wxOK,this);
                return;
+               
        
              }
+                 */
          }
       }
     
@@ -1844,7 +1849,7 @@ namespace creaImageIO
            return false;
          }
       }
-    std::cout << "Selecting : "<<node->ImageGetFullFileName() << std::endl;
+    //    std::cout << "Selecting : "<<node->ImageGetFullFileName() << std::endl;
     return true;
   }
   //================================================================
@@ -2237,14 +2242,18 @@ namespace creaImageIO
          {     
            // n2D to 3D
            vtkImageData* out = vtkImageData::New();
-           out->CopyStructure(first);
+           out->CopyStructure(first);  
+           out->SetScalarType(first->GetScalarType());
            int ext[6];
            first->GetExtent(ext);
            ext[5] = im.size();
            out->SetExtent(ext);
+           // LG : TODO : Z Spacing  ?
            
            out->AllocateScalars();
-           out->Print(std::cout);
+           
+           //first->Print(std::cout);
+           //      out->Print(std::cout);
            
            int dim[3];
            first->GetDimensions(dim);
@@ -2252,17 +2261,36 @@ namespace creaImageIO
              ( (unsigned long)first->GetScalarPointer(0,1,0)
                - (unsigned long)first->GetScalarPointer(0,0,0))
              *dim[1];
-           std::cout << "imsize="<<imsize<<std::endl;
 
            int slice = 0;
            std::vector<DicomNode*>::iterator it;
            for (it=im.begin(); it!=im.end(); ++it) 
              {
+               //std::cout << "copying slice "<<slice <<std::endl;
                vtkImageData* cur = mReader.GetImage( (*it)->ImageGetFullFileName() );
                
                void* src = cur->GetScalarPointer(0,0,0);
                void* dst = out->GetScalarPointer(0,0,slice);
+               //              std::cout << "src="<<src<<std::endl;
+               //              std::cout << "dst="<<dst<<std::endl;
+               //              std::cout << "siz="<<imsize<<std::endl;
                memcpy(dst,src,imsize);
+
+               /*
+               // verif
+               int ii,jj;
+               for (ii=1;ii<4;ii++) {
+                 for (jj=1;jj<4;jj++) {
+                   int x = (int)(ii*dim[0] / 4);
+                   int y = (int)(jj*dim[1] / 4);
+                   std::cout << cur->GetScalarComponentAsFloat(x,y,0,0)
+                             << " vs "
+                             << out->GetScalarComponentAsFloat(x,y,slice,0)
+                             << std::endl;
+                 }
+               }
+               */
+
                slice++;
              }
            f.push_back(out);