Good to know that it is working now.
The reference pipeline only takes a PNG file for now.
And, if you want to take image from a DICOM file,
You can add a custom operator before
ai-app-chestxray stage in chestxray-pipeline.yaml
- Create a custom operator with a docker.
Create main.py (below code is an example of such code) that process .dcm files from
/input folder and save .png file into
from shutil import copy
from pathlib import Path
if __name__ == '__main__':
# Read a DCM file
inp_path = next(Path('/input').glob('*.dcm'))
# Process DCM file (extract images) and save into /output/ folder (Here, it just copy so wrong implementation)
copy(inp_path, Path('/output', inp_path.with_suffix('.png').name))
COPY ./main.py ./main.py
ENTRYPOINT ["python", "-u", "main.py"]
- Build the container image locally:
docker build -t read-dicom .
- Edit chestxray-pipeline.yaml
+ - name: read-dicom
+ description: Read DICOM image and save into PNG file
+ image: read-dicom
+ tag: latest
+ - path: /input
+ - path: /output
- name: ai-app-chestxray
description: Classifying Chest X-ray Images
image: clara/ai-chestxray # this can be different in your file.
tag: latest # this can be different in your file.
- - path: /input
+ - from: read-dicom
+ path: /input
To implement DICOM to PNG converter, you can refer to resources from the internet (you can use
pydicom library to parse DICOM files and may need to use PIL/scikit-image to convert image array to PNG file):
Then, you can trigger the pipeline with the input folder having .dcm file (or you can trigger the pipeline through PACS server by configuring the PACS’ IP and AE Title : https://docs.nvidia.com/clara/deploy/RunningReferencePipeline.html#configure-the-clara-dicom-destination ).