Changeset 4083 for trunk/gui


Ignore:
Timestamp:
Dec 17, 2013 12:20:28 PM (10 years ago)
Author:
ldelgass
Message:

Use image cutplanes (3D texture reslicing) in VTK volume viewer (requires
uniform grid).

File:
1 edited

Legend:

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

    r4075 r4083  
    167167    private variable _curFldName ""
    168168    private variable _curFldLabel ""
    169     private variable _colorMode "scalar";#  Mode of colormap (vmag or scalar)
     169    private variable _cutplaneCmd "imgcutplane"
    170170}
    171171
     
    14561456            set bool $_settings($what)
    14571457            foreach dataset [CurrentDatasets -visible] {
    1458                 SendCmd "cutplane edges $bool $dataset"
     1458                if {$_cutplaneCmd != "imgcutplane"} {
     1459                    SendCmd "$_cutplaneCmd edges $bool $dataset"
     1460                }
     1461            }
     1462        }
     1463        "cutplaneWireframe" {
     1464            set bool $_settings($what)
     1465            foreach dataset [CurrentDatasets -visible] {
     1466                if {$_cutplaneCmd != "imgcutplane"} {
     1467                    SendCmd "$_cutplaneCmd wireframe $bool $dataset"
     1468                }
    14591469            }
    14601470        }
     
    14621472            set bool $_settings($what)
    14631473            foreach dataset [CurrentDatasets -visible] {
    1464                 SendCmd "cutplane visible $bool $dataset"
    1465             }
    1466         }
    1467         "cutplaneWireframe" {
    1468             set bool $_settings($what)
    1469             foreach dataset [CurrentDatasets -visible] {
    1470                 SendCmd "cutplane wireframe $bool $dataset"
     1474                SendCmd "$_cutplaneCmd visible $bool $dataset"
    14711475            }
    14721476        }
     
    14741478            set bool $_settings($what)
    14751479            foreach dataset [CurrentDatasets -visible] {
    1476                 SendCmd "cutplane lighting $bool $dataset"
     1480                if {$_cutplaneCmd != "imgcutplane"} {
     1481                    SendCmd "$_cutplaneCmd lighting $bool $dataset"
     1482                } else {
     1483                    if {$bool} {
     1484                        set ambient 0.0
     1485                        set diffuse 1.0
     1486                    } else {
     1487                        set ambient 1.0
     1488                        set diffuse 0.0
     1489                    }
     1490                    SendCmd "imgcutplane material $ambient $diffuse $dataset"
     1491                }
    14771492            }
    14781493        }
     
    14811496            set sval [expr { 0.01 * double($val) }]
    14821497            foreach dataset [CurrentDatasets -visible] {
    1483                 SendCmd "cutplane opacity $sval $dataset"
     1498                SendCmd "$_cutplaneCmd opacity $sval $dataset"
    14841499            }
    14851500        }
     
    14951510            }
    14961511            foreach dataset [CurrentDatasets -visible] {
    1497                 SendCmd "cutplane axis $axis $bool $dataset"
     1512                SendCmd "$_cutplaneCmd axis $axis $bool $dataset"
    14981513            }
    14991514        }
     
    15021517            set pos [expr $_settings($what) * 0.01]
    15031518            foreach dataset [CurrentDatasets -visible] {
    1504                 SendCmd "cutplane slice ${axis} ${pos} $dataset"
     1519                SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset"
    15051520            }
    15061521            set _cutplanePending 0
     
    15261541                    puts stderr "Can't use a vector field in a volume"
    15271542                    return
    1528                 } else {
    1529                     set _colorMode scalar
    15301543                }
    15311544                set _curFldName $fname
     
    15361549            }
    15371550            foreach dataset [CurrentDatasets -visible $_first] {
    1538                 #SendCmd "volume colormode $_colorMode ${fname} $dataset"
    1539                 SendCmd "cutplane colormode $_colorMode ${fname} $dataset"
     1551                SendCmd "dataset scalar $_curFldName $dataset"
    15401552            }
    15411553            SendCmd "camera reset"
     
    15681580        if { [info exists _dataset2style($dataset)] } {
    15691581            SendCmdNoWait \
    1570                 "legend $_dataset2style($dataset) $_colorMode $_curFldName {} $w $h 0"
     1582                "legend $_dataset2style($dataset) scalar $_curFldName {} $w $h 0"
    15711583            break;
    15721584        }
     
    21382150    array set settings $style
    21392151    SendCmd "volume add $tag"
    2140     SendCmd "cutplane add $tag"
    2141     SendCmd "cutplane visible 0 $tag"
     2152    SendCmd "$_cutplaneCmd add $tag"
     2153    SendCmd "$_cutplaneCmd visible 0 $tag"
    21422154    SendCmd "volume lighting $settings(-lighting) $tag"
    21432155    set _settings(volumeLighting) $settings(-lighting)
    21442156    SetInitialTransferFunction $dataobj $cname
    21452157    SendCmd "volume colormap $cname $tag"
    2146     SendCmd "cutplane colormap $cname-opaque $tag"
     2158    SendCmd "$_cutplaneCmd colormap $cname-opaque $tag"
    21472159}
    21482160
Note: See TracChangeset for help on using the changeset viewer.