Are there tools available to convert a NIFTI-formatted file to DICOM format? Python-based solutions would be great, but anything would be fine.
I do not have specific experience, but am writing as no one else has. A quick web search suggests a few converters exist, though I did not see any in Python (though several of the executables could be called from a Python script). I would caution that the DICOM format is very complex, and has a lot of specific requirements. In my experience, many tools (including those from major vendors) generate DICOM-like images that work with most DICOM tools but are not strictly legal and will fail with some DICOM-compliant tools.
In contrast, NIfTI is much simpler and more explicit. The simpler aspect means that NIfTI does not have the meta-data required for conversion back to DICOM. For example, a DICOM with the Modality (0008,0060) “MR” has specific Type 1 and Type 2 required tags that do not exist in NIfTI. Perhaps the most valid way to convert any NIfTI to DICOM would be to report the modality (0008,0060) as other (“OT”), as the OT format does not have modality-specific requirements. This would be a nice solution if you want to upload a derived images (e.g. stat map, FA, etc) up to a DICOM system. Just do not expect this DICOM to have the rich meta data in the source image.
If I were to look at one tool to do this, I would explore pixelmed which is developed by David Clunie. He would top my list of DICOM experts on the planet. While I personally strongly disagree with his 2017 MICCAI comments deriding BIDS and NIfTI (as I think these simpler formats fill an important niche data analyses), I do not deny his contributions and meticulous code quality.
If, like me, you didn’t know what Chris was referring to in his last paragraph, see this:
Thanks very much for the feedback, Chris and Guillaume!