X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fgdcmvtk%2Fsrc%2FbbgdcmvtkGetXCoherentInfoGdcmReader.cxx;h=092a2a834c1df10f6d009a4d8024c6adb66b0f16;hb=ae867ce6752785393a3f4b209f3f76c46f04470c;hp=93437d05ba9d780521c5ca3de4f26153abc7dd64;hpb=5ecfbf82eea9a965a11ae9f47377ad900b7253b7;p=bbtk.git diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx index 93437d0..092a2a8 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx +++ b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx @@ -14,7 +14,7 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(gdcmvtk,GetXCoherentInfoGdcmReader) BBTK_BLACK_BOX_IMPLEMENTATION(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox); void GetXCoherentInfoGdcmReader::Process() { - // Read the first image file + // Read the *first* image file (a SET of file names is given as input) f = GDCM_NAME_SPACE::File::New(); f->SetFileName( bbGetInputIn()[0] ); bool res = f->Load(); @@ -29,6 +29,7 @@ void GetXCoherentInfoGdcmReader::Process() std::vector v_iop; float iop[6]; f->GetImageOrientationPatient(iop); + for(i=0; i< 6; i++) v_iop.push_back(iop[i]); bbSetOutputIOP(v_iop ); @@ -36,14 +37,15 @@ void GetXCoherentInfoGdcmReader::Process() std::vector v_ipp; float ipp[3]; f->GetImagePositionPatient(ipp); + for(i=0; i< 3; i++) v_ipp.push_back(ipp[i]); bbSetOutputIPP(v_ipp ); - -// Add all the files to the SerieHelper +// Add *all the files* to the SerieHelper sh = GDCM_NAME_SPACE::SerieHelper::New(); std::vector gii = bbGetInputIn(); + for(std::vector::iterator it = gii.begin(); it != gii.end(); ++it) @@ -60,21 +62,22 @@ void GetXCoherentInfoGdcmReader::Process() int nbFiles; double zspacing = 0.; nbFiles = l->size() ; - sh->OrderFileList(l); + sh->OrderFileList(l); // this one should compute the *actual* Z Spacing! zspacing = sh->GetZSpacing(); - - 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); - - - - + 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); + + if (reader!=NULL) + { + reader->Delete(); + reader=NULL; + } reader = vtkGdcmReader::New(); //reader->SetFileName( bbGetInputIn().c_str() ); reader->SetCoherentFileList(l); @@ -84,19 +87,20 @@ void GetXCoherentInfoGdcmReader::Process() bbSetOutputOut( reader->GetOutput() ); } -void GetXCoherentInfoGdcmReader::bbUserConstructor() +void GetXCoherentInfoGdcmReader::bbUserSetDefaultValues() { - std::vector init; - init.push_back(""); - bbSetInputIn(init); + std::vector init; + init.push_back(""); + bbSetInputIn(init); + reader=NULL; } -void GetXCoherentInfoGdcmReader::bbUserCopyConstructor(bbtk::BlackBox::Pointer) +void GetXCoherentInfoGdcmReader::bbUserInitializeProcessing() { - + } -void GetXCoherentInfoGdcmReader::bbUserDestructor() +void GetXCoherentInfoGdcmReader::bbUserFinalizeProcessing() { if(reader) reader->Delete(); @@ -108,5 +112,3 @@ void GetXCoherentInfoGdcmReader::bbUserDestructor() } // EO namespace bbgdcmvtk - -