]> Creatis software - bbtk.git/commitdiff
#3326 BBTK Feature New Normal - gdcm vtk GetXCoherentInfoGdcmReader box option...
authorEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Fri, 13 Dec 2019 11:57:59 +0000 (12:57 +0100)
committerEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Fri, 13 Dec 2019 11:57:59 +0000 (12:57 +0100)
packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx
packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h

index aeb0f78bb96f59bf817db55de93a24f7530c4f42..2bbf54205c3d2cb9b3e58a091ea1a840de45d107 100644 (file)
@@ -87,7 +87,6 @@ vtkImageData* GetXCoherentInfoGdcmReader::CreateDefaultImage()
 #if defined USE_GDCM
 void GetXCoherentInfoGdcmReader::Process()
 {
-printf("EED GetXCoherentInfoGdcmReader::Process Start\n");
  // Read the *first* image file (a SET of file names is given as input) 
    f = GDCM_NAME_SPACE::File::New();
 
@@ -97,7 +96,6 @@ printf("EED GetXCoherentInfoGdcmReader::Process Start\n");
        } else {
                f->SetFileName( "" );
        } // if
-printf("EED GetXCoherentInfoGdcmReader::Process 1\n");
 
    bool res = f->Load();  
    if ( !res )
@@ -108,7 +106,6 @@ printf("EED GetXCoherentInfoGdcmReader::Process 1\n");
        return;
    } // if res
 
-try {
  // Get info from the first image file
    int i;
    std::vector<double> v_iop;
@@ -120,7 +117,6 @@ try {
       v_iop.push_back(iop[i]);
        } // for i
    bbSetOutputIOP(v_iop );
-printf("EED GetXCoherentInfoGdcmReader::Process 2\n");
  
    std::vector<double> v_ipp;
    float ipp[3];
@@ -136,8 +132,6 @@ printf("EED GetXCoherentInfoGdcmReader::Process 2\n");
    sh = GDCM_NAME_SPACE::SerieHelper::New();
    std::vector<std::string> gii = bbGetInputIn();
 
-printf("EED GetXCoherentInfoGdcmReader::Process 3\n");
-   
    for(std::vector<std::string>::iterator it = gii.begin();
                                           it != gii.end();
                                         ++it)
@@ -148,17 +142,13 @@ printf("EED GetXCoherentInfoGdcmReader::Process 3\n");
    GDCM_NAME_SPACE::FileList::const_iterator it;
    GDCM_NAME_SPACE::FileList *l;
 
-printf("EED GetXCoherentInfoGdcmReader::Process 4\n");
    // Should only contain one!
    l = sh->GetFirstSingleSerieUIDFileSet();
-printf("EED GetXCoherentInfoGdcmReader::Process 5\n");
 
        if (l==NULL)
        {       
-               printf("EED GetXCoherentInfoGdcmReader::Process Warnning (1) not coherent list/file \n");
                return;
        }
-printf("EED GetXCoherentInfoGdcmReader::Process 6\n");
 
    double zspacing = 0.;
    sh->OrderFileList(l); // this one should compute the *actual* Z Spacing!
@@ -200,24 +190,22 @@ printf("EED GetXCoherentInfoGdcmReader::Process 6\n");
    } // for iitt
    bbSetOutputDicomInfo( vectormapinfodicom );
 
-   if (reader!=NULL)
-   { 
-      reader->Delete();
-      reader = NULL;
-   }
-   reader = vtkGdcmReader::New();
-       //EED 21 mars 2012  FLIP probleme  ..PLOP..
-       reader->SetFlipY(false);
-   //reader->SetFileName( bbGetInputIn().c_str() );
-   reader->SetCoherentFileList(l);
-   reader->Update();
-   reader->GetOutput();
-   bbSetOutputOut( reader->GetOutput() );
-} catch (...) {
-               printf("EED GetXCoherentInfoGdcmReader::Process Warnning (2) not coherent list/file \n");
-               return;
-} // try
-
+       if (bbGetInputReadRaw()==true)
+       {
+          if (reader!=NULL)
+          { 
+                 reader->Delete();
+                 reader = NULL;
+          }
+          reader = vtkGdcmReader::New();
+               //EED 21 mars 2012  FLIP probleme  ..PLOP..
+               reader->SetFlipY(false);
+          //reader->SetFileName( bbGetInputIn().c_str() );
+          reader->SetCoherentFileList(l);
+          reader->Update();
+          reader->GetOutput();
+          bbSetOutputOut( reader->GetOutput() );
+       } // if bGetInputReadRaw
 }
 #endif
 // endif USE_GDCM
@@ -308,6 +296,7 @@ void GetXCoherentInfoGdcmReader::bbUserSetDefaultValues()
    std::vector<std::string> init;
    init.push_back("");
    bbSetInputIn(init);  
+   bbSetInputReadRaw(true);  
    //reader=NULL;   /// \TODO fixme JPR
 }
 
index f0b3c2134f78e455b5feaa81c6b2dfc5d73a2547..41c2ea756824024f8b2690bb4c45777b33475353 100644 (file)
@@ -60,6 +60,7 @@ class bbgdcmvtk_EXPORT GetXCoherentInfoGdcmReader
   BBTK_DECLARE_INPUT(In                                , std::vector<std::string>);
   BBTK_DECLARE_INPUT(IPPSort           , bool);
   BBTK_DECLARE_INPUT(DicomTags         , std::vector<std::string>);
+  BBTK_DECLARE_INPUT(ReadRaw           , bool);
   
   BBTK_DECLARE_OUTPUT(Out                      , vtkImageData *);
   BBTK_DECLARE_OUTPUT(IPP                      , std::vector<double>);
@@ -96,6 +97,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
   BBTK_INPUT(GetXCoherentInfoGdcmReader,In                             ,"List of Dicom image file names", std::vector<std::string>,"");
   BBTK_INPUT(GetXCoherentInfoGdcmReader,IPPSort                        ,"Sort on Image Position Patient", bool,"");
   BBTK_INPUT(GetXCoherentInfoGdcmReader,DicomTags              ,"Dicom Tags (vector of Dicom tags ex: D0028_0030  D0020_0037)", std::vector<std::string>,"");
+  BBTK_INPUT(GetXCoherentInfoGdcmReader,ReadRaw                ,"(default true) false: not read raw just dicom tags", bool,"");
 
   BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out                   ,"Output image"                                 , vtkImageData *,"");
   BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP                   ,"Image Position (Patient)"             , std::vector<double>,"");