Skip to content

Commit

Permalink
fix(vr): 🐛 Check that VR has accessors for natural types (#368) (#369)
Browse files Browse the repository at this point in the history
When naturalizing a dataset, the ValueRepresentation class used to add
accessors may be ambiguous if the tag has multiple VR types. In this
case we fall back to no accessor. There are only a handful of tags that
fall into this category, and currently only PN has an accessor.
  • Loading branch information
dmlambo authored Nov 2, 2023
1 parent f0dc199 commit 0365ca1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/DicomMetaDictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import dictionary from "./dictionary";
import log from "./log.js";
import addAccessors from "./utilities/addAccessors";
import { ValueRepresentation } from "./ValueRepresentation";
import dicomJson from "./utilities/dicomJson";

class DicomMetaDictionary {
// intakes a custom dictionary that will be used to parse/denaturalize the dataset
Expand Down
7 changes: 6 additions & 1 deletion src/ValueRepresentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ const tagProxyHandler = {
ValueRepresentation.hasValueAccessors(target.vr)
) {
vrType = ValueRepresentation.createByTypeString(target.vr);
} else if (prop in DicomMetaDictionary.nameMap) {
} else if (
prop in DicomMetaDictionary.nameMap &&
ValueRepresentation.hasValueAccessors(
DicomMetaDictionary.nameMap[prop].vr
)
) {
vrType = ValueRepresentation.createByTypeString(
DicomMetaDictionary.nameMap[prop].vr
);
Expand Down

0 comments on commit 0365ca1

Please sign in to comment.