]> Creatis software - bbtk.git/blobdiff - packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx
category
[bbtk.git] / packages / gdcmvtk / src / bbgdcmvtkGetInfoGdcmReader.cxx
index 75b96f071237093ccdf1d91a3e1dd01256e0ebc1..2e0a07ecaab11a88fb017e2284c12cb8d8ee2e66 100644 (file)
@@ -14,25 +14,24 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(gdcmvtk,GetInfoGdcmReader)
 BBTK_BLACK_BOX_IMPLEMENTATION(GetInfoGdcmReader,bbtk::AtomicBlackBox);
 void GetInfoGdcmReader::Process()
 {
-std::cout << "Entree ds GetInfoGdcmReader::Process()" << std::endl;
-    
+       // Reset de reader, f
+       bbUserFinalizeProcessing();
+       
    f = GDCM_NAME_SPACE::File::New();
    f->SetFileName( bbGetInputIn() );
    bool res = f->Load();  
    if ( !res )
    {
-std::cout << " f->Load() failed ..." << std::endl;
-      
       f->Delete();
       bbSetOutputOut(0);
       return;
    }
-std::cout << "apres f->Load()" << std::endl;
-
+ // Get info from THE image file (only *one* as input)
    int i;
    std::vector<double> v_iop;
    float iop[6];
    f->GetImageOrientationPatient(iop);
+   
    for(i=0; i< 6; i++)
       v_iop.push_back(iop[i]);
    bbSetOutputIOP(v_iop );
@@ -40,6 +39,7 @@ std::cout << "apres f->Load()" << std::endl;
    std::vector<double> v_ipp;
    float ipp[3];
    f->GetImagePositionPatient(ipp);
+   
    for(i=0; i< 3; i++)
       v_ipp.push_back(ipp[i]);
    bbSetOutputIPP(v_ipp );
@@ -47,7 +47,9 @@ std::cout << "apres f->Load()" << std::endl;
    std::vector<double> v_pixelspacing;
    v_pixelspacing.push_back(f->GetXSpacing());
    v_pixelspacing.push_back(f->GetYSpacing());
-   if (f->GetZSize() != 1) {
+   
+   if (f->GetZSize() != 1) 
+   {
       v_pixelspacing.push_back(f->GetZSpacing());
    }
    bbSetOutputPixelSpacing(v_pixelspacing);
@@ -65,22 +67,31 @@ std::cout << "apres f->Load()" << std::endl;
    bbSetOutputOut( reader->GetOutput() );
 }
 
-void GetInfoGdcmReader::bbUserConstructor()
+void GetInfoGdcmReader::bbUserSetDefaultValues()
 {
-std::cout << "entree ds GetInfoGdcmReader::bbUserConstructor()" << std::endl;
-    bbSetInputIn("");  
+   reader=NULL;
+   f=NULL;
+   bbSetInputIn("");  
 }
 
-void GetInfoGdcmReader::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
+void GetInfoGdcmReader::bbUserInitializeProcessing()
 {
-  
 }
-void GetInfoGdcmReader::bbUserDestructor()
+       
+       
+       
+void GetInfoGdcmReader::bbUserFinalizeProcessing()
 {
-   if(reader)
+   if( reader )
+   {
       reader->Delete();
+      reader=NULL;
+   }
    if(f)
+   {
       f->Delete();
+      f=NULL;
+   }   
 }
 
 }