Difference between revisions of "VolViewer Scripting in more detail"

From BanghamLab
Jump to navigation Jump to search
Line 10: Line 10:
 
=VolViewer scripting and accessing VolViewer from Matlab=
 
=VolViewer scripting and accessing VolViewer from Matlab=
 
==VolViewer scripting==
 
==VolViewer scripting==
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 that can ''either'' be<br>
 +
'''interactive''', i.e. launched by clicking its icon or from the command prompt using the command<br>
 
  VolViewer.exe
 
  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<br>
+
''or'' '''scripted'''. In which case the operations (commands) are stored in a script file. In which case VolViewer is launched with<br>  
  VolViewer.exe open_script('myscript.txt')
+
  VolViewer set_watchfile('file.txt')
VolViewer will open, execute the operations in  '' 'myscript.txt' '' and close again with no further actions by the user (you).
+
where ''file.txt'' contains the commands. For example, if VolViewer is to be a viewing tool for an external program, e.g. a Matlab program, then the file.txt could contain<br>
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. <br>
+
  open_image_stack(0, 'E:\VOLUME DATA\ScanID1934_Leaf1\')
'' 'myscript.txt' '' contains
+
where ''ScanID1934_Leaf1'' is a directory containing a stack of images.<br><br>
  open_image_stack(0, 'E:\VOLUME DATA\Anti_Flower 294 (gfp1+txr+vis)\')
+
 
compute_GPUfilter_AnisotropicDiffusion(0, 5.0, 0.1, 10)
+
[http://dmbi.nbi.bbsrc.ac.uk/index.php/VolViewerScriptsAPI#Examples Other examples]
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==
 
==Matlab to Volviewer==

Revision as of 11:51, 28 February 2012

Back to VolViewer overview

See also

MSR file specification MSR file specification (MSR stands for Measure.) MSR files describe 3D objects and are used to pass data between the 3D BanghamLab toolboxes: VolViewer, GFtbox and AAMToolbox.
VolViewerScriptsAPI The VolViewerScriptsAPI enables external applications, such as the AAMToolbox, to exploit VolViewer.

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 (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 that can either be
interactive, i.e. launched by clicking its icon or from the command prompt using the command

VolViewer.exe

or scripted. In which case the operations (commands) are stored in a script file. In which case VolViewer is launched with

VolViewer set_watchfile('file.txt')

where file.txt contains the commands. For example, if VolViewer is to be a viewing tool for an external program, e.g. a Matlab program, then the file.txt could contain

open_image_stack(0, 'E:\VOLUME DATA\ScanID1934_Leaf1\')

where ScanID1934_Leaf1 is a directory containing a stack of images.

Other examples

Matlab to Volviewer