Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with pixel redaction for JPEGLoseless type #376

Open
syedkibrahim opened this issue Jan 5, 2024 · 1 comment
Open

Issue with pixel redaction for JPEGLoseless type #376

syedkibrahim opened this issue Jan 5, 2024 · 1 comment

Comments

@syedkibrahim
Copy link

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.
3

Using DicomParser and saw that this file is having encapsulatedPixelData: true, not sure if that is the reason.
2

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.

@pieper
Copy link
Collaborator

pieper commented Jan 6, 2024

Related to #375. This would also require use of codecs to handle the transfer syntaxes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants