From 82a070f2eaa960eae4236fb11ab5afc64a2c171b Mon Sep 17 00:00:00 2001 From: tbaudier Date: Thu, 10 Mar 2016 09:37:38 +0100 Subject: [PATCH] Add a tag to preserve UID and private DICOM tags for clitkWriteDicomSeries (see previous commit) --- tools/clitkWriteDicomSeries.ggo | 1 + tools/clitkWriteDicomSeriesGenericFilter.txx | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/clitkWriteDicomSeries.ggo b/tools/clitkWriteDicomSeries.ggo index faa08cb..d5f1347 100644 --- a/tools/clitkWriteDicomSeries.ggo +++ b/tools/clitkWriteDicomSeries.ggo @@ -14,3 +14,4 @@ option "tag" t "Tags values" string no multiple default="MIDPOSITION" option "newSeriesUID" e "Write the series with a new series UID (ignored if given in key/tag option)" flag off option "newStudyUID" u "Write the series with a new study UID (ignored if given in key/tag option; forces newSeriesUID = true)" flag off option "useSizeAsReference" s "Use the size of the dicom image as reference for an occasional resampling" flag off +option "preserve" p "Preserve private tags and keep original UID (eg: Xio)" flag off diff --git a/tools/clitkWriteDicomSeriesGenericFilter.txx b/tools/clitkWriteDicomSeriesGenericFilter.txx index f30947f..a2bccc4 100644 --- a/tools/clitkWriteDicomSeriesGenericFilter.txx +++ b/tools/clitkWriteDicomSeriesGenericFilter.txx @@ -153,8 +153,12 @@ WriteDicomSeriesGenericFilter::UpdateWithDimAndPixelType() // Read the series typename ReaderType::Pointer reader = ReaderType::New(); - gdcmIO->LoadPrivateTagsOn(); - gdcmIO->KeepOriginalUIDOn(); + if (m_ArgsInfo.preserve_flag) { +#if GDCM_MAJOR_VERSION >= 2 + gdcmIO->LoadPrivateTagsOn(); + gdcmIO->KeepOriginalUIDOn(); +#endif + } reader->SetImageIO( gdcmIO ); reader->SetFileNames( filenames_in ); try { -- 2.47.1