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-2001 Kevin Rosenberg
12 ** $Id: views.h,v 1.38 2001/01/28 22:45:54 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;
47 wxMenu* m_pMenuAnalyze;
49 ImageFileCanvas *CreateCanvas (wxFrame* parent);
51 wxDocMDIChildFrame* m_pFrame;
52 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
54 wxDocChildFrame* m_pFrame;
55 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
58 ImageFileCanvas *m_pCanvas;
64 double m_dAutoScaleFactor;
66 int m_iDefaultExportFormatID;
68 wxWindow* getFrameForChild()
70 { return theApp->getMainFrame(); }
77 virtual ~ImageFileView();
79 { m_pCanvas = NULL; m_pFrame = NULL; }
82 { return m_pFileMenu; }
84 bool OnCreate(wxDocument *doc, long flags);
85 void OnDraw(wxDC* dc);
86 void OnUpdate(wxView *sender, wxObject *hint = NULL);
87 bool OnClose (bool deleteWindow = true);
89 void OnScaleSize (wxCommandEvent& event);
90 void OnExport (wxCommandEvent& event);
92 void OnProperties (wxCommandEvent& event);
93 void OnCompare (wxCommandEvent& event);
95 void OnInvertValues (wxCommandEvent& event);
96 void OnSquare (wxCommandEvent& event);
97 void OnSquareRoot (wxCommandEvent& event);
98 void OnLog (wxCommandEvent& event);
99 void OnExp (wxCommandEvent& event);
100 void OnAdd (wxCommandEvent& event);
101 void OnSubtract (wxCommandEvent& event);
102 void OnMultiply (wxCommandEvent& event);
103 void OnDivide (wxCommandEvent& event);
104 void OnFourier (wxCommandEvent& event);
105 void OnInverseFourier (wxCommandEvent& event);
106 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
107 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
110 void OnFFT (wxCommandEvent& event);
111 void OnIFFT (wxCommandEvent& event);
112 void OnFFTRows (wxCommandEvent& event);
113 void OnIFFTRows (wxCommandEvent& event);
114 void OnFFTCols (wxCommandEvent& event);
115 void OnIFFTCols (wxCommandEvent& event);
118 void OnMagnitude (wxCommandEvent& event);
119 void OnPhase (wxCommandEvent& event);
121 void OnScaleAuto (wxCommandEvent& event);
122 void OnScaleMinMax (wxCommandEvent& event);
123 void OnScaleFull (wxCommandEvent& event);
124 void OnPlotRow (wxCommandEvent& event);
125 void OnPlotCol (wxCommandEvent& event);
127 void OnPlotFFTRow (wxCommandEvent& event);
128 void OnPlotFFTCol (wxCommandEvent& event);
130 void OnPlotHistogram (wxCommandEvent& event);
131 void OnCompareRow (wxCommandEvent& event);
132 void OnCompareCol (wxCommandEvent& event);
135 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
137 wxDocChildFrame* getFrame() { return m_pFrame; }
140 wxMenu* getMenuAnalyze() { return m_pMenuAnalyze; }
142 ImageFileDocument* GetDocument()
143 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
145 DECLARE_EVENT_TABLE()
148 class ImageFileCanvas: public wxScrolledWindow
151 ImageFileView* m_pView;
157 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
158 virtual ~ImageFileCanvas();
160 virtual void OnDraw(wxDC& dc);
161 void OnMouseEvent(wxMouseEvent& event);
162 void DrawRubberBandCursor (wxDC& dc, int x, int y);
163 bool GetCurrentCursor (int& x, int& y);
165 virtual wxSize GetBestSize() const;
166 void setView(ImageFileView* pView)
170 DECLARE_EVENT_TABLE()
174 class ProjectionFileCanvas;
175 class ProjectionFileView : public wxView
177 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
179 wxMemoryDC m_memoryDC;
183 ProjectionFileCanvas *CreateCanvas (wxFrame* parent);
185 wxDocMDIChildFrame* m_pFrame;
186 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
188 wxDocChildFrame* m_pFrame;
189 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
192 ProjectionFileCanvas *m_pCanvas;
197 int m_iDefaultFilter;
198 int m_iDefaultFilterMethod;
199 double m_dDefaultFilterParam;
200 int m_iDefaultFilterGeneration;
201 int m_iDefaultZeropad;
202 int m_iDefaultInterpolation;
203 int m_iDefaultInterpParam;
204 int m_iDefaultBackprojector;
207 int m_iDefaultPolarNX;
208 int m_iDefaultPolarNY;
209 int m_iDefaultPolarInterpolation;
210 int m_iDefaultPolarZeropad;
212 wxWindow* getFrameForChild()
214 { return theApp->getMainFrame(); }
220 ProjectionFileView();
221 virtual ~ProjectionFileView();
223 { m_pCanvas = NULL; m_pFrame = NULL; }
225 bool OnCreate(wxDocument *doc, long flags);
226 void OnDraw(wxDC* dc);
227 void OnUpdate(wxView *sender, wxObject *hint = NULL);
228 bool OnClose (bool deleteWindow = true);
229 void OnProperties (wxCommandEvent& event);
230 void OnReconstructFBP (wxCommandEvent& event);
231 void OnReconstructFourier (wxCommandEvent& event);
232 void OnConvertPolar (wxCommandEvent& event);
233 void OnConvertFFTPolar (wxCommandEvent& event);
236 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
238 wxDocChildFrame* getFrame() { return m_pFrame; }
240 ProjectionFileCanvas* getCanvas() { return m_pCanvas; }
242 wxMenu* getFileMenu() { return m_pFileMenu; }
244 ProjectionFileDocument* GetDocument()
245 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
246 DECLARE_EVENT_TABLE()
249 class ProjectionFileCanvas: public wxScrolledWindow
252 ProjectionFileView* m_pView;
255 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
256 virtual ~ProjectionFileCanvas() ;
258 virtual wxSize GetBestSize() const;
259 virtual void OnDraw(wxDC& dc);
260 void setView(ProjectionFileView* pView)
266 class PhantomFileView : public wxView
269 DECLARE_DYNAMIC_CLASS(PhantomFileView)
270 DECLARE_EVENT_TABLE()
272 PhantomCanvas *CreateCanvas (wxFrame* parent);
274 wxDocMDIChildFrame* m_pFrame;
275 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
277 wxDocChildFrame* m_pFrame;
278 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
281 PhantomCanvas *m_pCanvas;
286 int m_iDefaultNSample;
287 int m_iDefaultGeometry;
289 double m_dDefaultRotation;
290 double m_dDefaultFocalLength;
291 double m_dDefaultFieldOfView;
293 int m_iDefaultRasterNX;
294 int m_iDefaultRasterNY;
295 int m_iDefaultRasterNSamples;
297 wxWindow* getFrameForChild()
299 { return theApp->getMainFrame(); }
306 virtual ~PhantomFileView();
308 { m_pCanvas = NULL; m_pFrame = NULL; }
310 bool OnCreate(wxDocument *doc, long flags);
311 void OnUpdate(wxView *sender, wxObject *hint = NULL);
312 bool OnClose (bool deleteWindow = true);
313 void OnDraw(wxDC* dc);
314 void OnProperties (wxCommandEvent& event);
315 void OnRasterize (wxCommandEvent& event);
316 void OnProjections (wxCommandEvent& event);
318 PhantomFileDocument* GetDocument()
319 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
321 wxMenu* getFileMenu() { return m_pFileMenu; }
323 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
325 wxDocChildFrame* getFrame() { return m_pFrame; }
329 class PhantomCanvas: public wxScrolledWindow
332 PhantomFileView* m_pView;
335 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
336 virtual ~PhantomCanvas();
338 void setView(PhantomFileView* pView)
340 virtual void OnDraw(wxDC& dc);
343 class PlotFileCanvas;
344 class PlotFileView : public wxView
346 DECLARE_DYNAMIC_CLASS(PlotFileView)
350 wxDocMDIChildFrame* m_pFrame;
351 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
353 wxDocChildFrame* m_pFrame;
354 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
357 PlotFileCanvas *m_pCanvas;
361 bool m_bMinSpecified;
362 bool m_bMaxSpecified;
365 double m_dAutoScaleFactor;
367 PlotFileCanvas *CreateCanvas (wxFrame* parent);
368 wxWindow* getFrameForChild()
370 { return theApp->getMainFrame(); }
377 virtual ~PlotFileView();
379 { m_pCanvas = NULL; m_pFrame = NULL; }
381 bool OnCreate(wxDocument *doc, long flags);
382 void OnDraw(wxDC* dc);
383 void OnUpdate(wxView *sender, wxObject *hint = NULL);
384 bool OnClose (bool deleteWindow = true);
386 void OnProperties (wxCommandEvent& event);
387 void OnScaleMinMax (wxCommandEvent& event);
388 void OnScaleAuto (wxCommandEvent& event);
389 void OnScaleFull (wxCommandEvent& event);
392 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
394 wxDocChildFrame* getFrame() { return m_pFrame; }
397 wxMenu* getFileMenu() { return m_pFileMenu; }
398 PlotFileDocument* GetDocument()
399 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
401 DECLARE_EVENT_TABLE()
404 class PlotFileCanvas: public wxScrolledWindow
407 PlotFileView* m_pView;
410 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
411 virtual ~PlotFileCanvas();
413 virtual void OnDraw(wxDC& dc);
415 void setView (PlotFileView* pView)
420 class TextFileCanvas;
421 class TextFileView: public wxView
424 DECLARE_DYNAMIC_CLASS(TextFileView)
427 wxDocMDIChildFrame* m_pFrame;
428 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
430 wxDocChildFrame* m_pFrame;
431 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
434 TextFileCanvas *m_pCanvas;
438 : wxView() , m_pFrame(0), m_pCanvas(0)
444 bool OnCreate (wxDocument *doc, long flags);
445 void OnDraw (wxDC *dc);
446 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
447 bool OnClose (bool deleteWindow = TRUE);
449 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
450 wxMenu* getFileMenu() { return m_pFileMenu; }
452 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
454 wxDocChildFrame* getFrame() { return m_pFrame; }
458 class TextFileCanvas: public wxTextCtrl
460 TextFileView *m_pView;
463 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);