浏览代码

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) );
 }
 
 //------------------------------------------------------------------------------