Skip to content

Commit

Permalink
Allow for lower case 'o' for other VR. Added check to dump.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Aug 4, 2015
1 parent 7b3be73 commit be9d0f2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/dicom/dicomParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ dwv.dicom.DicomParser.prototype.readDataElement = function(reader, offset, impli
typeof dict[tag.group][tag.element] !== "undefined" ) {
vr = dwv.dicom.dictionary[tag.group][tag.element][0];
}
isOtherVR = (vr[0] === 'O');
isOtherVR = (vr[0].toUpperCase() === 'O');
vrOffset = 0;
vl = reader.readUint32( offset+tagOffset+vrOffset );
vlOffset = 4;
Expand Down Expand Up @@ -653,9 +653,6 @@ dwv.dicom.DicomParser.prototype.readDataElement = function(reader, offset, impli
var dataOffset = offset+tagOffset+vrOffset+vlOffset;
if( isOtherVR )
{
if ( vr === "OX" ) {
console.warn("OX value representation for tag: "+tag.name+".");
}
// OB or BitsAllocated == 8
if ( vr === "OB" ||
( typeof this.dicomElements.x00280100 !== 'undefined' &&
Expand Down Expand Up @@ -1070,14 +1067,15 @@ dwv.dicom.DicomElementsWrapper.prototype.getElementAsString = function ( dicomEl
}

var deSize = dicomElement.value.length;
var isOtherVR = ( dicomElement.vr[0].toUpperCase() === "O" );

// no size for delimitations
if ( dicomElement.group === "0xFFFE" && (
dicomElement.element === "0xE00D" ||
dicomElement.element === "0xE0DD" ) ) {
deSize = 0;
}
else if ( dicomElement.vr[0] === "O" ) {
else if ( isOtherVR ) {
deSize = 1;
}

Expand Down Expand Up @@ -1111,7 +1109,7 @@ dwv.dicom.DicomElementsWrapper.prototype.getElementAsString = function ( dicomEl
line += " (PixelSequence #=" + deSize + ")";
}
// 'O'ther array, limited display length
else if ( dicomElement.vr[0] === 'O' ||
else if ( isOtherVR ||
dicomElement.vr === 'pi' ||
dicomElement.vr === "UL" ||
dicomElement.vr === "US" ||
Expand All @@ -1131,7 +1129,7 @@ dwv.dicom.DicomElementsWrapper.prototype.getElementAsString = function ( dicomEl
if ( dicomElement.vr === "FL" ) {
valueStr += Number(dicomElement.value[k].toPrecision(8));
}
else if ( dicomElement.vr[0] === "O" ) {
else if ( isOtherVR ) {
var tmp = dicomElement.value[k].toString(16);
if ( dicomElement.vr === "OB" ) {
tmp = "00".substr(0, 2 - tmp.length) + tmp;
Expand Down

0 comments on commit be9d0f2

Please sign in to comment.