I am trying to make NRRD files viewable in OHIF’s Local Viewer.
So far, I have used itk.js’s readImageFile method to take NRRD files as input. Now I’d like to output the given file as a DICOM file, which will then be supplied to the OHIF Viewer. But I am not sure how to convert the NRRD file to DICOM using itk.js
Thanks for the response. I tried implementing your suggestion, but I don’t believe I have the data required to implement it. this is the data from the NRRD file I receive after read the image using ITK:
Right, if you start with NRRD format data you typically don’t have the information to make a full dicom file. Maybe the information was there originally but was thrown away when converting to NRRD. In this case you can either try to find the data from some other source or you can leave it out (or put in placeholders). A lot depends on how you want to use the dicom version. If you just need it to have the right geometry and pixel values you can work with just the NRRD data. If you need it to be valid dicom and match up with other data in a PACS or navigation system then you need to find things like StudyUID and PatientID.
Unfortunately the dicom standard doesn’t allow floating point data in any of the standard modality types. You need to use a parametric map for that if you really need floating point. Not many systems support parametric maps though, so even if that is technically correct it’s not very interoperable.
If you goal is to have dicom files that display in other systems then you are better off casting to 16 bit (or 12) and if needed using the RescaleSlope and RescaleIntercept to provide a linear mapping back to the original floating point values.