Loading input in a task type¶
Primitive parameters¶
Primitive inputs (of type Int
, Float
, String
or Bool
; see Parameter Types) can be accessed directly via the Python module xfworkerutil
.
For example Lucid.CLIP.Threshold
accesses upper and lower threshold input parameters:
import xfworkerutil
import clip_thres
worker = xfworkerutil.XFWorkerJob()
inputs = worker.job['inputs']
threshold_lower = inputs['threshold_lower0']
threshold_upper = inputs['threshold_upper0']
# Download input files
image = worker.get_omni_image(inputs['image'])
seg_image_omni_path = worker.create_related_path(image.metadata_path, '_seg.omni')
seg_image_pixels_path = worker.create_related_path(image.metadata_path, '_seg.raw')
thres_temp_dir_path = worker.working_dir.path / "thres"
# CLIP
seg_image = clip_thres.thres_image(
image,
threshold_lower,
threshold_upper,
seg_image_omni_path,
seg_image_pixels_path,
thres_temp_dir_path)
# Upload output files
seg_image_output = worker.upload_omni_output(seg_image)
# Save outputs
outputs = {
"segments": seg_image_output,
}
worker.finish(outputs)
Bulk data¶
Composite parameters like Image
refer to bulk data stored separately on FSS.
OMNI image data can be loaded using the xfworkerutil.XFWorkerJob.get_omni_image()
as shown above. See also Loading an OMNI Image.
For other data files xfworkerutil.XFWorkerJob.download_input_file()
can be used instead. See Using IPL in a task type for an example.