Importing Model Output (NIfTI) to XNAT for Segmentation in OHIF

124 views
Skip to first unread message

Bernardo Lopes

unread,
May 23, 2023, 10:40:29 AM5/23/23
to xnat_discussion
Hi

- What is the recommended method to import a model output (NIfTI file) to XNAT for further segmentation adjustments in OHIF?
- Are there any specific DICOM SEG metadata requirements to ensure compatibility with the OHIF plugin import?
- Is converting the NIfTI file to DICOM SEG and uploading it through the API the best approach?

Thanks,
Bernardo

akluiber

unread,
May 23, 2023, 12:51:06 PM5/23/23
to xnat_discussion
I've been using dcmqi's itkimage2segimage to convert nrrds to dicom seg, and the import into XNAT via REST api. This seems to work pretty well.

I do find I sometimes have to fix headers depending on the dataset I'm working on, or the dcmqi programs barf. Usually related to ProcedureCodeSequence. If there's a more foolproof set of tools to accomplis this, I'm all ears.

Simon Doran

unread,
May 24, 2023, 5:05:05 AM5/24/23
to xnat_discussion
Hi Both,

  Just to add to this, you may also find the library pydicom_seg (github repo here) and easier way to start than using dcmqi directly. pydicom_seg uses dcmqi in the background. The docs say this:

Converting DICOM-SEG files into ITK compatible data formats, commonly used for research, is made possible by the dcmqi project for some time. However, the project is written in C++ and offers only access to the conversion via the binaries itkimage2segimage and segimage2itkimage. After a conversion of a DICOM-SEG file to ITK NRRD file format, the user has to scan the output directory for generated files, load them individually and potentially combine multiple files to the desired format.

This library aims to make this process much easier, by providing a Python native implementation of reading and writing functionality with support for numpy and SimpleITK. Additionally, common use cases like loading multi-class segmentations are supported out-of-the-box.

  The general approach of:

1. Convert to DICOM-SEG 
2. Use the REST-API to upload to XNAT

is the right way to go.

Here's the REST call you would use:

REST call.png

  Best wishes,

Simon
Reply all
Reply to author
Forward
0 new messages