Skip to content

Commit

Permalink
WIP fix(image-sets-normalization): fallback to tag hex key if private…
Browse files Browse the repository at this point in the history
… or empty
  • Loading branch information
PaulHax committed Apr 4, 2024
1 parent 3d112e7 commit 35db8a3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/dicom/gdcm/image-sets-normalization.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@

std::string getLabelFromTag(const gdcm::Tag &tag, const gdcm::DataSet &dataSet)
{
if (tag.IsPrivateCreator()) {
return tag.PrintAsContinuousUpperCaseString();
}
std::string strowner;
const char *owner = 0;
if (tag.IsPrivate() && !tag.IsPrivateCreator())
Expand All @@ -61,7 +64,13 @@ std::string getLabelFromTag(const gdcm::Tag &tag, const gdcm::DataSet &dataSet)
const gdcm::Global &g = gdcm::Global::GetInstance();
const gdcm::Dicts &dicts = g.GetDicts();
const gdcm::DictEntry &entry = dicts.GetDictEntry(tag, owner);
return entry.GetKeyword();
const std::string keyword = entry.GetKeyword();
if (keyword.empty())
{
// There are empty keywords in test/data/input/dicom-images/MR files
return tag.PrintAsContinuousUpperCaseString();
}
return keyword;
}

namespace gdcm
Expand Down

0 comments on commit 35db8a3

Please sign in to comment.