The COVID-19-pipeline got inverted segmentation result

I tried to deploy the Clara Deploy AI COVID-19 Classification Pipeline (version:0.7.3-2011.5) and ran a demo job,and I find the segmentation result of covid lesion is inverted:

,however the lung segmentation result is right:

Since the TransformMatrix of covid-lesion segmentation’s mhd is -1 0 0 0 -1 0 0 0 1, I wonder if dicom-seg-writer can correctly process the transform matrix? Or is there any other solution to rectify the inverted result? Thanks a lot.

Hi @wxwxwwxxx

Thank you very much for your question and feedback after having tried out the Clara COVID-19 pipeline. Thank you also for your patience on getting a response from us, as we had been doing some internal investigation before responding.

Please advise us what software was used in your rendering, and confirm both the segmentation and original images used in the rendering are in DICOM format.

Before diving into the details, please let me clarify that for the COVID-19 pipeline, the lung segmentation AI inference result (shown in your test correctly aligned) is fed into the COVID-19 classification model to arrive at the final predictions and hence classification result, which is not affected by the lesion segmentation orientation misalignment. Besides, the lesion to lung volume ratio is not affected. So, both DICOM Reports for classification and volume ratio are correct, and the issue is isolated to the lesion segmentation orientation.

So, here are the observations:

So, the lesion segmentation is diagonally inverted. A bug has been logged and the fix will be scheduled. Below are a few points that may lead to the possible root cause of the issue:

  • In this particular Lesion operator, the input image is loaded as closest canonical (the lung seg does not do this) , so special processing was required for writing out the resultant seg image into MetaIO format.
  • When loaded into 3D Slicer, the orientation was correctly processed and seg image shown correctly even with the somewhat different TranformMatrix (note the associated AnatomicalOrientation = LPI".
  • In the DICOM segmentation writer, the seg image is loaded back using Simple ITK, and the image slices are used to generate the DICOM Seg IOD referencing the original DICOM instances.
  • During this loading phase, the image orientation may not have been handled correctly.

Hope this helps explain the issue, and we’ll work to confirm and address the root cause.

Thank you


The issue has been fixed in R0.8.1, and the workaround in R0.7 is to remove the "as_closest_canonical": true in loadNifti in the config_inference.json of the Lesion operator. Please see the root cause analysis below.

The Lesion operator in the COVID-19 pipeline loads input image, in NIfTI format, as closest canonical, and then creates tensors. The image writer in this operator is then required to revert the orientation of the image generated from the output tensors, which is required to align with input DICOM anatomical orientation.

It was found that in Release 0.7 the setting to revert the output image was missing in the inference configuration, as a result the generated DICOM Segmentation image was of wrong orientation.