Personal tools
  • Help

jist:CommandLineInterface

From NITRC Wiki

Jump to: navigation, search

Contents

JIST Command Line Interface

Setup

Which Java?

  • We strongly suggest using the java JRE (run time environment) that is included with mipav.
  • To access this java binary, locate your mipav install directory and the "jre/bin" folder within this directory.

Java Classpath etc.

  • To access the JIST framework from the command line, you must include both your base install mipav directory as well as your plugins directory on the command line.
  • Additionally, you must specify the classpath to include the platform specific library which ship with MIPAV. These are generally located in mipav/lib and mipav/lib/jaxp directories.
  • You can determine the precise classpath at runtime by looking in the Help->JVM Information tab of MIPAV.

Aliasing

  • All of the commands below interpret mipavjava as an alias to access the correct java version, classpath, and extdirs. On ubuntu w/ bash, this may be accomplished with:
alias mipavjava="/home/bennett/mipav-4.3.0/jre/bin/java -classpath /home/bennett/mipav/plugins/:/home/bennett/mipav-4.3.0/:`find /home/bennett/mipav-4.3.0/ -name \*.jar | sed 's#/home/bennett/mipav-4.3.0/#:/home/bennett/mipav-4.3.0/#' | tr -d '\n' | sed 's/^://'`"
  • Note: The mipav install directory is: /home/bennett/mipav-4.3.0/
  • Note: The user's plugin directory is: /home/bennett/mipav/plugins/
  • You may test to see if your alias is properly configured by launching mipav with
mipavjava MipavMain
  • This launch of Mipav should behave identically to a copy that you launch with the default shortcut / icon.

Discovering Modules

  • Run the discover tool to find out what modules are installed: mipavjava edu.jhu.ece.iacl.jist.cli.discover
bennett@majors:~/mipav-4.3.0$ mipavjava edu.jhu.ece.iacl.jist.cli.discover
edu.jhu.ece.iacl.jist.cli.discover -h : print this message
edu.jhu.ece.iacl.jist.cli.discover [classpath to search]

Search the provided classpath for classes that extend ProcessingAlgorithm.
Results are provided in a two column tab delimited format
The left column is the human readable name. The left column is the full class name.
The full path name may be passed to edu.jhu.ece.iacl.jist.cli.run to describe
command line parameters or run via the command line.

Java Image Science Toolkit (JIST) Command Line Interface v0.1
  • Here is a partial list of modules available on my system:
bennett@majors:~/mipav-4.3.0$ mipavjava edu.jhu.ece.iacl.jist.cli.discover /home/bennett/mipav/plugins
Demo2: Generate Random Volumes                  edu.jhu.bme.smile.demo.RandomVol
Image Arithmetic                                edu.jhu.bme.smile.demo.ImageArithmetic
Demo 1: Int->Int                                edu.jhu.bme.smile.demo.FirstPluginTest
staple                                          edu.jhu.bme.smile.demo.SmileAlgorithmDemo
Chebyshev Fitting                               edu.jhu.bme.smile.demo.ChebyShevFitting
Demo4: Scale input image                        edu.jhu.bme.smile.demo.ScaleImageDemo
Adding Noise                                    edu.jhu.bme.smile.demo.AddingNoise
Demo3: Image Algebra                            edu.jhu.bme.smile.demo.ImageAlgebra
Create Tesselated Surface                       edu.jhu.ece.iacl.pami.CreateTesselatedSurface
Crop Volume                                     edu.jhu.ece.iacl.pami.CropVolume
Generate Tensors                                edu.jhu.ece.iacl.pami.GenerateTensors
SimFramework                                    edu.jhu.ece.iacl.pami.SimFramework
Create Mask                                     edu.jhu.ece.iacl.pami.CreateMask
Create a Crossing Fiber Pattern                 edu.jhu.ece.iacl.pami.CreateCrossingFiber
Divide by Reference                             edu.jhu.ece.iacl.pami.DivideReference
4Dto3D                                          edu.jhu.bme.smile.plugins.nia.NIA4Dto3dFileCollection
OARLinearRegistration1.1.1.1                    edu.jhu.ece.iacl.plugins.registration.MedicAlgorithmFLIRTCollection
const_flirt                                     edu.jhu.ece.iacl.plugins.registration.MedicAlgorithmConstrainedFLIRT
FileColReg                                      edu.jhu.ece.iacl.plugins.registration.MedicAlgorithmEfficientFileCollectionRegistration
trans_vol                                       edu.jhu.ece.iacl.plugins.registration.MedicAlgorithmTransformVolume
FMLabelExtension                                edu.jhu.ece.iacl.plugins.labeling.MedicAlgorithmFMLabelExtension
Grad->Surface                                   edu.jhu.ece.iacl.plugins.hardi.GradToSurf
Unique Directions                               edu.jhu.ece.iacl.plugins.hardi.SelectUniqueDiffusionDirections
Normalize Magnitude                             edu.jhu.ece.iacl.plugins.hardi.NormalizeToUnitMagnitude
Surface->Grad                                   edu.jhu.ece.iacl.plugins.hardi.SurfToGrad
Q-Ball: SH Projection                           edu.jhu.ece.iacl.plugins.hardi.QBallProjection
...
  • Alternatively, you can find the full classname of a particular module from the mini-pane (either from the plugin selector or layout tool).
  • Click on "view" for algorithm information

Image:Cli-0.png

  • See the "class" field

Image:Cli-1.png


Running Modules

Determine Calling Structure

  • Once you have a full classname for a module, you can verify that it is installed properly and query its arguments with the edu.jhu.ece.iacl.jist.cli.run command.
  • For example, we can see how to call the random volume module:
bennett@majors:~/mipav-4.3.0$ mipavjava edu.jhu.ece.iacl.jist.cli.run edu.jhu.bme.smile.demo.RandomVol --help
usage: edu.jhu.bme.smile.demo.RandomVol [-h] [-inField <arg>] [-inLambda
       <arg>] [-inMaximum <arg>] [-inMinimum <arg>] [-inSize <arg>]
       [-inSize2 <arg>] [-inSize3 <arg>] [-inSize4 <arg>] [-inStandard
       <arg>] [-outExecution] [-outRand1] [-xDir <arg>] [-xFile <arg>]

RandomVolumeGenerator 1.7  unk
Generate three random scalar volumes.
 -h,--help           Print this message.
 -inField <arg>      Field [option:Uniform|Normal|Exponential]
                     (default=Uniform)
 -inLambda <arg>     Lambda Value for Exponential Distribution [float]
                     (default=5.0)
 -inMaximum <arg>    Maximum Value [integer] (default=1)
 -inMinimum <arg>    Minimum Value [integer] (default=0)
 -inSize <arg>       Size of Volume in X direction [integer] (default=100)
 -inSize2 <arg>      Size of Volume in Y direction [integer] (default=100)
 -inSize3 <arg>      Size of Volume in Z direction [integer] (default=20)
 -inSize4 <arg>      Size of Volume in t direction [integer] (default=1)
 -inStandard <arg>   Standard Deviation for Normal Distribution [integer]
                     (default=1)
 -outExecution       Execution Time [string]
 -outRand1           Rand1 [file]
 -xDir <arg>         Request Output: Processing Directory (default
                     current) [directory] (optional)
 -xFile <arg>        Request Output: Results File (default output.txt)
                     [file] (optional)

Provided by: JIST (Java Image Science Toolkit) Command Line Interface v0.1
http://www.nitrc.org/projects/jist/

Running a Module

  • You must specify all required input arguments on the command line. Any argument with a "default" tag that is not specified will use the default value.
  • By default, not all output arguments may be processed / created. To force an output to be generated, be sure to specify the appropriate -out flag.
  • Note that there are two special arguments.
    • -xDir specifies the processing directory for the JIST tree
    • -xFile specifies the java properties file to receive all non-File (e.g., float, integer, etc.) outputs.
  • Here is an exampling running the random volume generator with default arguments:
bennett@majors:~/mipav-4.3.0$ mipavjava edu.jhu.ece.iacl.jist.cli.run edu.jhu.bme.smile.demo.RandomVol -xDir ~/temp/temp12/
####################################################################
Initializing MIPAV/JIST Framework
MipavViewUserInterface: Starting MIPAV with forceQuiet=true
MIPAV STARTED with forceQuite set as true
MipavViewUserInterface: Created MIPAV with forceQuiet=true
####################################################################
Interpretting command line arguments
####################################################################
edu.jhu.bme.smile.demo.RandomVol
        outExecution = <default> = 
        inSize4 = <default> = 1
        inStandard = <default> = 1
        inSize3 = <default> = 20
        inSize2 = <default> = 100
        inField = <default> = Uniform
        inMaximum = <default> = 1
        inMinimum = <default> = 0
        outRand1 = <default> = None
        inLambda = <default> = 5
        inSize = <default> = 100
        outProc = /home/bennett/temp/temp12/
        outResult = output.txt
####################################################################

...

*****************************************************
* Warning: Creating Model Image with Default Header *
*****************************************************
FINISHED
Calculation Monitor not running. Punting stop.
---------- Performance Summary ----------
1) Algorithm Calculation -- ELAPSED TIME: Actual: 0.11 sec / CPU: 0.12 sec

TOTAL ELAPSED TIME: Actual: 0.11 sec / CPU: 0.12 sec
MEMORY: Used 14 MB, Free 104 MB, Total 118 MB
Refresher finished.
FileReaderWriter: write file:temp12
Wrote Volume: /home/bennett/temp/temp12/Normal+Noise.xml
####################################################################
Done: edu.jhu.bme.smile.demo.RandomVol
####################################################################

Running Layouts

"Complete Layouts"

  • Complete layout files are files that do not use any "externalize" sources or destinations. These layouts will run "as is" from the JIST layout tool.
  • You can determine if a layout is a complete layout by running edu.jhu.ece.iacl.jist.cli.runLayout with the classname and the --help argument.
bennett@majors:~/temp/temp10$ mipavjava edu.jhu.ece.iacl.jist.cli.runLayout CATNAP-PARv3.layout --help
usage: layoutfile [-h] [-outExecution] [-xClean] [-xDir <arg>] [-xFile
       <arg>]

JIST Adapter  unk
null
 -h,--help       Print this message.
 -outExecution   Execution Time [string]
 -xClean         Remove all previously generated results in the output
                 directory
 -xDir <arg>     Request Output: Processing Directory (default current)
                 [directory] (optional)
 -xFile <arg>    Request Output: Results File (default output.txt) [file]
                 (optional)

Provided by: JIST (Java Image Science Toolkit) Command Line Interface v0.1
http://www.nitrc.org/projects/jist/
  • This layout is complete because there are no -in arguments and no required -out arguments.
  • To run this layout and remove any results that are already processed use:
bennett@majors:~/temp/temp10$ mipavjava edu.jhu.ece.iacl.jist.cli.runLayout CATNAP-PARv3.layout -xClean
####################################################################
Initializing MIPAV/JIST Framework
MipavViewUserInterface: Starting MIPAV with forceQuiet=true
MIPAV STARTED with forceQuite set as true
Warning: Starting options file cannot be found.  Check path and filename.
MipavViewUserInterface: Created MIPAV with forceQuiet=true
####################################################################
Interpretting command line arguments
####################################################################
CATNAP-PARv3
        outExecution = <default> = 
        outProc = /home/bennett/temp/temp10
        outResult = output.txt
####################################################################

...

exp-0000-ABAAAAA: Run in same process: /home/bennett/temp/temp10/exp-0000/exp-0000-ABAAAAA.input
ExecutionContext finished naturally.
PipeScheduler finished naturally.
PipeScheduler stop interrupted.
ProcessManager stopping via interrupt.
PipeScheduler : Already stopped.
####################################################################
Done: CATNAP-PARv3.layout
SUCCESS
####################################################################

"Layouts as Scripts"

  • It is possible to pass options into layouts and retrieve specific outputs from a layout on the command line.
  • To tell the system that a "pin" should be available on the command line, use an "externalize" source or destination. These sources/destinations are in special folders on the menu bar.
  • When you probe a layout that uses "externalize" from the command line with -h, inputs will appears as options with -in and output options will be prefixed with -out.
  • If you specify a default value for the externalized parameter, then the parameter will be optional on the command line. If you do not specify a default value, then the parameter will be required.
CURRENT SUPPORT FOR SCRIPTABLE LAYOUTS IS PRELIMINARY. A number of datatypes cannot 
currently be passed via externalized. We are working to resolve this issues at the 
present time and expect a fully functional version shortly. (August 2009)
Powered by MediaWiki
  • This page was last modified 20:06, 10 August 2009.
  • This page has been accessed 3,578 times.
  •