From 1f305cb33157b21a82c7d0a97170ce09e580db0c Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 6 Sep 2017 11:35:59 +0200 Subject: [PATCH] #3107 BBTK Bug New Normal - branch vtk7itk4 compilation with vtk7 --- .../src/bbgdcmvtkGetInfoGdcmReader.cxx | 15 +++++-- .../bbgdcmvtkGetXCoherentInfoGdcmReader.cxx | 40 +++++++++++++------ 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx b/packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx index 87012ec..a08b352 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx +++ b/packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx @@ -77,7 +77,9 @@ void GetInfoGdcmReader::Process() f->GetImagePositionPatient(ipp); for(i=0; i< 3; i++) + { v_ipp.push_back(ipp[i]); + } // for i bbSetOutputIPP(v_ipp ); std::vector v_pixelspacing; @@ -87,7 +89,7 @@ void GetInfoGdcmReader::Process() if (f->GetZSize() != 1) { v_pixelspacing.push_back(f->GetZSpacing()); - } + } // if size bbSetOutputPixelSpacing(v_pixelspacing); //double interslice; @@ -95,10 +97,11 @@ void GetInfoGdcmReader::Process() reader = vtkGdcmReader::New(); reader->SetFileName( bbGetInputIn().c_str() ); + reader->SetFlipY(true); reader->Update(); reader->GetOutput(); - vtkIndent indent ; +// vtkIndent indent ; // reader->GetOutput()->PrintSelf(std::cout, indent); bbSetOutputOut( reader->GetOutput() ); } @@ -131,8 +134,10 @@ void GetInfoGdcmReader::Process() deIop.GetValue().Print(ss); gdcm::Element iop; iop.Read( ss ); - for(i=0; i< 6; i++) + for(i=0; i< 6; i++) + { v_iop.push_back((float)(iop[i])); + } // for i bbSetOutputIOP(v_iop ); // Image Position (Patient) @@ -141,8 +146,10 @@ void GetInfoGdcmReader::Process() deIpp.GetValue().Print(ss); gdcm::Element ipp; ipp.Read( ss ); - for(i=0; i< 3; i++) + for(i=0; i< 3; i++) + { v_ipp.push_back((float)(ipp[i])); + } // for bbSetOutputIPP(v_ipp ); std::vector v_pixelspacing = gdcm::ImageHelper::GetSpacingValue(f); diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx index 751c683..c1d16ba 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx +++ b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx @@ -96,7 +96,7 @@ void GetXCoherentInfoGdcmReader::Process() f->SetFileName( bbGetInputIn()[0] ); } else { f->SetFileName( "" ); - } + } // if bool res = f->Load(); if ( !res ) @@ -105,7 +105,7 @@ void GetXCoherentInfoGdcmReader::Process() f->Delete(); bbSetOutputOut( CreateDefaultImage() ); return; - } + } // if res // Get info from the first image file int i; std::vector v_iop; @@ -113,7 +113,9 @@ void GetXCoherentInfoGdcmReader::Process() f->GetImageOrientationPatient(iop); for(i=0; i< 6; i++) + { v_iop.push_back(iop[i]); + } // for i bbSetOutputIOP(v_iop ); std::vector v_ipp; @@ -121,7 +123,9 @@ void GetXCoherentInfoGdcmReader::Process() f->GetImagePositionPatient(ipp); for(i=0; i< 3; i++) + { v_ipp.push_back(ipp[i]); + } // for i bbSetOutputIPP(v_ipp ); // Add *all the files* to the SerieHelper @@ -133,7 +137,7 @@ void GetXCoherentInfoGdcmReader::Process() ++it) { sh->AddFileName(*it); - } + } //for vector GDCM_NAME_SPACE::FileList::const_iterator it; @@ -143,10 +147,10 @@ void GetXCoherentInfoGdcmReader::Process() l = sh->GetFirstSingleSerieUIDFileSet(); int nbFiles; - double zspacing = 0.; - nbFiles = l->size() ; + double zspacing = 0.; + nbFiles = l->size() ; sh->OrderFileList(l); // this one should compute the *actual* Z Spacing! - zspacing = sh->GetZSpacing(); + zspacing = sh->GetZSpacing(); std::vector v_pixelspacing; v_pixelspacing.push_back( f->GetXSpacing() ); v_pixelspacing.push_back( f->GetYSpacing() ); @@ -155,21 +159,20 @@ void GetXCoherentInfoGdcmReader::Process() // v_pixelspacing.push_back(f->GetZSpacing()); // } bbSetOutputPixelSpacing(v_pixelspacing); - if (reader!=NULL) { reader->Delete(); - reader=NULL; + 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(); + +printf("EED GetXCoherentInfoGdcmReader::Process \n"); bbSetOutputOut( reader->GetOutput() ); } #endif @@ -202,7 +205,9 @@ void GetXCoherentInfoGdcmReader::Process() gdcm::Element iop; iop.Read( ss ); for(i=0; i< 6; i++) - v_iop.push_back((float)(iop[i])); + { + v_iop.push_back((float)(iop[i])); + } bbSetOutputIOP(v_iop ); std::vector v_ipp; @@ -210,7 +215,8 @@ void GetXCoherentInfoGdcmReader::Process() deIpp.GetValue().Print(ss); gdcm::Element ipp; ipp.Read( ss ); - for(i=0; i< 3; i++){ + for(i=0; i< 3; i++) + { v_ipp.push_back((float)(ipp[i])); } // for 3 bbSetOutputIPP(v_ipp ); @@ -272,11 +278,17 @@ void GetXCoherentInfoGdcmReader::bbUserInitializeProcessing() void GetXCoherentInfoGdcmReader::bbUserFinalizeProcessing() { if(reader) + { reader->Delete(); + } // if reader if(f) + { f->Delete(); + } // if f if(sh) + { sh->Delete(); + } // if sh } #endif @@ -284,7 +296,9 @@ void GetXCoherentInfoGdcmReader::bbUserFinalizeProcessing() void GetXCoherentInfoGdcmReader::bbUserFinalizeProcessing() { if(reader) + { reader->Delete(); + } } #endif -- 2.47.1