]> Creatis software - clitk.git/blobdiff - tools/clitkImage2DicomDoseGenericFilter.txx
QVTKOpenGLNativeWidget is available from VTK8.2
[clitk.git] / tools / clitkImage2DicomDoseGenericFilter.txx
index f513834350b7f3814bbb5ff96167c7ece2950a99..df105fadfd1a75e1838d057dbd39ee6b9fdb0edb 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;
@@ -189,6 +189,13 @@ Image2DicomDoseGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
   itk::EncapsulateMetaData<std::string>(*outputDict, "0020|0032", value.str());
   DD(origin);
 
+  // orientation
+  typename InputImageType::DirectionType direction = image->GetDirection();
+  value.str("");
+  value<<direction[0][0]<<'\\'<<direction[0][1]<<'\\'<<direction[0][2]<<'\\'<<direction[1][0]<<'\\'<<direction[1][1]<<'\\'<<direction[1][2];
+  itk::EncapsulateMetaData<std::string>(*outputDict, "0020|0037", value.str());
+  DD(direction);
+
   // size
   typename InputImageType::SizeType imageSize = image->GetLargestPossibleRegion().GetSize();
   //DD(imageSize);
@@ -285,6 +292,11 @@ Image2DicomDoseGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
 
   const gdcm::DataElement &referenceRTPlanSq = dsTemplate.GetDataElement(gdcm::Tag(0x300c, 0x02));
 
+  //Create the Dose Grid Scaling data element (ITK 4.13 do not take into account - it works well with ITK 4.5.1)
+  gdcm::DataElement deDoseGridScaling( gdcm::Tag(0x3004,0x0e) );
+  deDoseGridScaling.SetVR( gdcm::VR::DS );
+  deDoseGridScaling.SetByteValue(NumberToString(doseScaling).c_str(), (uint32_t)strlen(NumberToString(doseScaling).c_str()));
+
   //Copy/Write sequence dicom tag with gdcm
   gdcm::Reader readerOutputGDCM;
   readerOutputGDCM.SetFileName( fileNamesOutput[0].c_str() );
@@ -293,6 +305,7 @@ Image2DicomDoseGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
   gdcm::DataSet &dsOutput = file.GetDataSet();
 
   dsOutput.Insert(referenceRTPlanSq);
+  dsOutput.Replace(deDoseGridScaling);
   gdcm::Writer w;
   w.SetFile( file );
   w.SetFileName( fileNamesOutput[0].c_str() );