12.16. 3D Image Processing Pipeline using FastIO
The 3D Image Processing pipeline is one of the reference pipelines provided with Clara Deploy SDK. It accepts a volume image in MetaImage format, and optionally accept parameters for cropping. The output is the cropped volume image and the image is published to the Render Server so that it can be viewed on the web browser.
The 3D Image Processing pipeline using FastIO is defined in the Clara Deploy pipeline definition language. This pipeline utilizes built-in reference containers to construct the following operator:
- FastIO-ITK Operator to read/filter/write volume image using FastIO and ITK
- Register Results Operator to publish the volume image to Render Server
The following is the details of pipeline definition, with comments describing each operator’s functions as well as input and output.
api-version: 0.4.0
name: fastio-itk-pipeline
parameters:
CROP_START_X: -1
CROP_START_Y: -1
CROP_START_Z: -1
CROP_SIZE_X: -1
CROP_SIZE_Y: -1
CROP_SIZE_Z: -1
operators:
- name: read-volume
description: Read a volume file into the shared memory
container:
image: clara/fastio-itk
tag: latest
command: ["/bin/bash", "-c", "python-u/app/main.pyread_volume"]
input:
- path: /input
output:
- path: /output
requests:
memory: 8192
- name: filter-volume
description: Read a volume from the shared memory and pass to filters
container:
image: clara/fastio-itk
tag: latest
command: ["/bin/bash", "-c", "python-u/app/main.pyfilter_volume"]
variables:
CROP_START_X: ${{CROP_START_X}}
CROP_START_Y: ${{CROP_START_Y}}
CROP_START_Z: ${{CROP_START_Z}}
CROP_SIZE_X: ${{CROP_SIZE_X}}
CROP_SIZE_Y: ${{CROP_SIZE_Y}}
CROP_SIZE_Z: ${{CROP_SIZE_Z}}
input:
- from: read-volume
path: /input
output:
- path: /output
requests:
memory: 8192
- name: write-volume
description: Write the volume from the shared memory to the file
container:
image: clara/fastio-itk
tag: latest
command: ["/bin/bash", "-c", "python-u/app/main.pywrite_volume"]
input:
- from: filter-volume
path: /input
- path: /config # user-provided input payload including config_render.json file
output:
- path: /output
requests:
memory: 8192
- name: register-volume-images-for-rendering
description: Register volume images, MHD format, for rendering.
container:
image: clara/register-results
tag: latest
command: ["python", "register.py", "--agent", "renderserver"]
input:
- from: write-volume
path: /input
Please refer to the Run Reference Pipelines using Local Input Files
in the How to run a Reference Pipeline section to learn how to register a pipeline and
execute the pipeline using local input files.
Example)
mkdir -p ~/.clara/pipelines
cd ~/.clara/pipelines
# Download pipeline
clara pull pipeline clara_fastio_itk_pipeline
cd clara_fastio_itk_pipeline
# Unzip test input data
unzip app_fastio_itk-input_v1.zip -d input
# Create a pipeline
clara create pipeline -p fastio-itk-pipeline.yaml
clara create jobs -p <PIPELINE ID> -n <JOB NAME> -f <INPUT PATH>
# Start a job with a parameter `CROP_START_X=230` and `CROP_SIZE_Z=300`
clara start job -j <JOB ID> -a CROP_START_X=230 -a CROP_SIZE_Z=300
Input requires a folder containing the following files:
- .mhd (with .raw) - Input MetaIO file
- config_render.json - Configuration for Render Server
Cropped volume on Render Server
- Go to the Clara RenderServer UI using a web browser:
The URL is:
<IP of the machine>:8080
- You should see a dataset with a name that includes the name of the job you specified and the operator name (e.g.,
fastio-itk-test-write-volume
) - Clicking the dataset would show the rendered image on the screen