]> Creatis software - bbtk.git/commitdiff
mhdb
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 29 Oct 2020 09:22:40 +0000 (10:22 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 29 Oct 2020 09:22:40 +0000 (10:22 +0100)
packages/vtk/src/bbvtkMetaImageWriter.cxx

index 3be47432b7c204995300c353bdaa25ac4a03bef1..140e6bb51dbfe76f0aeeb2f8df54cb4316f106e8 100644 (file)
@@ -28,13 +28,8 @@ void MetaImageWriter::Save_mhdb( std::string filename  , vtkImageData* img ,int
        int bsx=ceil((double)dim[0]/(double)sizeB);
        int bsy=ceil((double)dim[1]/(double)sizeB);
        int bsz=ceil((double)dim[2]/(double)sizeB);
-       
-       printf("EED MetaImageWriter::Save_mhdb  bsx bsy bsz  = %d %d %d\n", bsx,bsy,bsz);       
-       printf("EED MetaImageWriter::Save_mhdb  dim          = %d %d %d\n", dim[0],dim[1],dim[2]  );
-       
        int voi[6];
-       std::string filenameBlock;
-       
+       std::string filenameBlock;      
        for (i=0;i<bsx;i++)
        {
                for (j=0;j<bsy;j++)
@@ -47,42 +42,28 @@ void MetaImageWriter::Save_mhdb( std::string filename  , vtkImageData* img ,int
                                voi[3]=voi[2]+(sizeB-1);
                                voi[4]=k*sizeB;
                                voi[5]=voi[4]+(sizeB-1);
-
-/*
-                               voi[0]=0;
-                               voi[1]=10;
-                               voi[2]=0;
-                               voi[3]=10;
-                               voi[4]=0;
-                               voi[5]=10;
-       */              
                                if (voi[1]>=dim[0]) { voi[1]=dim[0]-1; } 
                                if (voi[3]>=dim[1]) { voi[3]=dim[1]-1; } 
                                if (voi[5]>=dim[2]) { voi[5]=dim[2]-1; } 
-                               
                                vtkExtractVOI *extract = vtkExtractVOI::New();
                                extract->SetInputData( img );
                                extract->SetVOI(voi);   
                                extract->UpdateWholeExtent();
                                extract->Modified();
                                extract->Update();
-
                                vtkMetaImageWriter* w = vtkMetaImageWriter::New();
                                w->SetInputData( extract->GetOutput() );
                                w->SetCompression(true);  
                                w->SetFileDimensionality(bbGetInputIn()->GetDataDimension());   // NTU
                                filenameBlock=filename+"/a-"+ std::to_string(i)+"-"+ std::to_string(j)+"-"+ std::to_string(k)+".mhd";
-printf("EED MetaImageWriter::Save_mhdb  name  = %s \n", filenameBlock.c_str() );       
+// printf("EED MetaImageWriter::Save_mhdb  name  = %s \n", filenameBlock.c_str() );    
                                w->SetFileName( filenameBlock.c_str() );  
-//                             w->Write();
-                               
+                               w->Write();
                                w->Delete();
                                extract->Delete();
                        } // for k
                } // for j
        } // for i
-       
-               
 }
 
 
@@ -118,9 +99,9 @@ void MetaImageWriter::Process()
        {
                if (userGivenName.substr(userGivenName.size()-5) == ".mhdb")  
                { 
-                       printf("EED vtkMetaImageWriter process  block..ups\n");
+                       printf("EED vtkMetaImageWriter::Process  block..ups\n");
                        
-                       Save_mhdb( userGivenName , bbGetInputIn() , 20 );
+                       Save_mhdb( userGivenName , bbGetInputIn() , 40 );
                        
                } else {
                                if (userGivenName.substr(userGivenName.size()-4) != ".mhd")  //JPR
@@ -143,7 +124,7 @@ void MetaImageWriter::Process()
                } // .mhdb
        } // bbGetInputIn()!=NULL
 
-  
+printf("EED vtkMetaImageWriter::Process  END\n");  
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)