#  extract ExamineRT render parameters from a .exm file
# the proc just processes all uniform scalar fields
proc amira_exex {{outfile ""}} {

    if {$outfile==""} { 
	global AMIRA_ROOT
	set outfile $AMIRA_ROOT/share/resources/lookup-render-defaults.hx
    }
    
    set f [open $outfile a]
    
    foreach data [all HxUniformScalarField3] { 
	set pname [$data parameters DICOM All G0010-0010 getValue]
	set pname [string range $pname [expr [string first ":" $pname] +1] end]
	set cmap [$data parameters Colormap getValue]
	set wl2min [lindex [$data parameters  DataWindow getValue] 0]
	set wl2max [lindex [$data parameters  DataWindow getValue] 1]
	set wl3min [lindex [$data parameters  ColormapWindow getValue] 0]
	set wl3max [lindex [$data parameters  ColormapWindow getValue] 1]
	set hires [lindex [$data parameters  NumSlices getValue] 0]
	set lores [lindex [$data parameters  NumSlices getValue] 1]
	set lores [expr $lores / $hires]
	set r [list Examine setRenderDefaults $pname $cmap $wl2min $wl2max $wl3min $wl3max $hires $lores]
	echo $r
	puts $f $r
    }
    
    close $f
}

#  extract ExamineRT render parameters from a .exm file
# the proc just processes all uniform scalar fields
proc exex {{outfile ""}} {

    if {$outfile==""} { 
	global AMIRA_ROOT
	set outfile $AMIRA_ROOT/share/resources/lookup-render-defaults.hx
    }
    
    set f [open $outfile a]
    set pname "unknown "
    set cmap  "organic"
    set wl2min [lindex [Examine setDataWindow2D] 0]
    set wl2max [lindex [Examine setDataWindow2D] 1]
    set wl3min [lindex [Examine setDataWindow3D] 0]
    set wl3max [lindex [Examine setDataWindow3D] 1]
    set hires [lindex [Examine setNumSlices] 0]
    set lores [lindex [Examine setNumSlices] 1]
    set lores [expr $lores / $hires]
    set r [list Examine setRenderDefaults $pname $cmap $wl2min $wl2max $wl3min $wl3max $hires $lores]
    echo $r
    puts $f $r
    close $f
}