+
+ // study description
+ if (studyUIDGiven || m_ArgsInfo.newStudyUID_flag) {
+ if (!studyIDGiven)
+ itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), studyIDKey,itksys::SystemTools::GetFilenameName( m_ArgsInfo.outputDir_arg ));
+ if (!studyDescriptionGiven)
+ itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), studyDescriptionKey,itksys::SystemTools::GetFilenameName( m_ArgsInfo.outputDir_arg ));
+
+ itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), "0008|0020", instanceDate.str() );
+ itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), "0008|0030", instanceTime.str() );
+ }
+
+ // series description/number
+ if (seriesUIDGiven || m_ArgsInfo.newSeriesUID_flag) {
+ if (!seriesDescriptionGiven)
+ itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), seriesDescriptionKey, itksys::SystemTools::GetFilenameName(m_ArgsInfo.outputDir_arg) );
+ if (!seriesNumberGiven)
+ itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), seriesNumberKey, itksys::SystemTools::GetFilenameName(m_ArgsInfo.outputDir_arg) );
+
+ itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), "0008|0012", instanceDate.str() );
+ itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), "0008|0013", instanceTime.str() );
+ }
+
+ // file UIDs are recreated for new studies or series
+ if (!useInputFileUID)
+ {
+ 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 );
+
+ filenames_out[fni] = itksys::SystemTools::CollapseFullPath(fileUID.c_str(), m_ArgsInfo.outputDir_arg) + std::string(".dcm");
+ }