Nodejs bindings for dicom-rs.
To install the package, run the following command:
npm install node-dicom-rs
To receive DICOM files using the StoreSCP
class, you can use the following example:
import { StoreSCP } from 'node-dicom-rs';
const receiver = new StoreSCP({
verbose: true,
calling_ae_title: 'STORE-SCP',
strict: false,
uncompressed_only: false,
promiscuous: false,
max_pdu_length: 16384,
out_dir: './tmp',
port: 4446
});
receiver.addEventListener('OnFileStored', (eventData) => {
console.log('File stored:', eventData);
});
receiver.listen();
To send DICOM files using the StoreScu
class, you can use the following example:
import { StoreScu } from 'node-dicom-rs';
const sender = new StoreScu({
addr: '127.0.0.1:4446',
verbose: true
});
sender.addFile('./__test__/fixtures/test.dcm');
const result = await sender.send();
console.log(result);
To work with DICOM files using the DicomFile
class, you can use the following example:
import { DicomFile, saveRawPixelData } from 'node-dicom-rs';
const file = new DicomFile();
file.open('./__test__/fixtures/test.dcm');
file.saveRawPixelData('./tmp/raw_pixel_data.jpg');
saveRawPixelData('./__test__/fixtures/test.dcm', './tmp/raw_pixel_data_2.jpg');
console.log(file.getElements());
file.close();