Data parsing and sending from DICOM image in .net core

2k views Asked by At

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.

2

There are 2 answers

2
gofal3 On BEST ANSWER

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());
1
zaid safadi On

OHIF Viewer supports the standard DICOMweb WADO-RS JSON metadata format in addition to the custom format you mentioned in your question. This means you can use any DICOMweb server such as Orthanc, DCM4CHE or DICOMcloud

DICOMcloud may fit your scenario better as it uses fo-dicom. However, it currently only support MS SQL Server and .NET 4.6. (there is an effort to support mySQL but it is not 100% completed)

If you still want to write your own, you can look of how it is implemented and adapt it to your own solution.

[Disclosure] I am the author of DICOMcloud