asp.net-mvcasp.net-coredicomfo-dicomdicomweb

Data parsing and sending from DICOM image in .net core


I am currently working on a complete DICOM Web application based on .net core + Postgresql and OHIF viewer ( to render DICOM images). I've built a database with tables as Patient, Study, etc. and the attributes I am storing as PatientName, PatientDOB, etc. now while returning the json the output is also the same as

"PatientName" : "temp"

"PatientDOB" : "2332" ..

but as DICOM viewers have a standard in which they recieve JSON objects as

{ "0020000D": {

  "vr": "UI",

  "Value": [ "1.2.392.200036.9116.2.2.2.1762893313.1029997326.945873" ]
}

}

so I want to map my JSON input/output in such a way that while returning I return values in above Dicom format and while getting the data I store them as attributes (column names) and not as tags?

I am pretty new in .net core and Dicom web so how to proceed further with that? Also, I am using fo-Dicom to read the data from Dicom image.

Please provide some hint/code that I can use.


Solution

  • You will propably store only few DicomTags into your database (the tags you need for doing a query against your database), but the viewer may want to have all the tags as Json. So I would not try to map your database-Jasons into Dicom-jsons, but I would use fo-dicom to generate the Json out of the DICOM file:

    You need to add the nugeg package fo-dicom.json and then you can call

    DicomDataset dataset = ... // wherever you get your DICOM file
    string json = JsonConvert.SerializeObject(dataset, new JsonDicomConverter());
    

    or the othe way round, if you want to convert such a DICOM conformant json into a DicomDataset

    string json = ... // wherever you get the json from
    DicomDataset dataset = JsonConvert.DeserializeObject<DicomDataset>(json, new JsonDicomConverter());