-//description "Example of the box <a href=#Viewer2D>Viewer2D</a>."
-author "jpr@creatis.univ-lyon1.fr"
-category "tool, writer"
+description "Reads and image file / stack of image files, writes it as a MHD file"
+author "jpr@creatis.insa-lyon.fr"
+category "tool, read/write"
load vtk
-include wxvtk
+//include wxvtk
load std
load itk
include vtk
include wx
load itkvtk
-load creaImageIO
+new LayoutLine main
+# use Gimmick to select
+# ----------------------
+
+load creaImageIO
new Gimmick reader
-new FileSelector fs
- set fs.OpenSave "Save"
+new CommandButton cb1
+ connect cb1.Widget main.Widget1
+ set cb1.Label "1) Select File"
+ set cb1.WinDialog true
+
+connect cb1.BoxChange reader.BoxExecute
+
+new CommandButton cb
+ connect cb.Widget main.Widget2
+ set cb.Label "2) Write (no '.mhd' extention needed!"
+ set cb.WinDialog true
+
+# Choose where you want to write
+# ------------------------------
+new FileSelector fileDialog
+ set fileDialog.OpenSave Save
+ set fileDialog.Wildcard "*.mhd"
+new MakeFileName mfn
+ connect fileDialog.Out mfn.File
+ set mfn.Extent ".mhd"
+
+# Write!
+# ------
+
new MetaImageWriter writer
- connect reader.Out writer.In
- connect fs.Out writer.Filename
+ connect reader.Out writer.In
+ connect mfn.Out writer.Filename
+ connect cb.BoxChange writer.BoxExecute
+
+exec main
-exec reader
-exec writer