Explorar el Código

Precache all tags with a single load of the dataset

This change avoids doing a new load of the dataset for each tag
in the precache list.
Steve Pieper hace 12 años
padre
commit
1cb4c934a7
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  1. 10 1
      Libs/DICOM/Core/ctkDICOMDatabase.cpp

+ 10 - 1
Libs/DICOM/Core/ctkDICOMDatabase.cpp

@@ -1029,9 +1029,18 @@ const QStringList ctkDICOMDatabase::tagsToPrecache()
 void ctkDICOMDatabasePrivate::precacheTags( const QString sopInstanceUID )
 {
   Q_Q(ctkDICOMDatabase);
+
+  ctkDICOMDataset dataset;
+  QString fileName = q->fileForInstance(sopInstanceUID);
+  dataset.InitializeFromFile(fileName);
+
   foreach (const QString &tag, this->TagsToPrecache)
     {
-    q->instanceValue(sopInstanceUID, tag);
+    unsigned short group, element;
+    q->tagToGroupElement(tag, group, element);
+    DcmTagKey tagKey(group, element);
+    QString value = dataset.GetAllElementValuesAsString(tagKey);
+    q->cacheTag(sopInstanceUID, tag, value);
     }
 }