⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 randomimage.tcl

📁 InsightToolkit-1.4.0(有大量的优化算法程序)
💻 TCL
字号:
# Require ITK package.
package require InsightToolkit
package require itkinteraction

# Initial sigma value.
set sigma 1

# Create a random image source.
set source [itk::create RandomImageSourceUS2]
$source SetMin 0
$source SetMax 255
$source SetSize {300 300}

# Connect the smoothing filter.
set filter [itk::create RecursiveGaussianImageFilterUS2]
$filter SetInput [$source GetOutput] 
$filter SetSigma $sigma
$filter SetNormalizeAcrossScale 1
$filter SetDirection 0

# Setup the GUI.
frame .control
frame .in
frame .out
frame .in.viewer
frame .out.viewer

button .control.exit -text "Exit" -command {exit}
button .control.update -text "Update" -command {
  # Set sigma on the smoothing filter and update the display.
  $filter SetSigma $sigma
  $smoothedV Draw
  $randomV Draw
}
label .control.sigma_label -text "Sigma:" 
entry .control.sigma -textvariable sigma
button .control.interact -text "Interact" -command {wm deiconify .itkInteract}

pack .control -side left -anchor n
pack .in .out -side left -expand 1 -fill both
pack .in.viewer .out.viewer -expand 1 -fill both
pack .control.exit .control.interact .control.update -side top
pack .control.sigma_label .control.sigma -side left

# Create the image viewers.
set randomV [itk::createImageViewer2D .in.viewer [$source GetOutput] ]
set smoothedV [itk::createImageViewer2D .out.viewer [$filter GetOutput] ]

# Run the input pipeline to display the random image.
update
$randomV Draw

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -