We are trying to redact a portion of a DICOM file by setting the pixel value to 0.
The file we are trying with is a 16-bit JPEG2000Loseless type (Transfer Syntax ID - 1.2.840.10008.1.2.4.90)
But instead of removing the selected region, it is showing a white noise at the top of the image.
Using DicomParser and saw that this file is having encapsulatedPixelData: true, not sure if that is the reason.
But this approach is working fine for other DICOM file types that we have tested.
The steps we are using are as follows:
We are generating the buffer for the file and storing it in a variable named buffer.
const DicomDict = dcmjs.data.DicomMessage.readFile(buffer);
const pixelDataElement = DicomDict.dict['7FE00010'];
const pixelArrayBuffer = pixelDataElement.Value;
// we are getting the x and y pointer location of the selected area
let bit16Array = new Uint16Array(pixelArrayBuffer[0]);
for (let y = y1; y < y2; y++) {
for (let x = x1; x < x2; x++) {
const index = y * rows + x;
bit16Array[index] = 0;
}
}
pixelDataElement.Value = pixelArrayBuffer;
DicomDict.dict['7FE00010'] = pixelDataElement;
new_file_WriterBuffer = DicomDict.write();
Any input or help will be really appreciated. Thanks.
We are trying to redact a portion of a DICOM file by setting the pixel value to 0. The file we are trying with is a 16-bit JPEG2000Loseless type (Transfer Syntax ID - 1.2.840.10008.1.2.4.90)
But instead of removing the selected region, it is showing a white noise at the top of the image.
Using DicomParser and saw that this file is having encapsulatedPixelData: true, not sure if that is the reason.
But this approach is working fine for other DICOM file types that we have tested. The steps we are using are as follows:
We are generating the buffer for the file and storing it in a variable named buffer.
Any input or help will be really appreciated. Thanks.