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.28 2001/01/20 17:43:41 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);
74 { return m_pFileMenu; }
76 bool OnCreate(wxDocument *doc, long flags);
77 void OnDraw(wxDC* dc);
78 void OnUpdate(wxView *sender, wxObject *hint = NULL);
79 bool OnClose (bool deleteWindow = true);
81 void OnScaleSize (wxCommandEvent& event);
82 void OnExport (wxCommandEvent& event);
84 void OnProperties (wxCommandEvent& event);
85 void OnCompare (wxCommandEvent& event);
87 void OnInvertValues (wxCommandEvent& event);
88 void OnSquare (wxCommandEvent& event);
89 void OnSquareRoot (wxCommandEvent& event);
90 void OnLog (wxCommandEvent& event);
91 void OnExp (wxCommandEvent& event);
92 void OnAdd (wxCommandEvent& event);
93 void OnSubtract (wxCommandEvent& event);
94 void OnMultiply (wxCommandEvent& event);
95 void OnDivide (wxCommandEvent& event);
96 void OnFourier (wxCommandEvent& event);
97 void OnInverseFourier (wxCommandEvent& event);
98 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
99 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
102 void OnFFT (wxCommandEvent& event);
103 void OnIFFT (wxCommandEvent& event);
104 void OnFFTRows (wxCommandEvent& event);
105 void OnIFFTRows (wxCommandEvent& event);
106 void OnFFTCols (wxCommandEvent& event);
107 void OnIFFTCols (wxCommandEvent& event);
110 void OnMagnitude (wxCommandEvent& event);
111 void OnPhase (wxCommandEvent& event);
113 void OnScaleAuto (wxCommandEvent& event);
114 void OnScaleMinMax (wxCommandEvent& event);
115 void OnScaleFull (wxCommandEvent& event);
116 void OnPlotRow (wxCommandEvent& event);
117 void OnPlotCol (wxCommandEvent& event);
119 void OnPlotFFTRow (wxCommandEvent& event);
120 void OnPlotFFTCol (wxCommandEvent& event);
122 void OnPlotHistogram (wxCommandEvent& event);
123 void OnCompareRow (wxCommandEvent& event);
124 void OnCompareCol (wxCommandEvent& event);
129 ImageFileDocument* GetDocument(void)
130 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
132 DECLARE_EVENT_TABLE()
135 class ImageFileCanvas: public wxScrolledWindow
141 ImageFileView* m_pView;
144 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
145 virtual ~ImageFileCanvas();
147 virtual void OnDraw(wxDC& dc);
148 void OnMouseEvent(wxMouseEvent& event);
149 void DrawRubberBandCursor (wxDC& dc, int x, int y);
150 bool GetCurrentCursor (int& x, int& y);
152 virtual wxSize GetBestSize() const;
153 void setView(ImageFileView* pView)
157 DECLARE_EVENT_TABLE()
161 class ProjectionFileCanvas;
162 class ProjectionFileView : public wxView
164 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
166 wxMemoryDC m_memoryDC;
170 ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
171 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
173 ProjectionFileCanvas *m_canvas;
179 int m_iDefaultFilter;
180 int m_iDefaultFilterMethod;
181 double m_dDefaultFilterParam;
182 int m_iDefaultFilterGeneration;
183 int m_iDefaultZeropad;
184 int m_iDefaultInterpolation;
185 int m_iDefaultInterpParam;
186 int m_iDefaultBackprojector;
189 int m_iDefaultPolarNX;
190 int m_iDefaultPolarNY;
191 int m_iDefaultPolarInterpolation;
192 int m_iDefaultPolarZeropad;
194 wxWindow* getFrameForChild()
196 { return theApp->getMainFrame()->GetClientWindow(); }
202 ProjectionFileView(void);
203 virtual ~ProjectionFileView(void);
205 bool OnCreate(wxDocument *doc, long flags);
206 void OnDraw(wxDC* dc);
207 void OnUpdate(wxView *sender, wxObject *hint = NULL);
208 bool OnClose (bool deleteWindow = true);
209 void OnProperties (wxCommandEvent& event);
210 void OnReconstructFBP (wxCommandEvent& event);
211 void OnReconstructFourier (wxCommandEvent& event);
212 void OnConvertPolar (wxCommandEvent& event);
213 void OnConvertFFTPolar (wxCommandEvent& event);
215 wxFrame* getFrame () { return m_frame; }
217 wxMenu* getFileMenu() { return m_pFileMenu; }
219 ProjectionFileDocument* GetDocument(void)
220 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
221 DECLARE_EVENT_TABLE()
224 class ProjectionFileCanvas: public wxScrolledWindow
227 ProjectionFileView* m_pView;
230 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
231 virtual ~ProjectionFileCanvas() ;
233 virtual wxSize GetBestSize() const;
234 virtual void OnDraw(wxDC& dc);
235 void setView(ProjectionFileView* pView)
241 class PhantomView : public wxView
244 DECLARE_DYNAMIC_CLASS(PhantomView)
245 DECLARE_EVENT_TABLE()
247 PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
248 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
250 PhantomCanvas *m_canvas;
256 int m_iDefaultNSample;
257 int m_iDefaultGeometry;
259 double m_dDefaultRotation;
260 double m_dDefaultFocalLength;
261 double m_dDefaultFieldOfView;
263 int m_iDefaultRasterNX;
264 int m_iDefaultRasterNY;
265 int m_iDefaultRasterNSamples;
267 wxWindow* getFrameForChild()
269 { return theApp->getMainFrame()->GetClientWindow(); }
276 virtual ~PhantomView(void);
278 bool OnCreate(wxDocument *doc, long flags);
279 void OnUpdate(wxView *sender, wxObject *hint = NULL);
280 bool OnClose (bool deleteWindow = true);
281 void OnDraw(wxDC* dc);
282 void OnProperties (wxCommandEvent& event);
283 void OnRasterize (wxCommandEvent& event);
284 void OnProjections (wxCommandEvent& event);
286 PhantomDocument* GetDocument(void)
287 { return dynamic_cast<PhantomDocument*>(wxView::GetDocument()); }
289 wxMenu* getFileMenu() { return m_pFileMenu; }
292 class PhantomCanvas: public wxScrolledWindow
295 PhantomView* m_pView;
298 PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
299 virtual ~PhantomCanvas();
301 void setView(PhantomView* pView)
303 virtual void OnDraw(wxDC& dc);
306 class PlotFileCanvas;
307 class PlotFileView : public wxView
309 DECLARE_DYNAMIC_CLASS(PlotFileView)
312 PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
313 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
315 PlotFileCanvas *m_canvas;
320 bool m_bMinSpecified;
321 bool m_bMaxSpecified;
324 double m_dAutoScaleFactor;
326 wxWindow* getFrameForChild()
328 { return theApp->getMainFrame()->GetClientWindow(); }
335 virtual ~PlotFileView(void);
337 bool OnCreate(wxDocument *doc, long flags);
338 void OnDraw(wxDC* dc);
339 void OnUpdate(wxView *sender, wxObject *hint = NULL);
340 bool OnClose (bool deleteWindow = true);
342 void OnProperties (wxCommandEvent& event);
343 void OnScaleMinMax (wxCommandEvent& event);
344 void OnScaleAuto (wxCommandEvent& event);
345 void OnScaleFull (wxCommandEvent& event);
350 wxMenu* getFileMenu() { return m_pFileMenu; }
351 PlotFileDocument* GetDocument(void)
352 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
354 DECLARE_EVENT_TABLE()
357 class PlotFileCanvas: public wxScrolledWindow
360 PlotFileView* m_pView;
363 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
364 virtual ~PlotFileCanvas();
366 virtual void OnDraw(wxDC& dc);
368 void setView (PlotFileView* pView)
373 class TextEditCanvas;
374 class TextEditView: public wxView
377 DECLARE_DYNAMIC_CLASS(TextEditView)
381 TextEditCanvas *m_pCanvas;
385 : wxView() , m_pFrame(0), m_pCanvas(0)
389 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
391 bool OnCreate (wxDocument *doc, long flags);
392 void OnDraw (wxDC *dc);
393 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
394 bool OnClose (bool deleteWindow = TRUE);
396 TextEditCanvas* getTextCtrl() { return m_pCanvas; }
398 wxMenu* getFileMenu() { return m_pFileMenu; }
401 class TextEditCanvas: public wxTextCtrl
403 TextEditView *m_pView;
406 TextEditCanvas (TextEditView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);