10.20. FastIO-ITK Operator
FastIO-ITK Operator is a reference application that makes use of Clara Pipeline Driver and ITK Python packages for fast 3D image processing.
This application, in the form of a Docker container, is expected to work with Clara (CPDriver) orchestrator engine to use FastIO’s features so it wouldn’t work as standalone with docker.
The main code is available at
/app/main.py and it is executed with parameters inside the container like below:
/bin/bash -c 'python -u /app/main.py <command name>'
According to the
<command name>, it does a different job and each command acts as a stage in the pipeline.
read_volume command reads a volume image in MetaImage
format (.mhd) from
/input folder, using ITK.
Then it converts the loaded image into NumPy’s Array object and publishes it to the shared-memory using Clara (CPDriver) with the shared-memory name
filter_volume command reads the shared-memory
fastio_itk into NumPy Array object and gets an image
view from the array to crop the volume image using ITK’s ExtractImageFilter.
The cropped volume would be overwritten to the original shared-memory with the different name
The following environment variables are used to set the region to crop:
CROP_START_X : start x position. Default: -1 [= 0]
CROP_START_Y : start y position. Default: -1 [= 0]
CROP_START_Z : start z position. Default: -1 [= 0]
CROP_SIZE_X : size of x-axis to crop. Default: -1 [= (image width ) - CROP_START_X]
CROP_SIZE_Y : size of y-axis to crop. Default: -1 [= (image length) - CROP_START_Y]
CROP_SIZE_Z : size of z-axis to crop. Default: -1 [= (image height) - CROP_START_Z]
write_volume command reads the shared-memory
fastio_itk_filtered into NumPy Array object and gets an image view
from the array to store the volume image in MetaImage
/output/output.mhd) using ITK.
It also publishes the volume image to Render Server
by adding metadata (to
/output/config.meta) and adding render configuration (from
/config/config_render.json). It expects that
/output folders are mounted in the container.