- Timestamp:
- Jun 23, 2014 3:42:45 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r4394 r4417 82 82 # valid data. 83 83 private variable _isValidComponent; # Array of valid components found 84 private variable _alwaysConvertDX 0; 85 84 86 constructor {xmlobj path} { 85 87 # defined below … … 152 154 private method AvsToVtk { cname contents } 153 155 private method DicomToVtk { cname contents } 154 private method DicomToVtk.old { cname contents }155 156 private method BuildPointsOnMesh { cname } 156 157 protected method GetAssociation { cname } … … 930 931 close $f 931 932 } 932 if { $_viewer != "nanovis" && $_viewer != "flowvis" } { 933 if { $_alwaysConvertDX || 934 ($_viewer != "nanovis" && $_viewer != "flowvis") } { 933 935 set _type "vtk" 934 936 set _comp2vtk($cname) $vtkdata … … 1719 1721 } 1720 1722 1721 itcl::body Rappture::Field::DicomToVtk.old { cname path } {1722 package require vtk1723 1724 if { ![file exists $path] } {1725 puts stderr "path \"$path\" doesn't exist."1726 return 01727 }1728 set reader $this-datasetreader1729 vtkDICOMImageReader $reader1730 if { [file isdir $path] } {1731 set files [glob -nocomplain $path/*.dcm]1732 if { [llength $files] == 0 } {1733 puts stderr "no dicom files found in \"$path\""1734 #return 01735 }1736 $reader SetDirectoryName $path1737 } else {1738 $reader SetFileName $path1739 }1740 $reader Update1741 1742 set dataset [$reader GetOutput]1743 set limits {}1744 foreach {xmin xmax ymin ymax zmin zmax} [$dataset GetBounds] break1745 set _dim 01746 if { $xmax > $xmin } {1747 incr _dim1748 }1749 if { $ymax > $ymin } {1750 incr _dim1751 }1752 if { $zmax > $zmin } {1753 incr _dim1754 }1755 1756 set _comp2dims($cname) "${_dim}D"1757 1758 lappend limits x [list $xmin $xmax]1759 lappend limits y [list $ymin $ymax]1760 lappend limits z [list $zmin $zmax]1761 set dataAttrs [$dataset GetPointData]1762 if { $dataAttrs == ""} {1763 puts stderr "WARNING: No point data found in \"$_path\""1764 rename $reader ""1765 return 01766 }1767 set vmin 01768 set vmax 11769 set numArrays [$dataAttrs GetNumberOfArrays]1770 if { $numArrays > 0 } {1771 for {set i 0} {$i < [$dataAttrs GetNumberOfArrays] } {incr i} {1772 set array [$dataAttrs GetArray $i]1773 set fname [$dataAttrs GetArrayName $i]1774 foreach {min max} [$array GetRange -1] break1775 if {$i == 0} {1776 set vmin $min1777 set vmax $max1778 }1779 lappend limits $fname [list $min $max]1780 set _fld2Units($fname) ""1781 set _fld2Label($fname) $fname1782 # Let the VTK file override the <type> designated.1783 set _fld2Components($fname) [$array GetNumberOfComponents]1784 lappend _comp2fldName($cname) $fname1785 }1786 }1787 lappend limits v [list $vmin $vmax]1788 set _comp2limits($cname) $limits1789 1790 set tmpfile $this-$cname.vtk1791 set writer $this-datasetwriter1792 vtkDataSetWriter $writer1793 $writer SetInputConnection [$reader GetOutputPort]1794 $writer SetFileName $tmpfile1795 $writer SetFileTypeToBinary1796 $writer Write1797 rename $reader ""1798 rename $writer ""1799 1800 set f [open "$tmpfile" "r"]1801 fconfigure $f -translation binary -encoding binary1802 set vtkdata [read $f]1803 close $f1804 file delete $tmpfile1805 return $vtkdata1806 }1807 1808 1723 itcl::body Rappture::Field::GetTypeAndSize { cname } { 1809 1724 array set type2components {
Note: See TracChangeset
for help on using the changeset viewer.