Преглед на файлове

Implement the dataset access for element values

Use the ctkDICOMDataset to coerce to string types
for use in the GUI.
Steve Pieper преди 13 години
родител
ревизия
2dfb6edd6e
променени са 1 файла, в които са добавени 11 реда и са изтрити 2 реда
  1. 11 2
      Libs/DICOM/Core/ctkDICOMDatabase.cpp

+ 11 - 2
Libs/DICOM/Core/ctkDICOMDatabase.cpp

@@ -487,13 +487,22 @@ QString ctkDICOMDatabase::fileValue(const QString fileName, QString tag)
 QString ctkDICOMDatabase::fileValue(const QString fileName, const unsigned short group, const unsigned short element)
 {
   // here is where the real lookup happens
+  // - for now we create a ctkDICOMDataset and extract the value from there
+  // - then we convert to the appropriate type of string
+  //
+  //As an optimization we could consider
   // - check if we are currently looking at the dataset for this fileName
   // - if so, are we looking for a group/element that is past the last one
   //   accessed
-  //   -- if so, keep looking for the 
+  //   -- if so, keep looking for the requested group/element
+  //   -- if not, start again from the begining
 
-  return( "" );
+  ctkDICOMDataset dataset;
+  dataset.InitializeFromFile(fileName);
+  
+  DcmTagKey tagKey(group, element);
 
+  return( dataset.GetAllElementValuesAsString(tagKey) );
 }
 
 //------------------------------------------------------------------------------