Plugin Filters via Convert3D Integration
This is an ambitious idea, but it's pretty neat. Several people have suggested plugin filters for ITK-SNAP, in order to apply operations to the grey image, segmentation, or individual layers. Instead of wrapping ITK filters and writing plugin GUI for SNAP, I think it would be more flexible to link ITK-SNAP against convert3d and to allow convert3d scripts to be executed from the ITK-SNAP GUI with a few special commands.
For example, say we want the ability to smooth the grey image with a Gaussian. We could add a GUI action (button, menu item, etc) that would execute a command line
c3d -push $GREY -smooth $PROMPT[SizeVector] -as $GREY
What does this do? The internal images in SNAP would be represented by special variables $GREY, $MAIN, $RGB, $OVERLAY[], etc. Here we push the grey image on the c3d stack, and later assign the result of the computation to the grey image. The $PROMPT[] form says that we should prompt for the size of the Gaussian using the GUI. This command could be expanded to include the title of the prompt, default value, etc.
The neat thing is that we would allow users to write their own scripts and assign them to GUI actions. This could really expand what power users can do in ITK-SNAP.
We could also make c3d more modular, adding support for plugins. Right now the 'adapters' in c3d are very modular indeed, but the command line parser is centralized. What we would have to do is have each adapter provide a 'syntax' to the command line parser, which would then be matched against the command line and routed to the right command. This could be executed using regular expressions for example. If we did this, others could contribute plugins to c3d in the form of shared libraries. And these would be immediately available in SNAP.
List of specialized commands and variables
- $PROMPT[ValueType, DescriptiveText, Default]
- $GREY, $MAIN, $RGB - current main image layer
- $SEG - current segmentation
- $LABEL - a specific label in the segmentation.
- $ACTIVE_LABEL, $DRAWOVER_LABEL - current drawing label, draw over label
- $CURSOR - crosshairs location