#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
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();
#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;
}
/* ImagePositionPatient */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
gdcm::Attribute<0x20,0x32> at2;
at2.SetFromDataSet(ds);
ipp[0] = at2.GetValue(0);
#endif
/* Rows */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
gdcm::Attribute<0x28,0x10> at3;
at3.SetFromDataSet(ds);
dim[1] = at3.GetValue();
#endif
/* Columns */
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
gdcm::Attribute<0x28,0x11> at4;
at4.SetFromDataSet(ds);
dim[0] = at4.GetValue();
#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);
#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);
#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();
// 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())
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()];
// itk include
#include <itkImageIOBase.h>
#include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
#include <gdcmImageReader.h>
#endif
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;
#include "clitkDicomRT_Contour.h"
#include <vtkCellArray.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
#include "gdcmAttribute.h"
#include "gdcmItem.h"
#endif
//--------------------------------------------------------------------
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
void clitk::DicomRT_Contour::UpdateDicomItem()
{
DD("DicomRT_Contour::UpdateDicomItem");
//--------------------------------------------------------------------
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
bool clitk::DicomRT_Contour::Read(gdcm::Item * item)
{
mItem = item;
#include "clitkCommon.h"
#include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
#else
#include <gdcm.h>
#include <gdcmSQItem.h>
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
///Z location of the contour
double mZ;
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
gdcm::Item * mItem;
#else
gdcm::SQItem * mItem;
#include <vtkPolyDataWriter.h>
#include <vtkVersion.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
#include "gdcmAttribute.h"
#include "gdcmItem.h"
#endif
//--------------------------------------------------------------------
-#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");
//--------------------------------------------------------------------
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
//--------------------------------------------------------------------
void clitk::DicomRT_ROI::UpdateDicomItem()
{
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
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;
//--------------------------------------------------------------------
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
//--------------------------------------------------------------------
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) {
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());
#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"
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
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;
#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>
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
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();
// 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"
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++) {
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();
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;
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;
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;
// gdcm
#include <gdcmFile.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
#include <gdcmReader.h>
#include <gdcmTag.h>
#include <gdcmAttribute.h>
}
#else
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
// duplicate code from clitk::DicomRT_StructureSet::Read
gdcm::Reader * reader = new gdcm::Reader;
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();
#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>
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
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;
//====================================================================
//====================================================================
-#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());
//====================================================================
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 );
//====================================================================
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]);
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);
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;