Bladeren bron

Display formatted person name, to remove internal delimeters

Remove ^ characters and display as first, middle, last, suffix.

This uses the dcmtk standard function to do formatting.  If we want,
for example, last, first, middle, suffix we would need to write
our own method.
Steve Pieper 12 jaren geleden
bovenliggende
commit
45e42b277d
1 gewijzigde bestanden met toevoegingen van 11 en 0 verwijderingen
  1. 11 0
      Libs/DICOM/Core/ctkDICOMModel.cpp

+ 11 - 0
Libs/DICOM/Core/ctkDICOMModel.cpp

@@ -29,6 +29,9 @@
 #include <QTime>
 #include <QDebug>
 
+// dcmtk includes
+#include "dcvrpn.h"
+
 // ctkDICOMCore includes
 #include "ctkDICOMModel.h"
 #include "ctkLogger.h"
@@ -506,6 +509,14 @@ QVariant ctkDICOMModel::data ( const QModelIndex & dataIndex, int role ) const
       return QString("No description");
     }
   }
+
+  if (columnName.compare("Name")==0)
+  {
+    OFString formattedName;
+    DcmPersonName::getFormattedNameFromString(OFString(dataValue.toString().toStdString().c_str()), formattedName);
+    return QString(formattedName.c_str());
+  }
+
   return dataValue;
 }