Skip to content

Make DICOMSeriesToVolumeOperator consistent with ITK in serving NumPy array #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 27, 2022

Conversation

MMelQin
Copy link
Collaborator

@MMelQin MMelQin commented Jan 19, 2022

The noted issue in the generated DICOM Seg instance will be investigated outside of this PR.

The Image object instances in the application pipeline was not completely consistent in its representation of the pixel in NumPy array, especial around the index order, i.e. DWH or DHW. One wonders if the representation is similar to what's provided in other packages, e.g. (Simple) ITK.

This PR intends to make the App SDK Image object instances in the processing pipeline of an application more consistent by separating the concerns during image loading of DICOM instance, during inference using MONAI transforms including re-shaping the image array, and the output Image after inference:

  1. Consistent with ITK on converting DICOM series instances to volumetric image in DICOMSeriesToVolumeOperator. The NumPy array of the App SDK Image instance has array index order of DHW, and the metadata for pixel spacing and orientation have save values as loaded by (Simple) ITK. This image object is used by downstream operators, e.g. ClaraViz operator, segmentation operator, etc.
  2. Consistent with MONAI ITKReader on serving out pixel data and metadata in the InMemImageReader, used in the SegmentationInferenceOperator. MONAI has multiple ImageReader implementations, each for loading certain file formats, and ITKReader is for DICOM instances. To have consistent data representation (with NibabelReader), ITKReader rearranges the NumPy array internally before severing out data, see the implementation in monai 0.7. The InMemImageReader is then made consistent with ITKReader.
  3. The Image object encapsulating the segmentation inference results is consistent with that of ITK, e.g. the data NumPy array index order is DHW. This Seg image is used by ClaraViz integration operator, the new STL mesh operator, as well as the DICOMSegmentationWriterOperator.

Code changes have been tested:

  • The Image loaded from DICOM is as expected.
  • The MONAI inference pipeline in the Segmentation Operator works fine with the updated InMemImageReader, and generates the segmentation image in NIfTI same as before.
  • The DICOM Segmentation writer, with the in-mem Image object as input, generates DICOM Seg instance which has multiple segment slices in the same frame. This is an issue, and is still being worked on. Even with the NIfTI image file generated in the inference pipeline, the DICOM Segmentation writer also generates the same (bad) DICOM Seg instance. It is also noted that the DICOMSegmentationWriterOperator itself did not change.

Update:
The aforementioned DICOMSegmentationWriterOperator issures have been reproduced in App SDK main, tag 0.1.1, and 0.2, so the changes within this PR are not the cause of the errors. It is further noted that the DICOMSegmentationWriterOperator had been tested working properly in release v0.2, except a known issue with a specific input data set. It is unknown what the root cause is as of now, and plan to investigate and fix the root cause outside of this PR.

image

@MMelQin MMelQin changed the title [WIP] Made DICOMSeriesToVolumeOperator consistent with ITK in serving NumPy array Make DICOMSeriesToVolumeOperator consistent with ITK in serving NumPy array Jan 20, 2022
…nd metadata with loaded dcm instances

Signed-off-by: mmelqin <mingmelvinq@nvidia.com>
Signed-off-by: mmelqin <mingmelvinq@nvidia.com>
Signed-off-by: mmelqin <mingmelvinq@nvidia.com>
@MMelQin MMelQin force-pushed the mqin/MakeDicomSeriesToVolumeOp_consistent_with_ITK branch from 4e745b9 to 63c861d Compare January 27, 2022 01:57
@MMelQin MMelQin merged commit 819977a into main Jan 27, 2022
@MMelQin MMelQin mentioned this pull request Jan 27, 2022
@MMelQin MMelQin self-assigned this Apr 15, 2022
@MMelQin MMelQin mentioned this pull request Apr 21, 2022
@MMelQin MMelQin deleted the mqin/MakeDicomSeriesToVolumeOp_consistent_with_ITK branch February 3, 2025 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants