BioTensor Banner Sub http://software.sci.utah.edu/ http://www.sci.utah.edu
1 2 3 4

Chapter 2: The Anatomy of the .app File

Ever PowerApp file should consist of the following:

Output Statement

Reference SCIRUN_DATA and SCIRUN_DATASET

Tcl Net Code

Assigment to mods Array

Auto Index to PowerAppBase.app

PowerApp Class Definition

Instantiate an App

Bind Commands

  • Output Statement such as "Loading BioTensor (this may take a minute)..."
    puts "\nLoading BioTensor (this may take a minute)...\n"
  • References SCIRUN_DATA and SCIRUN_DATASET and checks that these files exist in the net code.
    if {[file exists $DATADIR/$DATASET/demo-DWI.nrrd]} {
        set $m0-filename $DATADIR/$DATASET/demo-DWI.nrrd
    } else {
        set $m0-filename {}
    } 
  • Tcl Net code which is just the normal tcl .net code.
    set m0 [addModuleAtPosition "Teem" "DataIO" "NrrdReader" 14 9]
    set m1 [addModuleAtPosition "Teem" "Unu" "UnuSlice" 603 169]
    set m2 [addModuleAtPosition "Teem" "Tend" "TendEpireg" 14 180]
    set m3 [addModuleAtPosition "Teem" "Tend" "TendEstim" 14 718]
    set m4 [addModuleAtPosition "Teem" "Tend" "TendBmat" 231 181]
    set m5 [addModuleAtPosition "Teem" "Unu" "UnuSlice" 992 516]
    .
    .
    .
    set c0 [addConnection $m119 0 $m40 0]
    set c1 [addConnection $m94 1 $m93 0]
    set c2 [addConnection $m130 1 $m120 0]
    set c3 [addConnection $m67 0 $m73 0]
    set c4 [addConnection $m67 0 $m33 0]
    .
    .
    .
    set $m0-notes {}
    set $m0-label {unknown}
    set $m0-type {Scalar}
    set $m0-axis {axis0}
    set $m0-add {0}
    
  • Assignment of mods array
    global mods
    
    set mods(NrrdReader1) $m0
    set mods(DicomToNrrd1) $m97
    set mods(AnalyzeToNrrd1) $m96
    set mods(ChooseNrrd1) $m45
    set mods(NrrdInfo1) $m62
    
    ### Original Data Stuff
    set mods(UnuSlice1) $m1
    set mods(UnuProject1) $m57
    set mods(ShowField-Orig) $m8
    set mods(ChooseNrrd-ToProcess) $m113
    
    set mods(Viewer) $m44
    
  • Auto index to PowerAppBase.app
    global SCIRUN_SRCDIR
    set auto_index(::PowerAppBase) \
       "source $SCIRUN_SRCDIR/Dataflow/GUI/PowerAppBase.tcl"
    
  • PowerApp Class Definition making sure to inherit from PowerAppBase
    class BioTensorApp {
        inherit ::PowerAppBase
            
        constructor {} {
    .
    .
    .
    
  • Instantiate an App and make sure to build it (usually done with the build_app method)
    BioTensorApp app
    
    app build_app
    
  • Add Bind Commands must be after the creation of the app.
    bind all  {
        app save_session
    }
    
    bind all  {
        app load_session
    }
    
    bind all  {
        app exit_app
    }
    
    bind all  {
        global mods
        $mods(Viewer)-ViewWindow_0-c autoview
    }
    

1 2 3 4

Footer Images