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

modifying dicom meta-data #370

Open
satyam-qure opened this issue Nov 3, 2023 · 2 comments
Open

modifying dicom meta-data #370

satyam-qure opened this issue Nov 3, 2023 · 2 comments

Comments

@satyam-qure
Copy link

While using the below code, it works in most cases. However, for abnormal x-rays, it produces an error. (First argument to DataView constructor must be an ArrayBuffer).

const dcmjs = require("dcmjs");
const fs = require("fs");

const filePath = "/Users/pieper/data/public-dicom/MRHead-multiframe+seg/MRHead-multiframe.dcm"

let arrayBuffer = fs.readFileSync(filePath).buffer;

let DicomDict = dcmjs.data.DicomMessage.readFile(arrayBuffer);

const dataset = dcmjs.data.DicomMetaDictionary.naturalizeDataset(DicomDict.dict);

dataset.PatientName = "Name^Somebody's"

DicomDict.dict = dcmjs.data.DicomMetaDictionary.denaturalizeDataset(dataset);

let new_file_WriterBuffer = DicomDict.write();

fs.writeFileSync("/tmp/file.dcm", new Buffer(new_file_WriterBuffer));

Attaching the DICOM file for reference:
https://drive.google.com/file/d/1kS_MQVVA6BJkMwhjh-dbz3fZINIAKi7r/view?usp=drive_link

@pieper
Copy link
Collaborator

pieper commented Nov 3, 2023

Thanks for the report and the file. Did you figure out what's different about this data? Will you be able to look into a fix?

@satyam-qure
Copy link
Author

Thanks for the report and the file. Did you figure out what's different about this data? Will you be able to look into a fix?

Not yet, I'm currently looking into this.

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