Changeset 3965 for trunk/gui


Ignore:
Timestamp:
Sep 28, 2013 9:07:58 PM (11 years ago)
Author:
gah
Message:

update dicom in field.tcl to handle both 2D and 3D data.

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r3964 r3965  
    147147
    148148    private method AvsToVtk { cname contents }
    149     private method DicomSeriesToVtk { cname contents }
     149    private method DicomToVtk { cname contents }
    150150    private method BuildPointsOnMesh { cname }
    151151    private method ConvertToVtkData { cname }
     
    955955                continue;               # Ignore this compoennt
    956956            }
    957             if { ![file isdir $contents] } {
    958                 puts stderr "dicom path \"$contents\" is not a directory."
    959                 return 0
    960             }
    961             set vtkdata [DicomSeriesToVtk $cname $contents]
     957            set vtkdata [DicomToVtk $cname $contents]
    962958            if { $_viewer == "" } {
    963                 set _viewer "nanovis"
     959                set _viewer [expr {($_dim == 3) ? "nanovis" : "contour"}]
    964960            }
    965961            set _comp2vtk($cname) $vtkdata
    966962            set _comp2style($cname) [$_field get $cname.style]
    967             set _dim 3
    968963            incr _counter
    969964        } elseif { $type == "ucd"} {
     
    17361731}
    17371732
    1738 itcl::body Rappture::Field::DicomSeriesToVtk { cname path } {
     1733itcl::body Rappture::Field::DicomToVtk { cname path } {
    17391734    package require vtk
    17401735
     1736    if { ![file exists $path] } {
     1737        puts stderr "path \"$path\" doesn't exist."
     1738        return 0
     1739    }
    17411740    set reader $this-datasetreader
    17421741    vtkDICOMImageReader $reader
    1743 
    1744     set files [glob -nocomplain $path/*.dcm]
    1745     if { [llength $files] == 0 } {
    1746         puts stderr "no dicom files found in \"$path\""
    1747         return 0
    1748     }       
    1749     $reader SetDirectoryName $path
     1742    if { [file isdir $path] } {
     1743        set files [glob -nocomplain $path/*.dcm]
     1744        if { [llength $files] == 0 } {
     1745            puts stderr "no dicom files found in \"$path\""
     1746            return 0
     1747        }       
     1748        $reader SetDirectoryName $path
     1749    } else {
     1750        $reader SetFileName $path
     1751    }
    17501752    $reader Update
    17511753   
     
    17631765        incr _dim
    17641766    }
     1767
    17651768    set _comp2dims($cname) "${_dim}D"
    17661769
  • trunk/gui/scripts/filechoiceentry.tcl

    r3964 r3965  
    305305        }
    306306    }
    307     return $files
     307    return [lsort -dictionary $files]
    308308}
    309309
Note: See TracChangeset for help on using the changeset viewer.