Running in non-interactive mode
Opened this issue · 1 comments
adityaapte commented
Thanks for the nice toolkit. Is there documentation to get started on using PTK in batch mode? I would like to run airway segmentation on a bunch of CT scans without going through the GUI.
tomdoel commented
Hi, there are a few ways to run in a non-interactive/batch mode.
- The most powerful way is to use the API in your own Matlab code - Tutorial 3 in an introduction to this. You need to import the data into PTK using the PTKMain() object and loop through your scans and create a PTKDataset() object for each scan. You then call the
GetResult()
method on this object to run a particular plugin on that scan. You can see which airway plugins are available in thePlugins/Airways
directory and of course you can write your own. - You can also skip the plugins architecture and directly run the underlying image processing functions which are mostly in the
Library/Airways/
folder. What plugins actually do is to glue together these functions into a pipeline. - It's also possible to skip Matlab altogether and run the command-line executable PulmonaryToolkitApi. You can download this from github or compile it yourself. The excutable is limited to running the batch scripts in the
Scripts
directory, although if you comoile it yourself then you can add your own custom scripts. There is some very limited documentation here.
Note: When working with the plugin or function outputs you might need to parse the special data structures that are produced - for example airway plugins tend to produce tree structures derived from PTKTree. You can look at the plugin and function code to understand how to parse these outputs.