Skip to content

Commit

Permalink
fix: Invalid VR of the private creator tag of the "Implicit VR Endian…
Browse files Browse the repository at this point in the history
…" typed DICOM file (#242) (#243)
  • Loading branch information
WoonchanCho committed Feb 9, 2022
1 parent d4a5ab5 commit d680bd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/DicomMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ class DicomMessage {
vrType = "OW";
} else if (vrType == "xs") {
vrType = "US";
} else if (tag.isPrivateCreator()) {
vrType = "LO";
} else {
vrType = "UN";
}
Expand Down
9 changes: 8 additions & 1 deletion src/Tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ class Tag {
return this.is(0x7fe00010);
}

isPrivateCreator() {
const group = this.group();
const element = this.element();
return group % 2 === 1 && element < 0x100 && element > 0x00;
}

static fromString(str) {
var group = parseInt(str.substring(0, 4), 16),
element = parseInt(str.substring(4), 16);
Expand Down Expand Up @@ -96,7 +102,8 @@ class Tag {
useSyntax == EXPLICIT_LITTLE_ENDIAN
? true
: false,
isEncapsulated = this.isPixelDataTag() && DicomMessage.isEncapsulated(syntax);
isEncapsulated =
this.isPixelDataTag() && DicomMessage.isEncapsulated(syntax);

var oldEndian = stream.isLittleEndian;
stream.setEndian(isLittleEndian);
Expand Down

0 comments on commit d680bd1

Please sign in to comment.