r326: FFTW additions, filter image generation
[ctsim.git] / src / views.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          view.h
5 **   Purpose:       Header file for View & Canvas routines of CTSim program
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  July 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2000 Kevin Rosenberg
11 **
12 **  $Id: views.h,v 1.20 2001/01/01 10:14:34 kevin Exp $
13 **
14 **  This program is free software; you can redistribute it and/or modify
15 **  it under the terms of the GNU General Public License (version 2) as
16 **  published by the Free Software Foundation.
17 **
18 **  This program is distributed in the hope that it will be useful,
19 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 **  GNU General Public License for more details.
22 **
23 **  You should have received a copy of the GNU General Public License
24 **  along with this program; if not, write to the Free Software
25 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 ******************************************************************************/
27
28 #ifdef __GNUG__
29 // #pragma interface
30 #endif
31
32 #ifndef __VIEWSH__
33 #define __VIEWSH__
34
35 #include "wx/wx.h"
36 #include "docs.h"
37 #include "imagefile.h"
38
39 class ImageFileCanvas;
40 class ImageFileView : public wxView
41 {
42     DECLARE_DYNAMIC_CLASS(ImageFileView)
43
44     wxMemoryDC m_memoryDC;
45     wxBitmap m_bitmap;
46
47 private:
48     ImageFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
49     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
50
51     ImageFileCanvas *m_canvas;
52     wxFrame *m_frame;
53     bool m_bMinSpecified;
54     bool m_bMaxSpecified;
55     double m_dMinPixel;
56     double m_dMaxPixel;
57     double m_dAutoScaleFactor;
58
59 public:
60     ImageFileView(void);
61     virtual ~ImageFileView(void);
62
63     bool OnCreate(wxDocument *doc, long flags);
64     void OnDraw(wxDC* dc);
65     void OnUpdate(wxView *sender, wxObject *hint = NULL);
66     bool OnClose (bool deleteWindow = true);
67     void OnProperties (wxCommandEvent& event);
68     void OnCompare (wxCommandEvent& event);\r
69     void OnInvertValues (wxCommandEvent& event);\r
70     void OnSquare (wxCommandEvent& event);\r
71     void OnSquareRoot (wxCommandEvent& event);\r
72     void OnLog (wxCommandEvent& event);\r
73     void OnExp (wxCommandEvent& event);\r
74     void OnFourier (wxCommandEvent& event);\r
75     void OnInverseFourier (wxCommandEvent& event);\r
76 #ifdef HAVE_FFTW\r
77     void OnFFT (wxCommandEvent& event);\r
78     void OnIFFT (wxCommandEvent& event);\r
79 #endif\r
80     void OnMagnitude (wxCommandEvent& event);\r
81     void OnPhase (wxCommandEvent& event);\r
82     void OnScaleAuto (wxCommandEvent& event);
83     void OnScaleMinMax (wxCommandEvent& event);
84           void OnPlotRow (wxCommandEvent& event);\r
85           void OnPlotCol (wxCommandEvent& event);\r
86     void OnCompareRow (wxCommandEvent& event);\r
87     void OnCompareCol (wxCommandEvent& event);\r
88 \r
89         wxFrame* getFrame()\r
90         { return m_frame; }\r
91
92     ImageFileDocument* GetDocument(void) 
93         { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
94
95     DECLARE_EVENT_TABLE()
96 };
97
98 class ImageFileCanvas: public wxScrolledWindow
99 {
100 private:\r
101         int m_xCursor;\r
102         int m_yCursor;\r
103 \r
104 public:
105     ImageFileView* m_pView;
106     
107     ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
108     virtual void OnDraw(wxDC& dc);
109     void OnMouseEvent(wxMouseEvent& event);
110 \r
111         void DrawRubberBandCursor (wxDC& dc, int x, int y);\r
112         bool GetCurrentCursor (int& x, int& y);\r
113
114     DECLARE_EVENT_TABLE()
115 };
116
117
118 class ProjectionFileCanvas;
119 class ProjectionFileView : public wxView
120 {
121     DECLARE_DYNAMIC_CLASS(ProjectionFileView)
122
123     wxMemoryDC m_memoryDC;
124     wxBitmap m_bitmap;
125
126 private:
127     ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
128     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
129
130     ProjectionFileCanvas *m_canvas;
131     wxFrame *m_frame;
132
133     int m_iDefaultNX;
134     int m_iDefaultNY;
135     int m_iDefaultFilter;
136     int m_iDefaultFilterMethod;
137     double m_dDefaultFilterParam;
138     int m_iDefaultFilterGeneration;
139     int m_iDefaultZeropad;
140     int m_iDefaultInterpolation;
141     int m_iDefaultInterpParam;
142     int m_iDefaultBackprojector;
143     int m_iDefaultTrace;
144
145 public:
146     ProjectionFileView(void);
147     virtual ~ProjectionFileView(void);
148
149     bool OnCreate(wxDocument *doc, long flags);
150     void OnDraw(wxDC* dc);
151     void OnUpdate(wxView *sender, wxObject *hint = NULL);
152     bool OnClose (bool deleteWindow = true);
153     void OnProperties (wxCommandEvent& event);
154     void OnReconstruct (wxCommandEvent& event);
155 \r
156         wxFrame* getFrame ()\r
157         { return m_frame; }\r
158
159     ProjectionFileDocument* GetDocument(void) 
160         { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
161     DECLARE_EVENT_TABLE()
162 };
163
164 class ProjectionFileCanvas: public wxScrolledWindow
165 {
166 public:
167     ProjectionFileView* m_pView;
168     
169     ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
170     virtual void OnDraw(wxDC& dc);
171 };
172
173
174 class PhantomCanvas;
175 class PhantomView : public wxView
176 {
177     DECLARE_DYNAMIC_CLASS(PhantomView)
178
179 private:
180     PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
181     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
182
183     PhantomCanvas *m_canvas;
184     wxFrame *m_frame;
185
186     int m_iDefaultNDet;
187     int m_iDefaultNView;
188     int m_iDefaultNSample;
189     int m_iDefaultGeometry;
190     int m_iDefaultTrace;
191     double m_dDefaultRotation;
192     double m_dDefaultFocalLength;
193     double m_dDefaultFieldOfView;
194
195 public:
196     PhantomView(void);
197     virtual ~PhantomView(void);
198
199     bool OnCreate(wxDocument *doc, long flags);
200     void OnUpdate(wxView *sender, wxObject *hint = NULL);
201     bool OnClose (bool deleteWindow = true);
202     void OnDraw(wxDC* dc);
203     void OnProperties (wxCommandEvent& event);
204     void OnRasterize (wxCommandEvent& event);
205     void OnProjections (wxCommandEvent& event);
206
207     PhantomDocument* GetDocument(void) 
208         { return dynamic_cast<PhantomDocument*>(wxView::GetDocument()); }
209
210     DECLARE_EVENT_TABLE()
211 };
212
213 class PhantomCanvas: public wxScrolledWindow
214 {
215 public:
216     PhantomView* m_pView;
217     
218     PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
219
220     virtual void OnDraw(wxDC& dc);
221
222 };
223
224 class PlotFileCanvas;
225 class PlotFileView : public wxView
226 {
227     DECLARE_DYNAMIC_CLASS(PlotFileView)
228
229 private:
230     PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
231     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
232
233     PlotFileCanvas *m_canvas;
234     wxFrame *m_frame;
235     EZPlot* m_pEZPlot;\r
236     bool m_bMinSpecified;\r
237     bool m_bMaxSpecified;\r
238     double m_dMinPixel;\r
239     double m_dMaxPixel;\r
240     double m_dAutoScaleFactor;\r
241
242 public:
243     PlotFileView(void);
244     virtual ~PlotFileView(void);
245
246     bool OnCreate(wxDocument *doc, long flags);
247     void OnDraw(wxDC* dc);
248     void OnUpdate(wxView *sender, wxObject *hint = NULL);
249     bool OnClose (bool deleteWindow = true);
250     void OnProperties (wxCommandEvent& event);
251     void OnScaleAuto (wxCommandEvent& event);\r
252     void OnScaleMinMax (wxCommandEvent& event);\r
253
254         wxFrame* getFrame ()
255         { return m_frame; }
256
257     PlotFileDocument* GetDocument(void) 
258         { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
259
260     DECLARE_EVENT_TABLE()
261 };
262
263 class PlotFileCanvas: public wxScrolledWindow
264 {
265 public:
266     PlotFileView* m_pView;
267     
268     PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
269     virtual void OnDraw(wxDC& dc);
270 };
271
272
273
274 #endif
275