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.37 2001/01/28 19:10:18 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 (wxFrame* parent);
50 wxDocMDIChildFrame* m_pFrame;
51 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
53 wxDocChildFrame* m_pFrame;
54 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
57 ImageFileCanvas *m_pCanvas;
63 double m_dAutoScaleFactor;
65 int m_iDefaultExportFormatID;
67 wxWindow* getFrameForChild()
69 { return theApp->getMainFrame(); }
76 virtual ~ImageFileView();
78 { m_pCanvas = NULL; m_pFrame = NULL; }
81 { return m_pFileMenu; }
83 bool OnCreate(wxDocument *doc, long flags);
84 void OnDraw(wxDC* dc);
85 void OnUpdate(wxView *sender, wxObject *hint = NULL);
86 bool OnClose (bool deleteWindow = true);
88 void OnScaleSize (wxCommandEvent& event);
89 void OnExport (wxCommandEvent& event);
91 void OnProperties (wxCommandEvent& event);
92 void OnCompare (wxCommandEvent& event);
94 void OnInvertValues (wxCommandEvent& event);
95 void OnSquare (wxCommandEvent& event);
96 void OnSquareRoot (wxCommandEvent& event);
97 void OnLog (wxCommandEvent& event);
98 void OnExp (wxCommandEvent& event);
99 void OnAdd (wxCommandEvent& event);
100 void OnSubtract (wxCommandEvent& event);
101 void OnMultiply (wxCommandEvent& event);
102 void OnDivide (wxCommandEvent& event);
103 void OnFourier (wxCommandEvent& event);
104 void OnInverseFourier (wxCommandEvent& event);
105 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
106 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
109 void OnFFT (wxCommandEvent& event);
110 void OnIFFT (wxCommandEvent& event);
111 void OnFFTRows (wxCommandEvent& event);
112 void OnIFFTRows (wxCommandEvent& event);
113 void OnFFTCols (wxCommandEvent& event);
114 void OnIFFTCols (wxCommandEvent& event);
117 void OnMagnitude (wxCommandEvent& event);
118 void OnPhase (wxCommandEvent& event);
120 void OnScaleAuto (wxCommandEvent& event);
121 void OnScaleMinMax (wxCommandEvent& event);
122 void OnScaleFull (wxCommandEvent& event);
123 void OnPlotRow (wxCommandEvent& event);
124 void OnPlotCol (wxCommandEvent& event);
126 void OnPlotFFTRow (wxCommandEvent& event);
127 void OnPlotFFTCol (wxCommandEvent& event);
129 void OnPlotHistogram (wxCommandEvent& event);
130 void OnCompareRow (wxCommandEvent& event);
131 void OnCompareCol (wxCommandEvent& event);
134 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
136 wxDocChildFrame* getFrame() { return m_pFrame; }
139 ImageFileDocument* GetDocument()
140 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
142 DECLARE_EVENT_TABLE()
145 class ImageFileCanvas: public wxScrolledWindow
148 ImageFileView* m_pView;
153 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
154 virtual ~ImageFileCanvas();
156 virtual void OnDraw(wxDC& dc);
157 void OnMouseEvent(wxMouseEvent& event);
158 void DrawRubberBandCursor (wxDC& dc, int x, int y);
159 bool GetCurrentCursor (int& x, int& y);
161 virtual wxSize GetBestSize() const;
162 void setView(ImageFileView* pView)
166 DECLARE_EVENT_TABLE()
170 class ProjectionFileCanvas;
171 class ProjectionFileView : public wxView
173 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
175 wxMemoryDC m_memoryDC;
179 ProjectionFileCanvas *CreateCanvas (wxFrame* parent);
181 wxDocMDIChildFrame* m_pFrame;
182 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
184 wxDocChildFrame* m_pFrame;
185 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
188 ProjectionFileCanvas *m_pCanvas;
193 int m_iDefaultFilter;
194 int m_iDefaultFilterMethod;
195 double m_dDefaultFilterParam;
196 int m_iDefaultFilterGeneration;
197 int m_iDefaultZeropad;
198 int m_iDefaultInterpolation;
199 int m_iDefaultInterpParam;
200 int m_iDefaultBackprojector;
203 int m_iDefaultPolarNX;
204 int m_iDefaultPolarNY;
205 int m_iDefaultPolarInterpolation;
206 int m_iDefaultPolarZeropad;
208 wxWindow* getFrameForChild()
210 { return theApp->getMainFrame(); }
216 ProjectionFileView();
217 virtual ~ProjectionFileView();
219 { m_pCanvas = NULL; m_pFrame = NULL; }
221 bool OnCreate(wxDocument *doc, long flags);
222 void OnDraw(wxDC* dc);
223 void OnUpdate(wxView *sender, wxObject *hint = NULL);
224 bool OnClose (bool deleteWindow = true);
225 void OnProperties (wxCommandEvent& event);
226 void OnReconstructFBP (wxCommandEvent& event);
227 void OnReconstructFourier (wxCommandEvent& event);
228 void OnConvertPolar (wxCommandEvent& event);
229 void OnConvertFFTPolar (wxCommandEvent& event);
232 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
234 wxDocChildFrame* getFrame() { return m_pFrame; }
236 ProjectionFileCanvas* getCanvas() { return m_pCanvas; }
238 wxMenu* getFileMenu() { return m_pFileMenu; }
240 ProjectionFileDocument* GetDocument()
241 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
242 DECLARE_EVENT_TABLE()
245 class ProjectionFileCanvas: public wxScrolledWindow
248 ProjectionFileView* m_pView;
251 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
252 virtual ~ProjectionFileCanvas() ;
254 virtual wxSize GetBestSize() const;
255 virtual void OnDraw(wxDC& dc);
256 void setView(ProjectionFileView* pView)
262 class PhantomFileView : public wxView
265 DECLARE_DYNAMIC_CLASS(PhantomFileView)
266 DECLARE_EVENT_TABLE()
268 PhantomCanvas *CreateCanvas (wxFrame* parent);
270 wxDocMDIChildFrame* m_pFrame;
271 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
273 wxDocChildFrame* m_pFrame;
274 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
277 PhantomCanvas *m_pCanvas;
282 int m_iDefaultNSample;
283 int m_iDefaultGeometry;
285 double m_dDefaultRotation;
286 double m_dDefaultFocalLength;
287 double m_dDefaultFieldOfView;
289 int m_iDefaultRasterNX;
290 int m_iDefaultRasterNY;
291 int m_iDefaultRasterNSamples;
293 wxWindow* getFrameForChild()
295 { return theApp->getMainFrame(); }
302 virtual ~PhantomFileView();
304 { m_pCanvas = NULL; m_pFrame = NULL; }
306 bool OnCreate(wxDocument *doc, long flags);
307 void OnUpdate(wxView *sender, wxObject *hint = NULL);
308 bool OnClose (bool deleteWindow = true);
309 void OnDraw(wxDC* dc);
310 void OnProperties (wxCommandEvent& event);
311 void OnRasterize (wxCommandEvent& event);
312 void OnProjections (wxCommandEvent& event);
314 PhantomFileDocument* GetDocument()
315 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
317 wxMenu* getFileMenu() { return m_pFileMenu; }
319 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
321 wxDocChildFrame* getFrame() { return m_pFrame; }
325 class PhantomCanvas: public wxScrolledWindow
328 PhantomFileView* m_pView;
331 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
332 virtual ~PhantomCanvas();
334 void setView(PhantomFileView* pView)
336 virtual void OnDraw(wxDC& dc);
339 class PlotFileCanvas;
340 class PlotFileView : public wxView
342 DECLARE_DYNAMIC_CLASS(PlotFileView)
346 wxDocMDIChildFrame* m_pFrame;
347 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
349 wxDocChildFrame* m_pFrame;
350 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
353 PlotFileCanvas *m_pCanvas;
357 bool m_bMinSpecified;
358 bool m_bMaxSpecified;
361 double m_dAutoScaleFactor;
363 PlotFileCanvas *CreateCanvas (wxFrame* parent);
364 wxWindow* getFrameForChild()
366 { return theApp->getMainFrame(); }
373 virtual ~PlotFileView();
375 { m_pCanvas = NULL; m_pFrame = NULL; }
377 bool OnCreate(wxDocument *doc, long flags);
378 void OnDraw(wxDC* dc);
379 void OnUpdate(wxView *sender, wxObject *hint = NULL);
380 bool OnClose (bool deleteWindow = true);
382 void OnProperties (wxCommandEvent& event);
383 void OnScaleMinMax (wxCommandEvent& event);
384 void OnScaleAuto (wxCommandEvent& event);
385 void OnScaleFull (wxCommandEvent& event);
388 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
390 wxDocChildFrame* getFrame() { return m_pFrame; }
393 wxMenu* getFileMenu() { return m_pFileMenu; }
394 PlotFileDocument* GetDocument()
395 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
397 DECLARE_EVENT_TABLE()
400 class PlotFileCanvas: public wxScrolledWindow
403 PlotFileView* m_pView;
406 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
407 virtual ~PlotFileCanvas();
409 virtual void OnDraw(wxDC& dc);
411 void setView (PlotFileView* pView)
416 class TextFileCanvas;
417 class TextFileView: public wxView
420 DECLARE_DYNAMIC_CLASS(TextFileView)
423 wxDocMDIChildFrame* m_pFrame;
424 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
426 wxDocChildFrame* m_pFrame;
427 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
430 TextFileCanvas *m_pCanvas;
434 : wxView() , m_pFrame(0), m_pCanvas(0)
440 bool OnCreate (wxDocument *doc, long flags);
441 void OnDraw (wxDC *dc);
442 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
443 bool OnClose (bool deleteWindow = TRUE);
445 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
446 wxMenu* getFileMenu() { return m_pFileMenu; }
448 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
450 wxDocChildFrame* getFrame() { return m_pFrame; }
454 class TextFileCanvas: public wxTextCtrl
456 TextFileView *m_pView;
459 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);