From 63d194a2b926c2591d9dfde8b139c69d8c15ea58 Mon Sep 17 00:00:00 2001 From: tbaudier Date: Tue, 30 Jan 2018 15:28:30 +0100 Subject: [PATCH] Add new dicom tag in clitkImage2DicomDose --- tools/clitkImage2DicomDoseGenericFilter.txx | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/clitkImage2DicomDoseGenericFilter.txx b/tools/clitkImage2DicomDoseGenericFilter.txx index c8ee918..f513834 100644 --- a/tools/clitkImage2DicomDoseGenericFilter.txx +++ b/tools/clitkImage2DicomDoseGenericFilter.txx @@ -273,6 +273,30 @@ Image2DicomDoseGenericFilter::UpdateWithDimAndPixelType() std::cerr << excp << std::endl; } + //Read sequence dicom tag with gdcm + gdcm::Reader readerTemplateGDCM; + readerTemplateGDCM.SetFileName( fileNames[0].c_str() ); + readerTemplateGDCM.Read(); + gdcm::File &fileTemplate = readerTemplateGDCM.GetFile(); + gdcm::DataSet &dsTemplate = fileTemplate.GetDataSet(); + const unsigned int ptr_len = 42; + char *ptrTemplate = new char[ptr_len]; + memset(ptrTemplate,0,ptr_len); + + const gdcm::DataElement &referenceRTPlanSq = dsTemplate.GetDataElement(gdcm::Tag(0x300c, 0x02)); + + //Copy/Write sequence dicom tag with gdcm + gdcm::Reader readerOutputGDCM; + readerOutputGDCM.SetFileName( fileNamesOutput[0].c_str() ); + readerOutputGDCM.Read(); + gdcm::File &file = readerOutputGDCM.GetFile(); + gdcm::DataSet &dsOutput = file.GetDataSet(); + + dsOutput.Insert(referenceRTPlanSq); + gdcm::Writer w; + w.SetFile( file ); + w.SetFileName( fileNamesOutput[0].c_str() ); + w.Write(); //--------------------------------------------------------------------------------------- //WRITE DICOM BIS -- 2.47.1