]> Creatis software - clitk.git/commitdiff
auto generate dicom file UIDs when new series/study is specified
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 25 Sep 2012 16:07:20 +0000 (18:07 +0200)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 25 Sep 2012 16:07:20 +0000 (18:07 +0200)
tools/clitkWriteDicomSeriesGenericFilter.txx

index 20e980ca603f86beb37fd4ea96ca08b4ab2e26f9..3a8446fadabb4c4f5f7ec775d9ca165cc156f28b 100644 (file)
@@ -306,6 +306,18 @@ WriteDicomSeriesGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
       if (m_ArgsInfo.newStudyUID_flag) 
         itk::EncapsulateMetaData<std::string>( *((*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<std::string>( *((*dictionary)[fni]), "0008|0018", fileUID );
+      itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), "0002|0003", fileUID );
+    }
   }