From: tbaudier Date: Tue, 7 Aug 2018 11:09:34 +0000 (+0200) Subject: Update to enable GDCMv3 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=24b75af373d802c068becdd941ba91db5e423254;p=clitk.git Update to enable GDCMv3 --- diff --git a/common/clitkDicomRTDoseIO.cxx b/common/clitkDicomRTDoseIO.cxx index 88e1289..72f711f 100644 --- a/common/clitkDicomRTDoseIO.cxx +++ b/common/clitkDicomRTDoseIO.cxx @@ -21,7 +21,7 @@ #include "clitkCommon.h" // itk include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // IMPLEMENTATION NOTE: // The following has been done without the use of vtkGDCMImageReader which directly // handle RTDOSE image. Another approach would have been to use gdcm::ImageReader @@ -56,7 +56,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() int rc; #endif -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 m_GdcmImageReader.SetFileName(m_FileName.c_str()); m_GdcmImageReader.Read(); gdcm::File* m_GdcmFile = &m_GdcmImageReader.GetFile(); @@ -68,7 +68,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* Modality -- better be RTSTRUCT */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::DataSet &ds = m_GdcmFile->GetDataSet(); gdcm::Attribute<0x8,0x60> at1; @@ -82,7 +82,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() } /* ImagePositionPatient */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x20,0x32> at2; at2.SetFromDataSet(ds); ipp[0] = at2.GetValue(0); @@ -97,7 +97,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* Rows */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x28,0x10> at3; at3.SetFromDataSet(ds); dim[1] = at3.GetValue(); @@ -110,7 +110,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* Columns */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x28,0x11> at4; at4.SetFromDataSet(ds); dim[0] = at4.GetValue(); @@ -123,7 +123,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* PixelSpacing */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x28,0x30> at5; at5.SetFromDataSet(ds); spacing[0] = at5.GetValue(0); @@ -137,7 +137,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* GridFrameOffsetVector */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x3004,0x000C> at6; const gdcm::DataElement& de6 = ds.GetDataElement( at6.GetTag() ); at6.SetFromDataElement(de6); @@ -198,7 +198,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* DoseGridScaling */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x3004,0x000E> at7 = { 1. } ; at7.SetFromDataSet(ds); m_DoseScaling = at7.GetValue(); @@ -228,7 +228,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() // Read Image Information bool clitk::DicomRTDoseIO::CanReadFile(const char* FileNameToRead) { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Reader creader; creader.SetFileName(FileNameToRead); if (!creader.Read()) @@ -279,7 +279,7 @@ void clitk::DicomRTDoseIO::Read(void * buffer) npix *= GetDimensions(i); /* PixelData */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Image &i = m_GdcmImageReader.GetImage(); char* image_data = new char[i.GetBufferLength()]; diff --git a/common/clitkDicomRTDoseIO.h b/common/clitkDicomRTDoseIO.h index 2f08938..dbcafe1 100644 --- a/common/clitkDicomRTDoseIO.h +++ b/common/clitkDicomRTDoseIO.h @@ -24,7 +24,7 @@ // itk include #include #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include #endif @@ -77,7 +77,7 @@ protected: bool mustWriteHeader; int m_HeaderSize; std::ofstream file; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::ImageReader m_GdcmImageReader; #else gdcm::File *m_GdcmFile; diff --git a/common/clitkDicomRT_Contour.cxx b/common/clitkDicomRT_Contour.cxx index 28fd054..9a5042b 100644 --- a/common/clitkDicomRT_Contour.cxx +++ b/common/clitkDicomRT_Contour.cxx @@ -20,7 +20,7 @@ #include "clitkDicomRT_Contour.h" #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include "gdcmAttribute.h" #include "gdcmItem.h" #endif @@ -53,7 +53,7 @@ void clitk::DicomRT_Contour::Print(std::ostream & os) const //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 void clitk::DicomRT_Contour::UpdateDicomItem() { DD("DicomRT_Contour::UpdateDicomItem"); @@ -119,7 +119,7 @@ void clitk::DicomRT_Contour::UpdateDicomItem() //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 bool clitk::DicomRT_Contour::Read(gdcm::Item * item) { mItem = item; diff --git a/common/clitkDicomRT_Contour.h b/common/clitkDicomRT_Contour.h index 077599f..ab6db0d 100644 --- a/common/clitkDicomRT_Contour.h +++ b/common/clitkDicomRT_Contour.h @@ -22,7 +22,7 @@ #include "clitkCommon.h" #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #else #include #include @@ -44,7 +44,7 @@ public: void Print(std::ostream & os = std::cout) const; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 bool Read(gdcm::Item * item); void UpdateDicomItem(); #else @@ -71,7 +71,7 @@ protected: ///Z location of the contour double mZ; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Item * mItem; #else gdcm::SQItem * mItem; diff --git a/common/clitkDicomRT_ROI.cxx b/common/clitkDicomRT_ROI.cxx index 4135b31..d8af8c3 100644 --- a/common/clitkDicomRT_ROI.cxx +++ b/common/clitkDicomRT_ROI.cxx @@ -25,7 +25,7 @@ #include #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include "gdcmAttribute.h" #include "gdcmItem.h" #endif @@ -148,7 +148,7 @@ double clitk::DicomRT_ROI::GetForegroundValueLabelImage() const //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 bool clitk::DicomRT_ROI::Read(gdcm::Item * itemInfo, gdcm::Item * itemContour) { //FATAL("Error : compile vv with itk4 + external gdcm"); @@ -302,7 +302,7 @@ void clitk::DicomRT_ROI::ComputeMeshFromContour() //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 //-------------------------------------------------------------------- void clitk::DicomRT_ROI::UpdateDicomItem() { diff --git a/common/clitkDicomRT_ROI.h b/common/clitkDicomRT_ROI.h index ec43538..b417933 100644 --- a/common/clitkDicomRT_ROI.h +++ b/common/clitkDicomRT_ROI.h @@ -79,7 +79,7 @@ public: void SetName(std::string n) { mName = n; } // Read from DICOM RT STRUCT -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 bool Read(gdcm::Item * itemInfo, gdcm::Item * itemContour); void UpdateDicomItem(); #else @@ -104,7 +104,7 @@ protected: double mForegroundValue; bool m_DicomUptodateFlag; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Item * mItemInfo; gdcm::Item * mItemContour; gdcm::SmartPointer mContoursSequenceOfItems; diff --git a/common/clitkDicomRT_StructureSet.cxx b/common/clitkDicomRT_StructureSet.cxx index 49d90bd..a845ef5 100644 --- a/common/clitkDicomRT_StructureSet.cxx +++ b/common/clitkDicomRT_StructureSet.cxx @@ -239,7 +239,7 @@ void clitk::DicomRT_StructureSet::Print(std::ostream & os) const //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 //-------------------------------------------------------------------- int clitk::DicomRT_StructureSet::ReadROINumber(const gdcm::Item & item) { @@ -255,7 +255,7 @@ int clitk::DicomRT_StructureSet::ReadROINumber(const gdcm::Item & item) //-------------------------------------------------------------------- void clitk::DicomRT_StructureSet::Write(const std::string & filename) { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // Assert that the gdcm file is still open (we can write only if it was readed) if (mFile == NULL) { @@ -461,7 +461,7 @@ void clitk::DicomRT_StructureSet::Read(const std::string & filename) bool clitk::DicomRT_StructureSet::IsDicomRTStruct(const std::string & filename) { // Open DICOM -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // Read gdcm file mReader = new gdcm::Reader; mReader->SetFileName(filename.c_str()); diff --git a/common/clitkDicomRT_StructureSet.h b/common/clitkDicomRT_StructureSet.h index 7932051..dff4d75 100644 --- a/common/clitkDicomRT_StructureSet.h +++ b/common/clitkDicomRT_StructureSet.h @@ -38,7 +38,7 @@ #endif // gdcm -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // This is not use if CLITK_USE_SYSTEM_GDCM==1 #include "gdcmReader.h" #include "gdcmWriter.h" @@ -81,7 +81,7 @@ public: int AddBinaryImageAsNewROI(vvImage * i, std::string name); -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // Static static int ReadROINumber(const gdcm::Item & item); #endif @@ -98,7 +98,7 @@ protected: std::map mROIs; std::map mMapOfROIName; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Reader * mReader; gdcm::SmartPointer mROIInfoSequenceOfItems; gdcm::SmartPointer mROIContoursSequenceOfItems; diff --git a/tools/clitkDicom2Image.cxx b/tools/clitkDicom2Image.cxx index 51a32d1..399168c 100644 --- a/tools/clitkDicom2Image.cxx +++ b/tools/clitkDicom2Image.cxx @@ -26,7 +26,7 @@ #include #include #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include #include #include @@ -64,7 +64,7 @@ int main(int argc, char * argv[]) std::map< int, std::vector > theorientation; std::map< int, std::vector > sliceLocations; std::map< int, std::vector > seriesFiles; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 if (args_info.verbose_flag) std::cout << "Using GDCM-2.x" << std::endl; #else @@ -76,7 +76,7 @@ int main(int argc, char * argv[]) for(unsigned int i=0; i= 2 gdcm::Reader hreader; hreader.SetFileName(input_files[i].c_str()); hreader.Read(); diff --git a/tools/clitkDicomInfo.cxx b/tools/clitkDicomInfo.cxx index 202afc7..183f09f 100644 --- a/tools/clitkDicomInfo.cxx +++ b/tools/clitkDicomInfo.cxx @@ -28,7 +28,7 @@ // itk (gdcm) include #include "gdcmFile.h" -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include "gdcmReader.h" #include "gdcmPrinter.h" #include "gdcmDict.h" @@ -46,7 +46,7 @@ int main(int argc, char * argv[]) if (args_info.inputs_num == 0) return 0; // Study ID - #if GDCM_MAJOR_VERSION == 2 + #if GDCM_MAJOR_VERSION >= 2 if (args_info.studyID_flag) { std::set l; for(unsigned int i=0; i= 2 gdcm::Reader reader; reader.SetFileName(args_info.inputs[i]); reader.Read(); diff --git a/tools/clitkGateSimulation2DicomGenericFilter.txx b/tools/clitkGateSimulation2DicomGenericFilter.txx index fe849b3..9ad2857 100644 --- a/tools/clitkGateSimulation2DicomGenericFilter.txx +++ b/tools/clitkGateSimulation2DicomGenericFilter.txx @@ -134,7 +134,7 @@ void GateSimulation2DicomGenericFilter::UpdateWithDimAndPixelType() { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // ImageTypes typedef itk::Image InputImageType; typedef itk::Image OutputImageType; diff --git a/tools/clitkImage2DicomDoseGenericFilter.txx b/tools/clitkImage2DicomDoseGenericFilter.txx index 1c4e88f..df105fa 100644 --- a/tools/clitkImage2DicomDoseGenericFilter.txx +++ b/tools/clitkImage2DicomDoseGenericFilter.txx @@ -138,7 +138,7 @@ void Image2DicomDoseGenericFilter::UpdateWithDimAndPixelType() { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // ImageTypes typedef itk::Image InputImageType; typedef unsigned short int OutputPixelType; diff --git a/tools/clitkPartitionEnergyWindowDicomGenericFilter.txx b/tools/clitkPartitionEnergyWindowDicomGenericFilter.txx index bf58925..8e8fa33 100644 --- a/tools/clitkPartitionEnergyWindowDicomGenericFilter.txx +++ b/tools/clitkPartitionEnergyWindowDicomGenericFilter.txx @@ -136,7 +136,7 @@ void PartitionEnergyWindowDicomGenericFilter::UpdateWithDimAndPixelType() { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // ImageTypes typedef itk::Image InputImageType; typedef itk::Image OutputImageType; diff --git a/vv/vvMeshReader.cxx b/vv/vvMeshReader.cxx index 0feabf3..b041638 100644 --- a/vv/vvMeshReader.cxx +++ b/vv/vvMeshReader.cxx @@ -24,7 +24,7 @@ // gdcm #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include #include #include @@ -125,7 +125,7 @@ std::vector > vvMeshReader::GetROINames() } #else -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // duplicate code from clitk::DicomRT_StructureSet::Read gdcm::Reader * reader = new gdcm::Reader; @@ -223,7 +223,7 @@ std::vector > vvMeshReader::GetROINames() std::vector vvMeshReader::readSelectedContours() { std::vector result; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Reader reader; reader.SetFileName(filename.c_str()); reader.Read(); diff --git a/vv/vvQDicomSeriesSelector.cxx b/vv/vvQDicomSeriesSelector.cxx index 9c27982..d5444cd 100644 --- a/vv/vvQDicomSeriesSelector.cxx +++ b/vv/vvQDicomSeriesSelector.cxx @@ -20,7 +20,7 @@ #include #include #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include #include #include @@ -144,7 +144,7 @@ void vvDicomSeriesSelector::SearchButtonRelease() mListOfSeriesFilenames[seriesUID[i]] = filenames; // store first header -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 mDicomHeader[seriesUID[i]].SetFileName( (*filenames)[0].c_str() ); mDicomHeader[seriesUID[i]].Read(); #else @@ -235,7 +235,7 @@ void vvDicomSeriesSelector::itemDetailsSelectionChanged() std::ostringstream s; QString l; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 mDicomHeader[mCurrentSerie].GetFile().Print(s); const gdcm::File& header = mDicomHeader[mCurrentSerie].GetFile(); gdcm::StringFilter sf; @@ -284,7 +284,7 @@ void vvDicomSeriesSelector::itemDetailsSelectionChanged() //==================================================================== //==================================================================== -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, const gdcm::Reader& header) { QString n = QString("%1").arg(mListOfSeriesFilenames[s]->size()); @@ -357,7 +357,7 @@ QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, gdcm::File *header //==================================================================== QString vvDicomSeriesSelector::AddInfo(const gdcm::File *header, QString n, uint16_t group, uint16_t elem) { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::StringFilter sf; sf.SetFile( *header ); gdcm::Tag t( group, elem ); @@ -381,7 +381,7 @@ QString vvDicomSeriesSelector::AddInfo(std::string n, std::string m) //==================================================================== void vvDicomSeriesSelector::AddSerieToTheTable(int i, std::vector & filenames) { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #else gdcm::File *header = new gdcm::File(); header->SetFileName(filenames[0]); diff --git a/vv/vvQDicomSeriesSelector.h b/vv/vvQDicomSeriesSelector.h index aa905fc..b70e507 100644 --- a/vv/vvQDicomSeriesSelector.h +++ b/vv/vvQDicomSeriesSelector.h @@ -50,7 +50,7 @@ protected: QString mPreviousPath; QString mFoldername; void AddSerieToTheTable(int i, std::vector & filenames); -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 QString MakeDicomInfo(std::string & s, const gdcm::Reader& header); #else QString MakeDicomInfo(std::string & s, gdcm::File *header); @@ -64,7 +64,7 @@ private: std::map* > mListOfSeriesFilenames; std::vector * mFilenames; std::map mDicomInfo; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 std::map mDicomHeader; #else std::map mDicomHeader;