1 /*****************************************************************************
5 ** Purpose: Header file for View & Canvas routines of CTSim program
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: July 2000
9 ** This is part of the CTSim program
10 ** Copyright (C) 1983-2000 Kevin Rosenberg
12 ** $Id: views.h,v 1.29 2001/01/26 00:45:24 kevin Exp $
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.
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.
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 ******************************************************************************/
37 #include "imagefile.h"
39 class ImageFileCanvas;
40 class ImageFileView : public wxView
43 DECLARE_DYNAMIC_CLASS(ImageFileView)
45 wxMemoryDC m_memoryDC;
48 ImageFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
49 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
52 ImageFileCanvas *m_canvas;
58 double m_dAutoScaleFactor;
60 int m_iDefaultExportFormatID;
62 wxWindow* getFrameForChild()
64 { return theApp->getMainFrame()->GetClientWindow(); }
71 virtual ~ImageFileView(void);
73 { m_canvas = NULL; m_frame = NULL; }
76 { return m_pFileMenu; }
78 bool OnCreate(wxDocument *doc, long flags);
79 void OnDraw(wxDC* dc);
80 void OnUpdate(wxView *sender, wxObject *hint = NULL);
81 bool OnClose (bool deleteWindow = true);
83 void OnScaleSize (wxCommandEvent& event);
84 void OnExport (wxCommandEvent& event);
86 void OnProperties (wxCommandEvent& event);
87 void OnCompare (wxCommandEvent& event);
89 void OnInvertValues (wxCommandEvent& event);
90 void OnSquare (wxCommandEvent& event);
91 void OnSquareRoot (wxCommandEvent& event);
92 void OnLog (wxCommandEvent& event);
93 void OnExp (wxCommandEvent& event);
94 void OnAdd (wxCommandEvent& event);
95 void OnSubtract (wxCommandEvent& event);
96 void OnMultiply (wxCommandEvent& event);
97 void OnDivide (wxCommandEvent& event);
98 void OnFourier (wxCommandEvent& event);
99 void OnInverseFourier (wxCommandEvent& event);
100 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
101 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
104 void OnFFT (wxCommandEvent& event);
105 void OnIFFT (wxCommandEvent& event);
106 void OnFFTRows (wxCommandEvent& event);
107 void OnIFFTRows (wxCommandEvent& event);
108 void OnFFTCols (wxCommandEvent& event);
109 void OnIFFTCols (wxCommandEvent& event);
112 void OnMagnitude (wxCommandEvent& event);
113 void OnPhase (wxCommandEvent& event);
115 void OnScaleAuto (wxCommandEvent& event);
116 void OnScaleMinMax (wxCommandEvent& event);
117 void OnScaleFull (wxCommandEvent& event);
118 void OnPlotRow (wxCommandEvent& event);
119 void OnPlotCol (wxCommandEvent& event);
121 void OnPlotFFTRow (wxCommandEvent& event);
122 void OnPlotFFTCol (wxCommandEvent& event);
124 void OnPlotHistogram (wxCommandEvent& event);
125 void OnCompareRow (wxCommandEvent& event);
126 void OnCompareCol (wxCommandEvent& event);
131 ImageFileDocument* GetDocument(void)
132 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
134 DECLARE_EVENT_TABLE()
137 class ImageFileCanvas: public wxScrolledWindow
143 ImageFileView* m_pView;
146 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
147 virtual ~ImageFileCanvas();
149 virtual void OnDraw(wxDC& dc);
150 void OnMouseEvent(wxMouseEvent& event);
151 void DrawRubberBandCursor (wxDC& dc, int x, int y);
152 bool GetCurrentCursor (int& x, int& y);
154 virtual wxSize GetBestSize() const;
155 void setView(ImageFileView* pView)
159 DECLARE_EVENT_TABLE()
163 class ProjectionFileCanvas;
164 class ProjectionFileView : public wxView
166 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
168 wxMemoryDC m_memoryDC;
172 ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
173 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
175 ProjectionFileCanvas *m_canvas;
181 int m_iDefaultFilter;
182 int m_iDefaultFilterMethod;
183 double m_dDefaultFilterParam;
184 int m_iDefaultFilterGeneration;
185 int m_iDefaultZeropad;
186 int m_iDefaultInterpolation;
187 int m_iDefaultInterpParam;
188 int m_iDefaultBackprojector;
191 int m_iDefaultPolarNX;
192 int m_iDefaultPolarNY;
193 int m_iDefaultPolarInterpolation;
194 int m_iDefaultPolarZeropad;
196 wxWindow* getFrameForChild()
198 { return theApp->getMainFrame()->GetClientWindow(); }
204 ProjectionFileView(void);
205 virtual ~ProjectionFileView(void);
207 { m_canvas = NULL; m_frame = NULL; }
209 bool OnCreate(wxDocument *doc, long flags);
210 void OnDraw(wxDC* dc);
211 void OnUpdate(wxView *sender, wxObject *hint = NULL);
212 bool OnClose (bool deleteWindow = true);
213 void OnProperties (wxCommandEvent& event);
214 void OnReconstructFBP (wxCommandEvent& event);
215 void OnReconstructFourier (wxCommandEvent& event);
216 void OnConvertPolar (wxCommandEvent& event);
217 void OnConvertFFTPolar (wxCommandEvent& event);
219 wxFrame* getFrame () { return m_frame; }
221 wxMenu* getFileMenu() { return m_pFileMenu; }
223 ProjectionFileDocument* GetDocument(void)
224 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
225 DECLARE_EVENT_TABLE()
228 class ProjectionFileCanvas: public wxScrolledWindow
231 ProjectionFileView* m_pView;
234 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
235 virtual ~ProjectionFileCanvas() ;
237 virtual wxSize GetBestSize() const;
238 virtual void OnDraw(wxDC& dc);
239 void setView(ProjectionFileView* pView)
245 class PhantomView : public wxView
248 DECLARE_DYNAMIC_CLASS(PhantomView)
249 DECLARE_EVENT_TABLE()
251 PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
252 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
254 PhantomCanvas *m_canvas;
260 int m_iDefaultNSample;
261 int m_iDefaultGeometry;
263 double m_dDefaultRotation;
264 double m_dDefaultFocalLength;
265 double m_dDefaultFieldOfView;
267 int m_iDefaultRasterNX;
268 int m_iDefaultRasterNY;
269 int m_iDefaultRasterNSamples;
271 wxWindow* getFrameForChild()
273 { return theApp->getMainFrame()->GetClientWindow(); }
280 virtual ~PhantomView(void);
282 { m_canvas = NULL; m_frame = NULL; }
284 bool OnCreate(wxDocument *doc, long flags);
285 void OnUpdate(wxView *sender, wxObject *hint = NULL);
286 bool OnClose (bool deleteWindow = true);
287 void OnDraw(wxDC* dc);
288 void OnProperties (wxCommandEvent& event);
289 void OnRasterize (wxCommandEvent& event);
290 void OnProjections (wxCommandEvent& event);
292 PhantomDocument* GetDocument(void)
293 { return dynamic_cast<PhantomDocument*>(wxView::GetDocument()); }
295 wxMenu* getFileMenu() { return m_pFileMenu; }
298 class PhantomCanvas: public wxScrolledWindow
301 PhantomView* m_pView;
304 PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
305 virtual ~PhantomCanvas();
307 void setView(PhantomView* pView)
309 virtual void OnDraw(wxDC& dc);
312 class PlotFileCanvas;
313 class PlotFileView : public wxView
315 DECLARE_DYNAMIC_CLASS(PlotFileView)
318 PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
319 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
321 PlotFileCanvas *m_canvas;
326 bool m_bMinSpecified;
327 bool m_bMaxSpecified;
330 double m_dAutoScaleFactor;
332 wxWindow* getFrameForChild()
334 { return theApp->getMainFrame()->GetClientWindow(); }
341 virtual ~PlotFileView(void);
343 { m_canvas = NULL; m_frame = NULL; }
345 bool OnCreate(wxDocument *doc, long flags);
346 void OnDraw(wxDC* dc);
347 void OnUpdate(wxView *sender, wxObject *hint = NULL);
348 bool OnClose (bool deleteWindow = true);
350 void OnProperties (wxCommandEvent& event);
351 void OnScaleMinMax (wxCommandEvent& event);
352 void OnScaleAuto (wxCommandEvent& event);
353 void OnScaleFull (wxCommandEvent& event);
358 wxMenu* getFileMenu() { return m_pFileMenu; }
359 PlotFileDocument* GetDocument(void)
360 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
362 DECLARE_EVENT_TABLE()
365 class PlotFileCanvas: public wxScrolledWindow
368 PlotFileView* m_pView;
371 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
372 virtual ~PlotFileCanvas();
374 virtual void OnDraw(wxDC& dc);
376 void setView (PlotFileView* pView)
381 class TextEditCanvas;
382 class TextEditView: public wxView
385 DECLARE_DYNAMIC_CLASS(TextEditView)
389 TextEditCanvas *m_pCanvas;
393 : wxView() , m_pFrame(0), m_pCanvas(0)
399 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
401 bool OnCreate (wxDocument *doc, long flags);
402 void OnDraw (wxDC *dc);
403 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
404 bool OnClose (bool deleteWindow = TRUE);
406 TextEditCanvas* getTextCtrl() { return m_pCanvas; }
408 wxMenu* getFileMenu() { return m_pFileMenu; }
411 class TextEditCanvas: public wxTextCtrl
413 TextEditView *m_pView;
416 TextEditCanvas (TextEditView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);