Skip to content

Commit 35db8a3

Browse files
committed
WIP fix(image-sets-normalization): fallback to tag hex key if private or empty
1 parent 3d112e7 commit 35db8a3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/dicom/gdcm/image-sets-normalization.cxx

+10-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151

5252
std::string getLabelFromTag(const gdcm::Tag &tag, const gdcm::DataSet &dataSet)
5353
{
54+
if (tag.IsPrivateCreator()) {
55+
return tag.PrintAsContinuousUpperCaseString();
56+
}
5457
std::string strowner;
5558
const char *owner = 0;
5659
if (tag.IsPrivate() && !tag.IsPrivateCreator())
@@ -61,7 +64,13 @@ std::string getLabelFromTag(const gdcm::Tag &tag, const gdcm::DataSet &dataSet)
6164
const gdcm::Global &g = gdcm::Global::GetInstance();
6265
const gdcm::Dicts &dicts = g.GetDicts();
6366
const gdcm::DictEntry &entry = dicts.GetDictEntry(tag, owner);
64-
return entry.GetKeyword();
67+
const std::string keyword = entry.GetKeyword();
68+
if (keyword.empty())
69+
{
70+
// There are empty keywords in test/data/input/dicom-images/MR files
71+
return tag.PrintAsContinuousUpperCaseString();
72+
}
73+
return keyword;
6574
}
6675

6776
namespace gdcm

0 commit comments

Comments
 (0)