Ignore:
Timestamp:
Feb 26, 2014 11:08:22 AM (10 years ago)
Author:
ldelgass
Message:

VTK volume viewer fixes. Still needs work for multiple components vs. multiple
fields.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/vtkvolumeviewer.tcl

    r4193 r4194  
    250250        -axislabelsvisible              1
    251251        -background                     black
    252         -cutplaneedgesvisible           0
    253252        -cutplanelighting               1
    254253        -cutplaneopacity                100
    255254        -cutplanesvisible               0
    256         -cutplanewireframe              0
    257255        -legendvisible                  1
    258256        -volumeambient                  40
     
    13731371    }
    13741372    switch -- $what {
     1373        "-current" {
     1374            set cname [$itk_component(volcomponents) value]
     1375            SwitchComponent $cname
     1376        }
    13751377        "-background" {
    13761378            set bgcolor [$itk_component(background) value]
     
    14381440        }
    14391441        "-volumeambient" {
     1442            # Other parts of the code use the -volumeambient setting to
     1443            # tell if the component settings have been initialized
     1444            if { ![info exists _settings($_current${what})] } {
     1445                InitComponentSettings $_current
     1446            }
    14401447            set val $_settings(${what})
    14411448            set _settings($_current${what}) $val
     
    15031510            set _settings(${what}) $mode
    15041511            SendCmd "axis flymode $mode"
    1505         }
    1506         "-cutplaneedgesvisible" {
    1507             set bool $_settings(${what})
    1508             foreach dataset [CurrentDatasets -visible] {
    1509                 if {$_cutplaneCmd != "imgcutplane"} {
    1510                     SendCmd "$_cutplaneCmd edges $bool $dataset"
    1511                 }
    1512             }
    1513         }
    1514         "-cutplanewireframe" {
    1515             set bool $_settings(${what})
    1516             foreach dataset [CurrentDatasets -visible] {
    1517                 if {$_cutplaneCmd != "imgcutplane"} {
    1518                     SendCmd "$_cutplaneCmd wireframe $bool $dataset"
    1519                 }
    1520             }
    15211512        }
    15221513        "-cutplanesvisible" {
     
    19131904    checkbutton $inner.labels \
    19141905        -text "Show Axis Labels" \
    1915         -variable [itcl::scope _settings(-axislabelsvisiboe)] \
     1906        -variable [itcl::scope _settings(-axislabelsvisible)] \
    19161907        -command [itcl::code $this AdjustSetting -axislabelsvisible] \
    19171908        -font "Arial 9"
     
    20242015        -font "Arial 9"
    20252016
    2026     checkbutton $inner.wireframe \
    2027         -text "Show Wireframe" \
    2028         -variable [itcl::scope _settings(-cutplanewireframe)] \
    2029         -command [itcl::code $this AdjustSetting -cutplanewireframe] \
    2030         -font "Arial 9"
    2031 
    20322017    checkbutton $inner.lighting \
    20332018        -text "Enable Lighting" \
    20342019        -variable [itcl::scope _settings(-cutplanelighting)] \
    20352020        -command [itcl::code $this AdjustSetting -cutplanelighting] \
    2036         -font "Arial 9"
    2037 
    2038     checkbutton $inner.edges \
    2039         -text "Show Edges" \
    2040         -variable [itcl::scope _settings(-cutplaneedgesvisible)] \
    2041         -command [itcl::code $this AdjustSetting -cutplaneedgesvisible] \
    20422021        -font "Arial 9"
    20432022
     
    21362115        0,0 $inner.visible              -anchor w -pady 2 -cspan 4 \
    21372116        1,0 $inner.lighting             -anchor w -pady 2 -cspan 4 \
    2138         2,0 $inner.wireframe            -anchor w -pady 2 -cspan 4 \
    2139         3,0 $inner.edges                -anchor w -pady 2 -cspan 4 \
    2140         4,0 $inner.opacity_l            -anchor w -pady 2 -cspan 3 \
    2141         5,0 $inner.opacity              -fill x   -pady 2 -cspan 3 \
    2142         6,0 $itk_component(xCutButton)  -anchor e -padx 2 -pady 2 \
    2143         7,0 $itk_component(xCutScale)   -fill y \
    2144         6,1 $itk_component(yCutButton)  -anchor e -padx 2 -pady 2 \
    2145         7,1 $itk_component(yCutScale)   -fill y \
    2146         6,2 $itk_component(zCutButton)  -anchor e -padx 2 -pady 2 \
    2147         7,2 $itk_component(zCutScale)   -fill y \
     2117        2,0 $inner.opacity_l            -anchor w -pady 2 -cspan 3 \
     2118        3,0 $inner.opacity              -fill x   -pady 2 -cspan 3 \
     2119        4,0 $itk_component(xCutButton)  -anchor e -padx 2 -pady 2 \
     2120        5,0 $itk_component(xCutScale)   -fill y \
     2121        4,1 $itk_component(yCutButton)  -anchor e -padx 2 -pady 2 \
     2122        5,1 $itk_component(yCutScale)   -fill y \
     2123        4,2 $itk_component(zCutButton)  -anchor e -padx 2 -pady 2 \
     2124        5,2 $itk_component(zCutScale)   -fill y \
    21482125
    21492126    blt::table configure $inner r* c* -resize none
    2150     blt::table configure $inner r7 c3 -resize expand
     2127    blt::table configure $inner r5 c3 -resize expand
    21512128}
    21522129
     
    22592236        -color BCGYR
    22602237        -volumelighting         1
    2261         -volumelinewidth        1.0
    22622238        -volumeoutline          0
    22632239        -volumevisible          1
    2264     }
    2265     if { $dataobj != $_first } {
    2266         set style(-opacity) 1
    22672240    }
    22682241    array set styles [$dataobj style $cname]
     
    26752648            -color BCGYR
    26762649            -levels 6
    2677             -opacity 1.0
    26782650            -markers ""
    26792651        }
     
    26852657        }
    26862658        set _settings($cname-color) $styles(-color)
    2687         set _settings($cname-volumeopacity) $styles(-opacity)
    26882659        set cmap [ColorsToColormap $styles(-color)]
    26892660        set _cname2defaultcolormap($cname) $cmap
     
    27892760    array set _settings [subst {
    27902761        $cname-color                    default
    2791         $cname-light2side               1
    2792         $cname-volumeoutline            0
    27932762        $cname-volumeambient            40
    27942763        $cname-volumeblendmode          composite
    27952764        $cname-volumediffuse            60
     2765        $cname-volumelight2side         1
    27962766        $cname-volumelighting           1
    27972767        $cname-volumeopacity            50
     2768        $cname-volumeoutline            0
    27982769        $cname-volumequality            80
    27992770        $cname-volumespecularexponent   90
     
    28172788    # _settings variables change widgets, except for colormap
    28182789    foreach name {
    2819         -volumelight2side             
    2820         -volumeoutline                 
    2821         -volumeambient           
    2822         -volumeblendmode         
    2823         -volumediffuse           
    2824         -volumelighting         
    2825         -volumeopacity           
    2826         -volumequality           
    2827         -volumespecularexponent 
    2828         -volumespecularlevel     
    2829         -volumethickness         
    2830         -volumevisible           
     2790        -volumeambient
     2791        -volumeblendmode
     2792        -volumediffuse
     2793        -volumelight2side
     2794        -volumelighting
     2795        -volumeopacity
     2796        -volumeoutline
     2797        -volumequality
     2798        -volumespecularexponent
     2799        -volumespecularlevel
     2800        -volumethickness
     2801        -volumevisible
    28312802    } {
    2832         set _settings($name) $_settings(${cname}-${name})
     2803        set _settings($name) $_settings(${cname}${name})
    28332804    }
    28342805    $itk_component(colormap) value        $_settings($cname-color)
     
    28432814        InitComponentSettings $cname
    28442815    }
    2845     set max 1.0 ;                       #$_settings($tag-opacity)
    28462816
    28472817    set isovalues [$_transferFunctionEditors($cname) values]
    28482818
    2849     # Ensure that the global opacity and thickness settings (in the slider
    2850     # settings widgets) are used for the active transfer-function.  Update
    2851     # the values in the _settings varible.
    2852     set opacity [expr { double($_settings($cname-volumeopacity)) * 0.01 }]
    2853 
     2819    # Currently using volume opacity to scale opacity in
     2820    # the volume shader. The transfer function always sets full
     2821    # opacity
     2822    set max 1.0;
     2823
     2824    # Use the component-wise thickness setting from the slider
     2825    # settings widget
    28542826    # Scale values between 0.00001 and 0.01000
    28552827    set delta [expr {double($_settings($cname-volumethickness)) * 0.0001}]
Note: See TracChangeset for help on using the changeset viewer.