]> Creatis software - clitk.git/blobdiff - tools/clitkWriteDicomSeriesGenericFilter.txx
Merge branch 'master' of git://git.creatis.insa-lyon.fr/clitk
[clitk.git] / tools / clitkWriteDicomSeriesGenericFilter.txx
index 70123e6bac6c1721c04d4433b530349a5cafa999..480e4969847db27b312e63f59f5b6214ed184fbb 100644 (file)
@@ -267,12 +267,12 @@ WriteDicomSeriesGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
     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);
+    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
@@ -308,11 +308,11 @@ WriteDicomSeriesGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
   bool useInputFileUID = true;
   if (m_ArgsInfo.newSeriesUID_flag || m_ArgsInfo.newStudyUID_flag || seriesUIDGiven || studyUIDGiven) {
     useInputFileUID = false;
+  }
+  else {
 #if GDCM_MAJOR_VERSION < 2
     gdcmIO->SetKeepOriginalUID(true);
 #endif
-  }
-  else {
     namesGenerator->SetOutputDirectory( m_ArgsInfo.outputDir_arg  );
     filenames_out = namesGenerator->GetOutputFileNames();
   }
@@ -356,9 +356,9 @@ WriteDicomSeriesGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
     // study description
     if (studyUIDGiven || m_ArgsInfo.newStudyUID_flag) {
       if (!studyIDGiven)
-        itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), studyIDKey, m_ArgsInfo.outputDir_arg );
+        itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), studyIDKey,itksys::SystemTools::GetFilenameName( m_ArgsInfo.outputDir_arg ));
       if (!studyDescriptionGiven)
-        itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), studyDescriptionKey, m_ArgsInfo.outputDir_arg );
+        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() );
@@ -367,9 +367,9 @@ WriteDicomSeriesGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
     // series description/number
     if (seriesUIDGiven || m_ArgsInfo.newSeriesUID_flag) {
       if (!seriesDescriptionGiven)
-        itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), seriesDescriptionKey, m_ArgsInfo.outputDir_arg );
+        itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), seriesDescriptionKey, itksys::SystemTools::GetFilenameName(m_ArgsInfo.outputDir_arg) );
       if (!seriesNumberGiven)
-        itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), seriesNumberKey, m_ArgsInfo.outputDir_arg );
+        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() );