+ std::string studyUID;
+
+ // one pass through the keys given on the cmd-line, to check what will be recreated
+ std::string seriesUIDkey = "0020|000e";
+ std::string seriesNumberKey = "0020|0011";
+ std::string seriesDescriptionKey = "0008|103e";
+ std::string frameOfReferenceUIDKey = "0020|0052";
+ std::string studyUIDKey = "0020|000d";
+ std::string studyIDKey = "0020|0010";
+ std::string studyDescriptionKey = "0008|1030";
+ bool seriesUIDGiven = false;
+ bool seriesNumberGiven = false;
+ bool seriesDescriptionGiven = false;
+ bool studyUIDGiven = false;
+ bool studyIDGiven = false;
+ bool studyDescriptionGiven = false;
+ for (unsigned int i = 0; i < numberOfKeysGiven; i++) {
+ std::string entryId( m_ArgsInfo.key_arg[i] );
+ if (m_ArgsInfo.verbose_flag)
+ DD(entryId);
+
+ seriesUIDGiven |= (entryId == seriesUIDkey || entryId == frameOfReferenceUIDKey);
+ seriesNumberGiven |= (entryId == seriesNumberKey);
+ seriesDescriptionGiven |= (entryId == seriesDescriptionKey);
+ studyUIDGiven |= (entryId == studyUIDKey);
+ studyIDGiven |= (entryId == studyIDKey);
+ studyDescriptionGiven |= (entryId == studyDescriptionKey);
+ }
+
+ // force the creation of a new series if a new study was specified
+ if (!studyUIDGiven && m_ArgsInfo.newStudyUID_flag) {
+ m_ArgsInfo.newSeriesUID_flag = true;
+#if GDCM_MAJOR_VERSION >= 2
+ gdcm::UIDGenerator suid;
+ studyUID = suid.Generate();
+#else
+ studyUID = gdcm::Util::CreateUniqueUID( gdcmIO->GetUIDPrefix());
+#endif
+ }
+
+ if (!seriesUIDGiven && m_ArgsInfo.newSeriesUID_flag) {