]> Creatis software - bbtk.git/blob - packages/demo/bbs/appli/SaveAsMhd.bbs
9d96a5ae5d0ed448ab45e851d99cf01f5e6d20f1
[bbtk.git] / packages / demo / bbs / appli / SaveAsMhd.bbs
1 description "Reads and image file /  stack of image files, writes it as a MHD file"
2 author "jpr@creatis.insa-lyon.fr"
3 category "tool, read/write"
4
5 load vtk
6 //include wxvtk
7 load std
8 load itk
9 include vtk
10 include wx
11 load itkvtk
12
13 new LayoutLine  main
14
15 #  use Gimmick to select 
16 # ----------------------
17
18 load creaImageIO
19 new Gimmick reader
20
21 new CommandButton cb1
22    connect cb1.Widget main.Widget1
23    set cb1.Label "1) Select File"
24    set cb1.WinDialog true
25
26 connect cb1.BoxChange reader.BoxExecute
27    
28 new CommandButton cb
29    connect cb.Widget main.Widget2
30    set cb.Label "2) Write (no '.mhd' extention needed!"
31    set cb.WinDialog true
32
33 # Choose where you want to write
34 # ------------------------------
35 new FileSelector fileDialog
36   set fileDialog.OpenSave Save
37   set fileDialog.Wildcard "*.mhd"
38   
39 new  MakeFileName mfn
40    connect fileDialog.Out mfn.File
41    set mfn.Extent ".mhd"
42     
43 # Write!
44 # ------
45    
46 new MetaImageWriter writer
47   connect reader.Out writer.In 
48   connect mfn.Out writer.Filename
49   connect cb.BoxChange writer.BoxExecute
50    
51 exec main
52