Ignore:
Timestamp:
Sep 27, 2013, 1:44:55 PM (11 years ago)
Author:
gah
Message:

fix to dicomtovtk routine to stop retrieving field values.

File:
1 edited

Legend:

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

    r3960 r3964  
    960960            }
    961961            set vtkdata [DicomSeriesToVtk $cname $contents]
    962             ReadVtkDataSet $cname $vtkdata
     962            if { $_viewer == "" } {
     963                set _viewer "nanovis"
     964            }
    963965            set _comp2vtk($cname) $vtkdata
    964966            set _comp2style($cname) [$_field get $cname.style]
     967            set _dim 3
    965968            incr _counter
    966             if { $_viewer == "" } {
    967                 set _viewer "nanovis"
    968             }
    969969        } elseif { $type == "ucd"} {
    970970            set contents [$_field get $cname.ucd]
     
    13791379        foreach {vmin vmax} [$array GetRange -1] break
    13801380
    1381         set numTuples [$array GetNumberOfTuples]
     1381
     1382        if 0  {
    13821383        for { set i 0 } { $i < $numTuples } { incr i } {
    13831384            $vector append [$array GetComponent $i 0]
     1385        }
    13841386        }
    13851387        for {set i 0} {$i < [$dataAttrs GetNumberOfArrays] } {incr i} {
     
    17471749    $reader SetDirectoryName $path
    17481750    $reader Update
     1751   
     1752    set dataset [$reader GetOutput]
     1753    set limits {}
     1754    foreach {xmin xmax ymin ymax zmin zmax} [$dataset GetBounds] break
     1755    set _dim 0
     1756    if { $xmax > $xmin } {
     1757        incr _dim
     1758    }
     1759    if { $ymax > $ymin } {
     1760        incr _dim
     1761    }
     1762    if { $zmax > $zmin } {
     1763        incr _dim
     1764    }
     1765    set _comp2dims($cname) "${_dim}D"
     1766
     1767    lappend limits x [list $xmin $xmax]
     1768    lappend limits y [list $ymin $ymax]
     1769    lappend limits z [list $zmin $zmax]
     1770    set dataAttrs [$dataset GetPointData]
     1771    if { $dataAttrs == ""} {
     1772        puts stderr "WARNING: no point data found in \"$_path\""
     1773        rename $reader ""
     1774        return 0
     1775    }
     1776    set vmin 0
     1777    set vmax 1
     1778    set numArrays [$dataAttrs GetNumberOfArrays]
     1779    if { $numArrays > 0 } {
     1780        set array [$dataAttrs GetArray 0]
     1781        # Calling GetRange with component set to -1 will return
     1782        # either the scalar range or vector magnitude range
     1783        foreach {vmin vmax} [$array GetRange -1] break
     1784        for {set i 0} {$i < [$dataAttrs GetNumberOfArrays] } {incr i} {
     1785            set array [$dataAttrs GetArray $i]
     1786            set fname  [$dataAttrs GetArrayName $i]
     1787            foreach {min max} [$array GetRange -1] break
     1788            lappend limits $fname [list $min $max]
     1789            set _fld2Units($fname) ""
     1790            set _fld2Label($fname) $fname
     1791            # Let the VTK file override the <type> designated.
     1792            set _fld2Components($fname) [$array GetNumberOfComponents]
     1793            lappend _comp2fldName($cname) $fname
     1794        }
     1795    }
     1796    lappend limits v [list $vmin $vmax]
     1797    set _comp2limits($cname) $limits
    17491798
    17501799    set tmpfile $cname[pid].vtk
     
    17531802    $writer SetInputConnection [$reader GetOutputPort]
    17541803    $writer SetFileName $tmpfile
     1804    $writer SetFileTypeToBinary
    17551805    $writer Write
    17561806    rename $reader ""
     
    17611811    set vtkdata [read $f]
    17621812    close $f
    1763     #file delete $tmpfile
     1813    file delete $tmpfile
    17641814    return $vtkdata
    17651815}
Note: See TracChangeset for help on using the changeset viewer.