]> Creatis software - clitk.git/commitdiff
Update to enable GDCMv3
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Tue, 7 Aug 2018 11:09:34 +0000 (13:09 +0200)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Tue, 7 Aug 2018 11:09:34 +0000 (13:09 +0200)
16 files changed:
common/clitkDicomRTDoseIO.cxx
common/clitkDicomRTDoseIO.h
common/clitkDicomRT_Contour.cxx
common/clitkDicomRT_Contour.h
common/clitkDicomRT_ROI.cxx
common/clitkDicomRT_ROI.h
common/clitkDicomRT_StructureSet.cxx
common/clitkDicomRT_StructureSet.h
tools/clitkDicom2Image.cxx
tools/clitkDicomInfo.cxx
tools/clitkGateSimulation2DicomGenericFilter.txx
tools/clitkImage2DicomDoseGenericFilter.txx
tools/clitkPartitionEnergyWindowDicomGenericFilter.txx
vv/vvMeshReader.cxx
vv/vvQDicomSeriesSelector.cxx
vv/vvQDicomSeriesSelector.h

index 88e1289..72f711f 100644 (file)
@@ -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()];
index 2f08938..dbcafe1 100644 (file)
@@ -24,7 +24,7 @@
 // itk include
 #include <itkImageIOBase.h>
 #include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   #include <gdcmImageReader.h>
 #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;
index 28fd054..9a5042b 100644 (file)
@@ -20,7 +20,7 @@
 #include "clitkDicomRT_Contour.h"
 #include <vtkCellArray.h>
 
-#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;
index 077599f..ab6db0d 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "clitkCommon.h" 
 #include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #else
 #include <gdcm.h>
 #include <gdcmSQItem.h>
@@ -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;
index 4135b31..d8af8c3 100644 (file)
@@ -25,7 +25,7 @@
 #include <vtkPolyDataWriter.h>
 #include <vtkVersion.h>
 
-#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()
 {
index ec43538..b417933 100644 (file)
@@ -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<gdcm::SequenceOfItems> mContoursSequenceOfItems;
index 49d90bd..a845ef5 100644 (file)
@@ -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());
index 7932051..dff4d75 100644 (file)
@@ -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<int, clitk::DicomRT_ROI::Pointer> mROIs;
   std::map<int, std::string> mMapOfROIName;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Reader * mReader;
   gdcm::SmartPointer<gdcm::SequenceOfItems> mROIInfoSequenceOfItems;
   gdcm::SmartPointer<gdcm::SequenceOfItems> mROIContoursSequenceOfItems;  
index 51a32d1..399168c 100644 (file)
@@ -26,7 +26,7 @@
 #include <gdcmFile.h>
 #include <vtkVersion.h>
 #include <vtkImageChangeInformation.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   #include <gdcmImageHelper.h>
   #include <gdcmAttribute.h>
   #include <gdcmReader.h>
@@ -64,7 +64,7 @@ int main(int argc, char * argv[])
   std::map< int, std::vector<double> > theorientation;
   std::map< int, std::vector<double> > sliceLocations;
   std::map< int, std::vector<std::string> > 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<args_info.inputs_num; i++) {
     if (args_info.verbose_flag)
         std::cout << "Reading <" << input_files[i] << std::endl;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
     gdcm::Reader hreader;
     hreader.SetFileName(input_files[i].c_str());
     hreader.Read();
index 202afc7..183f09f 100644 (file)
@@ -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<std::string> l;
     for(unsigned int i=0; i<args_info.inputs_num; i++) {
@@ -85,7 +85,7 @@ int main(int argc, char * argv[])
  if (!args_info.studyID_flag)
   for(unsigned int i=0; i<args_info.inputs_num; i++) {
     if (args_info.filename_flag) std::cout << args_info.inputs[i] << std::endl;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
     gdcm::Reader reader;
     reader.SetFileName(args_info.inputs[i]);
     reader.Read();
index fe849b3..9ad2857 100644 (file)
@@ -134,7 +134,7 @@ void
 GateSimulation2DicomGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
 {
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   // ImageTypes
   typedef itk::Image<PixelType, Dimension> InputImageType;
   typedef itk::Image<PixelType, Dimension> OutputImageType;
index 1c4e88f..df105fa 100644 (file)
@@ -138,7 +138,7 @@ void
 Image2DicomDoseGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
 {
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   // ImageTypes
   typedef itk::Image<PixelType, Dimension> InputImageType;
   typedef unsigned short int OutputPixelType;
index bf58925..8e8fa33 100644 (file)
@@ -136,7 +136,7 @@ void
 PartitionEnergyWindowDicomGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
 {
 
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   // ImageTypes
   typedef itk::Image<PixelType, Dimension> InputImageType;
   typedef itk::Image<PixelType, Dimension> OutputImageType;
index 0feabf3..b041638 100644 (file)
@@ -24,7 +24,7 @@
 
 // gdcm 
 #include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #include <gdcmReader.h>
 #include <gdcmTag.h>
 #include <gdcmAttribute.h>
@@ -125,7 +125,7 @@ std::vector<std::pair<int,std::string> > 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<std::pair<int,std::string> > vvMeshReader::GetROINames()
 std::vector<vvMesh::Pointer> vvMeshReader::readSelectedContours()
 {
   std::vector<vvMesh::Pointer> result;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
   gdcm::Reader reader;
   reader.SetFileName(filename.c_str());
   reader.Read();
index 9c27982..d5444cd 100644 (file)
@@ -20,7 +20,7 @@
 #include <itkGDCMImageIO.h>
 #include <itkGDCMSeriesFileNames.h>
 #include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #include <gdcmImageReader.h>
 #include <gdcmDataSetHelper.h>
 #include <gdcmStringFilter.h>
@@ -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<std::string> & filenames)
 {
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
 #else
   gdcm::File *header = new gdcm::File();
   header->SetFileName(filenames[0]);
index aa905fc..b70e507 100644 (file)
@@ -50,7 +50,7 @@ protected:
     QString mPreviousPath;
     QString mFoldername;
     void AddSerieToTheTable(int i, std::vector<std::string> & 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<std::string, std::vector<std::string>* > mListOfSeriesFilenames;
     std::vector<std::string> * mFilenames;
     std::map<std::string, QString> mDicomInfo;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
     std::map<std::string, gdcm::Reader> mDicomHeader;
 #else
     std::map<std::string, gdcm::File*> mDicomHeader;