]> Creatis software - bbtk.git/blob - packages/wxvtk/bbs/old/bbBasicImageApplication.bbs
Feature #1774
[bbtk.git] / packages / wxvtk / bbs / old / bbBasicImageApplication.bbs
1  # ---------------------------------------------------------------------
2  #
3  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4  #                        pour la SantÈ)
5  # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6  # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7  # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8  #
9  #  This software is governed by the CeCILL-B license under French law and
10  #  abiding by the rules of distribution of free software. You can  use,
11  #  modify and/ or redistribute the software under the terms of the CeCILL-B
12  #  license as circulated by CEA, CNRS and INRIA at the following URL
13  #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14  #  or in the file LICENSE.txt.
15  #
16  #  As a counterpart to the access to the source code and  rights to copy,
17  #  modify and redistribute granted by the license, users are provided only
18  #  with a limited warranty  and the software's author,  the holder of the
19  #  economic rights,  and the successive licensors  have only  limited
20  #  liability.
21  #
22  #  The fact that you are presently reading this means that you have had
23  #  knowledge of the CeCILL-B license and that you accept its terms.
24  # ------------------------------------------------------------------------ */
25
26
27 //
28 // --------------------------
29 // TODO : Check if is works! (was in packages/wxvtk/bbs/old)
30 //
31
32 include wxvtk/boxes/bbDoubleSlicer
33 load wx
34 load std
35 load itk
36 load itkvtk 
37 load vtk
38
39
40 define BasicImageApplication
41
42 ##
43   description "Interface of a 'standard' image application. Displays two images : before/after processing; Offers buttons : open/parameters/run/save/quit. See <a href='../demo/index.html#DemoBasicImageApplication'>DemoBasicImageApplication.bbs</a>."
44   author "laurent.guigues@creatis.insa-lyon.fr"
45   category "widget"
46 ##
47
48
49 # WINDOWS CREATION
50   new LayoutSplit mainWindow
51   set mainWindow.Proportion 90
52
53   new DoubleSlicer viewer
54
55   new LayoutLine buttonsBar
56   
57   new CommandButton openButton
58   new CommandButton paramButton
59   new CommandButton runButton
60   new CommandButton saveButton
61   new CommandButton quitButton
62
63   connect viewer.Widget      mainWindow.Widget1
64   connect buttonsBar.Widget  mainWindow.Widget2
65
66   connect openButton.Widget  buttonsBar.Widget1
67   connect paramButton.Widget buttonsBar.Widget2
68   connect runButton.Widget   buttonsBar.Widget3
69   connect saveButton.Widget  buttonsBar.Widget4
70   connect quitButton.Widget  buttonsBar.Widget5
71
72   set viewer.Orientation 0
73   set buttonsBar.Orientation 0
74
75 #OPEN
76   set openButton.Label  "Open"
77   set paramButton.Label "Parameters"
78   set saveButton.Label  "Save"
79   new FileSelector openFileDialog
80   connect openButton.BoxChange openFileDialog.BoxExecute
81   connect openButton.BoxChange viewer.RefreshSlicer1
82   set openFileDialog.Message "Select input image"
83   set openFileDialog.OpenSave "Open"
84 #READER
85   new MetaImageReader reader 
86   connect openFileDialog.Out reader.In
87
88   connect reader.Out viewer.In1
89
90
91 # RUN
92   set runButton.Label "Run"
93   new MultipleInputs refreshViewerOut 
94   connect refreshViewerOut.Out viewer.RefreshSlicer2
95   connect runButton.BoxChange refreshViewerOut.In1
96
97
98 #SAVE 
99   new ImageWriter writer
100   new FileSelector saveFileDialog
101   set saveFileDialog.BoxProcessMode Always
102   set saveFileDialog.DefaultFile "out.hdr"
103   set saveFileDialog.Message "Select output image"
104   set saveFileDialog.OpenSave "Save"
105   connect saveFileDialog.Out writer.Filename
106   connect saveButton.BoxChange refreshViewerOut.In2
107   connect saveButton.BoxChange writer.BoxExecute
108
109 #PARAMETERS 
110   new LayoutSplit paramWindow
111   set paramWindow.Proportion 80
112   set paramWindow.WinTitle "Parameters"
113 #  new LayoutLine userParamWindow
114 #  connect userParamWindow.Widget paramWindow.Widget1
115   new CommandButton paramWindowCloseButton
116   set paramWindowCloseButton.Label "Close"
117   connect paramWindowCloseButton.Widget paramWindow.Widget2
118   new MultipleInputs paramWindowHide
119   connect paramWindowHide.Out paramWindow.WinHide
120   connect paramWindowCloseButton.BoxChange paramWindowHide.In1
121   connect paramButton.BoxChange paramWindow.BoxExecute
122
123 #QUIT
124   set quitButton.Label "Quit"
125   connect quitButton.BoxChange mainWindow.WinHide
126   connect quitButton.BoxChange paramWindowHide.In2
127   set quitButton.In "reset"
128
129
130
131 # INPUTS / OUTPUTS 
132   new anyItkImagePointerRelay imageOut
133   connect imageOut.Out viewer.In2
134   connect imageOut.Out writer.In
135   
136   input  AlgorithmOutput  imageOut.In         "Plug here the output of your algorithm"
137   output AlgorithmInput   reader.Out          "Plug this output to the input of your algorithm"
138   input  ParametersWidget paramWindow.Widget1 "Connect here your parameter tuning widget"
139
140   input ParametersWindowWidth  paramWindow.WinWidth  "The width of the parameters window"
141   input ParametersWindowHeight paramWindow.WinHeight "The height of the parameters window"
142   input WinTitle               mainWindow.WinTitle   "Title of the main window"
143
144   input Refresh viewer.BoxProcessModeSlicer2 "Set to 'Reactive' to have automatic refresh when image or parameters change"
145
146   exec mainWindow
147
148
149 endefine
150