From 5ecfbf82eea9a965a11ae9f47377ad900b7253b7 Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Wed, 25 Mar 2009 16:28:29 +0000 Subject: [PATCH] BUG Files Directory --- .../exampleGetXCoherentInfoGdcmReader.bbs | 2 - .../bbgdcmvtkGetXCoherentInfoGdcmReader.cxx | 45 +++++-------------- .../src/bbgdcmvtkGetXCoherentInfoGdcmReader.h | 2 - packages/std/src/bbstdFilesFromDirectory.cxx | 7 ++- 4 files changed, 15 insertions(+), 41 deletions(-) diff --git a/packages/gdcmvtk/bbs/appli/exampleGetXCoherentInfoGdcmReader.bbs b/packages/gdcmvtk/bbs/appli/exampleGetXCoherentInfoGdcmReader.bbs index 4c312bf..d98ba90 100644 --- a/packages/gdcmvtk/bbs/appli/exampleGetXCoherentInfoGdcmReader.bbs +++ b/packages/gdcmvtk/bbs/appli/exampleGetXCoherentInfoGdcmReader.bbs @@ -38,7 +38,5 @@ print $reader.IPP$ print PixelSpacing print $reader.PixelSpacing$ -print InterSlice -print $reader.InterSlice$ diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx index 21fcdcf..93437d0 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx +++ b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx @@ -40,13 +40,6 @@ void GetXCoherentInfoGdcmReader::Process() v_ipp.push_back(ipp[i]); bbSetOutputIPP(v_ipp ); - std::vector v_pixelspacing; - v_pixelspacing.push_back(f->GetXSpacing()); - v_pixelspacing.push_back(f->GetYSpacing()); - if (f->GetZSize() != 1) { - v_pixelspacing.push_back(f->GetZSpacing()); - } - bbSetOutputPixelSpacing(v_pixelspacing); // Add all the files to the SerieHelper sh = GDCM_NAME_SPACE::SerieHelper::New(); @@ -61,27 +54,6 @@ void GetXCoherentInfoGdcmReader::Process() GDCM_NAME_SPACE::FileList::const_iterator it; GDCM_NAME_SPACE::FileList *l; - // ==================== Just to see ============================== - - std::cout << std::endl << " ---------------------------------------- Recap" - << std::endl; - l = sh->GetFirstSingleSerieUIDFileSet(); - while (l) - { - it = l->begin(); - std::cout << "SerieUID [" << (*it)->GetEntryString(0x0020,0x000e) <<"] Serie Description [" - << (*it)->GetEntryString(0x0008,0x103e) << "] " - << " : " << l->size() << " files" << std::endl; - l = sh->GetNextSingleSerieUIDFileSet(); - } - std::cout << " ----------------------------------------End Recap" - << std::endl << std::endl; - - if(l->size() > 1) - std::cout << " --------------------------- More than ONE Serie UID ?!?" - << std::endl << std::endl; - // ============================================================ - // Should only contain one! l = sh->GetFirstSingleSerieUIDFileSet(); @@ -91,11 +63,16 @@ void GetXCoherentInfoGdcmReader::Process() sh->OrderFileList(l); zspacing = sh->GetZSpacing(); - std::cout << "GetZSpacing() of sorted SingleSerieUIDFileSet " - << "from GDCM_NAME_SPACE::SerieHelper: " << zspacing << std::endl; - std::cout << " ('-1' means all the files have the same position)" << std::endl; - - bbSetOutputInterSlice(zspacing); + std::vector v_pixelspacing; + v_pixelspacing.push_back( f->GetXSpacing() ); + v_pixelspacing.push_back( f->GetYSpacing() ); + v_pixelspacing.push_back( zspacing ); +// if (f->GetZSize() != 1) { +// v_pixelspacing.push_back(f->GetZSpacing()); +// } + bbSetOutputPixelSpacing(v_pixelspacing); + + reader = vtkGdcmReader::New(); @@ -104,8 +81,6 @@ void GetXCoherentInfoGdcmReader::Process() reader->Update(); reader->GetOutput(); - vtkIndent indent ; - reader->GetOutput()->PrintSelf(std::cout, indent); bbSetOutputOut( reader->GetOutput() ); } diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h index 858a490..97064cd 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h +++ b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h @@ -33,7 +33,6 @@ virtual void bbUserDestructor(); BBTK_DECLARE_OUTPUT(IPP, std::vector); BBTK_DECLARE_OUTPUT(IOP, std::vector); BBTK_DECLARE_OUTPUT(PixelSpacing, std::vector); - BBTK_DECLARE_OUTPUT(InterSlice, double); BBTK_PROCESS(Process); void Process(); @@ -58,7 +57,6 @@ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out, "Output image", BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP, "Image Position (Patient)", std::vector,""); BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IOP, "Image Orientation (Patient)", std::vector,""); BBTK_OUTPUT(GetXCoherentInfoGdcmReader,PixelSpacing,"Pixel Spacing", std::vector,""); -BBTK_OUTPUT(GetXCoherentInfoGdcmReader,InterSlice, "InterSlice", double,""); BBTK_END_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader); } // EO namespace bbgdcmvtk diff --git a/packages/std/src/bbstdFilesFromDirectory.cxx b/packages/std/src/bbstdFilesFromDirectory.cxx index 6069623..e91ef23 100644 --- a/packages/std/src/bbstdFilesFromDirectory.cxx +++ b/packages/std/src/bbstdFilesFromDirectory.cxx @@ -145,8 +145,11 @@ int FilesFromDirectory::Explore(std::string const &dirpath, bool recursive) } if ( S_ISREG(buf.st_mode) ) //is it a regular file? { - Filenames.push_back( fileName ); - numberOfFiles++; + if ( d->d_name[0]!='.') + { + Filenames.push_back( fileName ); + numberOfFiles++; + } } else if ( S_ISDIR(buf.st_mode) ) //directory? { -- 2.45.0