External Script

<< Click to Display Table of Contents >>

Navigation:  Image Display and Basic Processing > Image Processing Tools >

External Script

picture_9131

This tool allows running an external program, which needs to be placed in Pmod4.1/resources/extlibs/scripts. It then shows up in the External script to execute list as a new entry. Input to the script is an image file with the name defined in the Script's Input field. The script may apply any processing to the image and needs to save the resulting image under the name defined in the Script's Output field. Note also the image format definitions for the input and the output which must meet the file content.

When the external tool is executed, it will first save the current image with the Script's Input definition, call the script, and then try loading an image file with Script's Output definition.

Example: Execution of Matlab Script

A Matlab script example which requires Matlab's Image Processing Toolbox is available in Pmod4.1/resources/extlibs/scripts. It consists of two files:

matlabScript.sh which starts Matlab and lets it execute the code in the mFile script. It essentially contains a system-specific matlab call:
matlab -nosplash -r testScript

mfiles/testScript.m which contains proper the actual image processing, eg
% Read data from disk. Info metadata is needed to preserve
% important image features, e.g. timing.
data = dicomread('C:/Pmod4.1/data/tmp/out');
info = dicominfo('C:/Pmod4.1/data/tmp/out');
% Processing.
...
...
% Write data to disk. This will be input to PMOD.
% To save data in DICOM multiframe mode, use
% 'Create Mode' option with 'copy' value.
dicomwrite(fData, 'C:/Pmod4.1/data/tmp/inp', info, 'CreateMode', 'copy')
quit