PantelisGeorgiadis / dcmjs-dimse

DICOM DIMSE implementation for Node.js using the dcmjs library
MIT License
74 stars 14 forks source link

Ts types possible improvement #28

Open caoshouse opened 2 years ago

caoshouse commented 2 years ago

Added DICOM VRs in order to easily get/set Dataset Elements (including sequences) For instance: ` new Dataset({fakeProperty:'anyValue}) // throws a tsc error

const ds=new Dataset({}) ds.setElement('PatientName',1234) // throws a tsc error

const ds=new Dataset({}) ds.setElement('PatientName','JOHN^DOE') // it works

const ds=new Dataset({}) ds.getElement('ReferencedImageSequence').push({...blahblah}) // it works

`

PantelisGeorgiadis commented 2 years ago

Hello @caoshouse! Thank you for this PR! I was wondering... is there any way to extract the datasetElements information from dcmjs's dictionary? I'm not a huge fan of keeping the same (and large) information twice.

caoshouse commented 2 years ago

Hello @PantelisGeorgiadis I just published a simple package here: https://www.npmjs.com/package/@caoshouse/dcmjs-dictionary It also generates a .d.ts file if needed

Anyway, I found the dictionary data here: dcmjs.data.DicomMetaDictionary.dictionary

PantelisGeorgiadis commented 2 years ago

Great work @caoshouse! So, if I understand correctly, there is no way to generate and use the types dynamically, right? We need to somehow (re)include the dictionary.

caoshouse commented 2 years ago

Maybe I will have a solution to automatically update definition files by grabbing data from nema website. Almost easy Probably Next week