From 4454c06e212fb6af58d206f2d6f9b76778858967 Mon Sep 17 00:00:00 2001 From: Romulo Pinho Date: Tue, 25 Sep 2012 18:07:20 +0200 Subject: [PATCH] auto generate dicom file UIDs when new series/study is specified --- tools/clitkWriteDicomSeriesGenericFilter.txx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/clitkWriteDicomSeriesGenericFilter.txx b/tools/clitkWriteDicomSeriesGenericFilter.txx index 20e980c..3a8446f 100644 --- a/tools/clitkWriteDicomSeriesGenericFilter.txx +++ b/tools/clitkWriteDicomSeriesGenericFilter.txx @@ -306,6 +306,18 @@ WriteDicomSeriesGenericFilter::UpdateWithDimAndPixelType() if (m_ArgsInfo.newStudyUID_flag) itk::EncapsulateMetaData( *((*dictionary)[fni]), studyUIDKey, studyUID ); } + + if (m_ArgsInfo.newSeriesUID_flag || m_ArgsInfo.newStudyUID_flag || series_id_given || study_id_given) { + std::string fileUID; +#if GDCM_MAJOR_VERSION >= 2 + gdcm::UIDGenerator fid; + fileUID = fid.Generate(); +#else + fileUID = gdcm::Util::CreateUniqueUID( gdcmIO->GetUIDPrefix()); +#endif + itk::EncapsulateMetaData( *((*dictionary)[fni]), "0008|0018", fileUID ); + itk::EncapsulateMetaData( *((*dictionary)[fni]), "0002|0003", fileUID ); + } } -- 2.47.1