dcmjs icon indicating copy to clipboard operation
dcmjs copied to clipboard

DICOM Tag Length are Modified using dcmjs

Open Subashree01 opened this issue 5 years ago • 1 comments
trafficstars

I am using dcmjs package for inserting some new elements in Dicom files. New tag datas are inserted successfully, But the exisiting tag data say CTExposureSequence length is changing from 152 to -1.

Any one knows the cause of it?

(0018,9321) CTExposureSequence SQ 1 102 || (0018,9321) CTExposureSequence SQ 1 -1

this how i have utilized the dcm package to write the two new tags `router.post("/updateDicomTagDatas", function(req,res,next) { var WorkFlow= req.body.workFlow; var dcmEmail=req.body.dcmEmail;

for(let i=0;i<allFilePaths.length;i++)
{
let arrayBuffer = fs.readFileSync(allFilePaths[i]).buffer;    
let DicomDict = dcmjs.data.DicomMessage.readFile(arrayBuffer);

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

 DicomDict.dict = dcmjs.data.DicomMetaDictionary.denaturalizeDataset(dataset);
  DicomDict.upsertTag("00090114","ST",dcmEmail);
  DicomDict.upsertTag("00090115","ST",WorkFlow);
let new_file_WriterBuffer = DicomDict.write();

 fs.writeFileSync(allFilePaths[i], Buffer.from(new_file_WriterBuffer));
}
 res.send({'status':200}); 

});`

Subashree01 avatar Feb 21 '20 10:02 Subashree01

The sequence should be losslessly preserved. Maybe you can provide a small example script that replicates the issue on anonymous data so we can use it for testing.

pieper avatar Feb 21 '20 16:02 pieper