VolViewer Scripting in more detail: Difference between revisions

From BanghamLab
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
A script is a limited form of program - a list of commands. In this case the commands ([http://dmbi.nbi.bbsrc.ac.uk/Index.php/VolViewerScriptsAPI see VolViewerScriptsAPI]) cover most of the operations that you would usually do interactively. On Windows, VolViewer is an exe file. It can either be launched by clicking its icon or from the command prompt using the command<br>
A script is a limited form of program - a list of commands. In this case the commands ([http://dmbi.nbi.bbsrc.ac.uk/Index.php/VolViewerScriptsAPI see VolViewerScriptsAPI]) cover most of the operations that you would usually do interactively. On Windows, VolViewer is an exe file. It can either be launched by clicking its icon or from the command prompt using the command<br>
  VolViewer.exe
  VolViewer.exe
Normally VolViewer runs interactively. However, having discovered how best to filter and view an image stack it is possible to tell VolViewer to apply the sequence of operations (stored as a script) to, for example, every image and every stack in an image sequence. To do this one launches VolViewer giving the name of a text file that contains the script needed to repeat the sequence of operations. For example, if the script is contained in a file called '' 'myscript.txt' '' in the same path (directory) as VolViewer itself then VolViewer should be launched using the command<br>
Normally VolViewer runs interactively this is how you would discover how best to filter and view an image stack. That done it is tedious to then repeat the operations on all stacks in a sequence. The alternative is to list the operations (commands) in a script file and tell VolViewer to follow the commands. To do this one launches VolViewer giving the name of a text file that contains the script. For example, if the script is contained in a file called '' 'myscript.txt' '' in the same path (directory) as VolViewer itself then VolViewer should be launched using the command<br>
  VolViewer.exe open_script('myscript.txt')
  VolViewer.exe open_script('myscript.txt')
VolViewer will open, execute the operations in  '' 'myscript.txt' '' and close again with no further actions by the user (you).
VolViewer will open, execute the operations in  '' 'myscript.txt' '' and close again with no further actions by the user (you).

Revision as of 19:30, 24 January 2012

Back to VolViewer overview

VolViewer scripting and accessing VolViewer from Matlab

VolViewer scripting

A script is a limited form of program - a list of commands. In this case the commands (see VolViewerScriptsAPI) cover most of the operations that you would usually do interactively. On Windows, VolViewer is an exe file. It can either be launched by clicking its icon or from the command prompt using the command

VolViewer.exe

Normally VolViewer runs interactively this is how you would discover how best to filter and view an image stack. That done it is tedious to then repeat the operations on all stacks in a sequence. The alternative is to list the operations (commands) in a script file and tell VolViewer to follow the commands. To do this one launches VolViewer giving the name of a text file that contains the script. For example, if the script is contained in a file called 'myscript.txt' in the same path (directory) as VolViewer itself then VolViewer should be launched using the command

VolViewer.exe open_script('myscript.txt')

VolViewer will open, execute the operations in 'myscript.txt' and close again with no further actions by the user (you). The following is an example of 'myscript.txt' . It opens an image called 'Anti_Flower 294 (gfp1+txr+vis)' in a directory called 'E:\VOLUME DATA', filters it, save a projection and saves the processed stack.

 'myscript.txt'  contains
open_image_stack(0, 'E:\VOLUME DATA\Anti_Flower 294 (gfp1+txr+vis)\')
compute_GPUfilter_AnisotropicDiffusion(0, 5.0, 0.1, 10)
save_projection('E:\VOLUME DATA\Projections\Anti_Flower 294 (gfp1+txr+vis).png')
save_image_stack('E:\VOLUME DATA\Anti_Flower 294 (gfp1+txr+vis)\Filtered\')

Matlab to Volviewer