Pārlūkot izejas kodu

Implement the dataset access for element values

Use the ctkDICOMDataset to coerce to string types
for use in the GUI.
Steve Pieper 13 gadi atpakaļ
vecāks
revīzija
2dfb6edd6e
1 mainītis faili ar 11 papildinājumiem un 2 dzēšanām
  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) );
 }
 
 //------------------------------------------------------------------------------