X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImage2DicomDoseGenericFilter.txx;h=df105fadfd1a75e1838d057dbd39ee6b9fdb0edb;hb=543b72e23ad001ac2a7743b9beacf48e2d0054ac;hp=f513834350b7f3814bbb5ff96167c7ece2950a99;hpb=63d194a2b926c2591d9dfde8b139c69d8c15ea58;p=clitk.git diff --git a/tools/clitkImage2DicomDoseGenericFilter.txx b/tools/clitkImage2DicomDoseGenericFilter.txx index f513834..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; @@ -189,6 +189,13 @@ Image2DicomDoseGenericFilter::UpdateWithDimAndPixelType() itk::EncapsulateMetaData(*outputDict, "0020|0032", value.str()); DD(origin); + // orientation + typename InputImageType::DirectionType direction = image->GetDirection(); + value.str(""); + value<(*outputDict, "0020|0037", value.str()); + DD(direction); + // size typename InputImageType::SizeType imageSize = image->GetLargestPossibleRegion().GetSize(); //DD(imageSize); @@ -285,6 +292,11 @@ Image2DicomDoseGenericFilter::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::UpdateWithDimAndPixelType() gdcm::DataSet &dsOutput = file.GetDataSet(); dsOutput.Insert(referenceRTPlanSq); + dsOutput.Replace(deDoseGridScaling); gdcm::Writer w; w.SetFile( file ); w.SetFileName( fileNamesOutput[0].c_str() );