// itk include
#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
+// which also properly recognize RTDOSE
#include <gdcmReader.h>
#include <gdcmAttribute.h>
#else
#if GDCM_MAJOR_VERSION == 2
gdcm::Image &i = m_GdcmImageReader.GetImage();
i.GetBuffer((char*)buffer);
+ // WARNING: GetBuffer return the pixel values as stored on disk not the real pixel value
+ // we still need to multiply by m_DoseScaling
+ // An alternate solution would be to use vtkGDCMImageReader...
#else
float *img = (float*) buffer;
//--------------------------------------------------------------------
+#if GDCM_MAJOR_VERSION == 2
+#else
bool clitk::DicomRT_Contour::Read(gdcm::SQItem * item)
{
return true;
}
+#endif
//--------------------------------------------------------------------
#define CLITKDICOMRT_CONTOUR_H
#include "clitkCommon.h"
+#include <gdcmFile.h>
+#if GDCM_MAJOR_VERSION == 2
+#else
#include <gdcm.h>
#include <gdcmSQItem.h>
+#endif
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
itkNewMacro(Self);
void Print(std::ostream & os = std::cout) const;
+#if GDCM_MAJOR_VERSION == 2
+#else
bool Read(gdcm::SQItem * item);
+#endif
vtkPolyData * GetMesh();
vtkPoints * GetPoints() {return mData;}
double GetZ() const {return mZ;}
//--------------------------------------------------------------------
+#if GDCM_MAJOR_VERSION == 2
+#else
void clitk::DicomRT_ROI::Read(std::map<int, std::string> & rois, gdcm::SQItem * item)
{
}
}
}
+#endif
//--------------------------------------------------------------------
itkNewMacro(Self);
void Print(std::ostream & os = std::cout) const;
+#if GDCM_MAJOR_VERSION == 2
+#else
void Read(std::map<int, std::string> & rois, gdcm::SQItem * item);
+#endif
void SetFromBinaryImage(vvImage * image, int n,
std::string name,
std::vector<double> color,
#include "clitkDicomRT_StructureSet.h"
#include <vtksys/SystemTools.hxx>
+#include "gdcmFile.h"
+#if GDCM_MAJOR_VERSION == 2
+#include "vtkGDCMPolyDataReader.h"
+#endif
//--------------------------------------------------------------------
clitk::DicomRT_StructureSet::DicomRT_StructureSet()
void clitk::DicomRT_StructureSet::Read(const std::string & filename)
{
// Open DICOM
+#if GDCM_MAJOR_VERSION == 2
+ vtkGDCMPolyDataReader * reader = vtkGDCMPolyDataReader::New();
+ reader->SetFileName( filename.c_str() );
+#else
gdcm::File reader;
reader.SetFileName(filename.c_str());
reader.SetMaxSizeLoadEntry(16384); // Needed ...
n++;
}
+#endif
}
//--------------------------------------------------------------------
#include <QApplication>
+#include <gdcmFile.h>
+#if GDCM_MAJOR_VERSION == 2
+#else
#include <gdcm.h>
#include <gdcmSQItem.h>
+#endif
#include <vtkSmartPointer.h>
#include <vtkAppendPolyData.h>
std::vector<std::pair<int,std::string> > vvMeshReader::GetROINames()
{
assert(filename!="");
+ std::vector<std::pair<int, std::string> > roi_names;
+#if GDCM_MAJOR_VERSION == 2
+#else
gdcm::File reader;
reader.SetFileName(filename.c_str());
reader.SetMaxSizeLoadEntry(16384);
gdcm::SeqEntry * roi_info=reader.GetSeqEntry(0x3006,0x0020);
assert(roi_info);
- std::vector<std::pair<int, std::string> > roi_names;
// DD("ici");
//int n=0;
for (gdcm::SQItem* i=roi_info->GetFirstSQItem(); i!=0; i=roi_info->GetNextSQItem())
if (i->GetEntryValue(0x3006,0x0022)!= gdcm::GDCM_UNFOUND)
roi_names.push_back(make_pair(atoi(i->GetEntryValue(0x3006,0x0022).c_str()),i->GetEntryValue(0x3006,0x0026)));
+#endif
return roi_names;
}
std::vector<vvMesh::Pointer> vvMeshReader::readSelectedContours()
{
+ std::vector<vvMesh::Pointer> result;
+#if GDCM_MAJOR_VERSION == 2
+#else
gdcm::File reader;
reader.SetFileName(filename.c_str());
reader.SetMaxSizeLoadEntry(16384);
reader.Load();
- std::vector<vvMesh::Pointer> result;
gdcm::SeqEntry * rois=reader.GetSeqEntry(0x3006,0x0039);
///We need to iterate both on the contours themselves, and on the contour info
gdcm::SeqEntry * roi_info=reader.GetSeqEntry(0x3006,0x0020);
}
k=roi_info->GetNextSQItem(); //increment the second loop variable
}
+#endif
return result;
}
#include <itkGDCMImageIO.h>
#include <itkGDCMSeriesFileNames.h>
#include <gdcmFile.h>
+#if GDCM_MAJOR_VERSION == 2
+#include <gdcmImageReader.h>
+#include <gdcmDataSetHelper.h>
+#include <gdcmStringFilter.h>
+#else
#include <gdcmDocEntry.h>
+#endif
#include "vvQDicomSeriesSelector.h"
//#include "vvUserConfig.h"
mListOfSeriesFilenames[seriesUID[i]] = filenames;
// store first header
+#if GDCM_MAJOR_VERSION == 2
+ gdcm::ImageReader reader;
+ reader.SetFileName( (*filenames)[0].c_str() );
+ reader.Read();
+ mDicomHeader[seriesUID[i]] = &reader.GetFile();
+#else
gdcm::File *header = new gdcm::File();
header->SetFileName((*filenames)[0]);
header->SetMaxSizeLoadEntry(16384);
mDicomHeader[seriesUID[i]] = header;
+#endif
// new item
QListWidgetItem *newItem = new QListWidgetItem;
QString l;
gdcm::File * header = mDicomHeader[mCurrentSerie];
+#if GDCM_MAJOR_VERSION == 2
+ gdcm::StringFilter sf;
+ sf.SetFile( *header );
+ gdcm::DataSet &ds = header->GetDataSet();
+ gdcm::DataSet::ConstIterator it = ds.Begin();
+ for (; it != ds.End(); ++it )
+ {
+ const gdcm::DataElement & ref = *it;
+ const gdcm::Tag & tag = ref.GetTag();
+ gdcm::VR vr = gdcm::DataSetHelper::ComputeVR(*header, ds, tag);
+ if ( vr & ( gdcm::VR::OB | gdcm::VR::OF | gdcm::VR::OW | gdcm::VR::SQ | gdcm::VR::UN ) )
+ {
+ // What is the behavior for binary stuff ?
+ }
+ else /* if ( vr & gdcm::VR::VRASCII ) */
+ {
+ if ( tag.IsPublic() )
+ {
+ std::pair<std::string, std::string> p = sf.ToStringPair(tag);
+ l += QString("%1 : %2\n")
+ .arg( p.first.c_str() )
+ .arg( p.second.c_str() );
+ }
+ }
+ }
+#else
gdcm::DocEntry * e = header->GetFirstEntry();
while (e) {
if (e->GetName() != "gdcm::Unknown") {
}
e = header->GetNextEntry();
}
+#endif
mDicomDetails[(*mFilenames)[i]] = l.toStdString();
}
QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, gdcm::File *header)
{
QString n = QString("%1").arg(mListOfSeriesFilenames[s]->size());
+#if GDCM_MAJOR_VERSION == 2
+ QString ss;
+#else
QString size = QString("%1x%2x%3")
.arg(header->GetXSize())
.arg(header->GetYSize())
AddInfo( "Origin : ", origin.toStdString())+
AddInfo(header, "Pixel size : ", 0x0028,0x0100)+
AddInfo( "Pixel type : ", header->GetPixelType());
+#endif
return ss;
}
//====================================================================
//====================================================================
QString vvDicomSeriesSelector::AddInfo(gdcm::File *header, QString n, uint16_t group, uint16_t elem)
{
+#if GDCM_MAJOR_VERSION == 2
+ gdcm::StringFilter sf;
+ sf.SetFile( *header );
+ gdcm::Tag t( group, elem );
+ std::string s = sf.ToString( t );
+ return AddInfo(n.toStdString(), s);
+#else
return AddInfo(n.toStdString(), header->GetEntryValue(group, elem));
+#endif
}
//====================================================================
//====================================================================
void vvDicomSeriesSelector::AddSerieToTheTable(int i, std::vector<std::string> & filenames)
{
+#if GDCM_MAJOR_VERSION == 2
+#else
gdcm::File *header = new gdcm::File();
header->SetFileName(filenames[0]);
header->SetMaxSizeLoadEntry(16384);
DD(ui.mTableWidget->rowCount());
ui.mTableWidget->setItem(i, 0, newItem);
*/
+#endif
}
//====================================================================