dcmjs-org/dcmjs

The saved image file is inconsistent with the source file.

suoc opened this issue · 9 comments

suoc commented

http://23.94.212.216/download/dicoms/position-img.dcm

This picture has positioning lines, which disappear after reading and saving.

pieper commented

Thanks for posting this issue with a link to the data. Perhaps someone will be able to use this to help with this.

It would help if you provided the exact code to replicate the issue, along with screenshots before and after. If there are any diagnostic messages printed please include those too.

suoc commented

I used your nodejs sample code.
Before
After

pieper commented

Did you look at the object before and after? Probably there is a sequence that didn't get converted.

Note that this is not a paid project with guaranteed support. We'd like to make the software better but we need to share the work of investigating any issues. It would help if you posted the file before and after and also investigate specifically what's different.

suoc commented

Here is my code.

const filePath = 'a dcm file path';

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

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

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

console.log(dataset);

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

let new_file_WriterBuffer = DicomDict.write();

fs.writeFileSync('to local path', new Buffer(new_file_WriterBuffer));
suoc commented

Thank you for your reply, in addition, I also found that the data parsed by dcmjs will be partially missing.
image

suoc commented

Sorry for my mistake, I found the reason and I will close this issue.

pieper commented

Okay, glad you sorted it out and thanks for looping back to report here 👍

suoc commented

The reason for this issue is that calling naturalizeDataset and then calling denaturalizeDataset will lose some tags.

pieper commented

Did you see anything odd about the data that would explain why it behaves this way?