Skip to content

Commit

Permalink
Use sequence bits allocated for pixel data
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Dec 20, 2023
1 parent 49403ce commit befd0df
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/dicom/dicomWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,14 @@ export class DicomWriter {
continue;
}

// possible local bitsAllocated
let sqBitsAllocated = bitsAllocated;
const dataElement = oldItemElements[TagKeys.BitsAllocated];
if (typeof dataElement !== 'undefined' &&
typeof dataElement.value !== 'undefined') {
sqBitsAllocated = dataElement.value[0];
}

// elements
const itemKeys = Object.keys(oldItemElements);
for (let j = 0, lenj = itemKeys.length; j < lenj; ++j) {
Expand All @@ -1087,7 +1095,7 @@ export class DicomWriter {
}
// set item value
subSize += this.#setElementValue(
subElement, subElement.value, isImplicit, bitsAllocated);
subElement, subElement.value, isImplicit, sqBitsAllocated);
newItemElements[itemKey] = subElement;
// add prefix size
subSize += getDataElementPrefixByteSize(
Expand Down

0 comments on commit befd0df

Please sign in to comment.