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.42 2001/01/30 07:32:13 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"
38 #include "graph3dview.h"
40 class ImageFileCanvas;
41 class ImageFileView : public wxView
44 DECLARE_DYNAMIC_CLASS(ImageFileView)
46 wxMemoryDC m_memoryDC;
48 wxMenu* m_pMenuAnalyze;
50 ImageFileCanvas *CreateCanvas (wxFrame* parent);
52 wxDocMDIChildFrame* m_pFrame;
53 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
55 wxDocChildFrame* m_pFrame;
56 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
59 ImageFileCanvas *m_pCanvas;
65 double m_dAutoScaleFactor;
67 int m_iDefaultExportFormatID;
69 wxWindow* getFrameForChild()
71 { return theApp->getMainFrame(); }
78 virtual ~ImageFileView();
80 { m_pCanvas = NULL; m_pFrame = NULL; }
83 { return m_pFileMenu; }
85 bool OnCreate(wxDocument *doc, long flags);
86 void OnDraw(wxDC* dc);
87 void OnUpdate(wxView *sender, wxObject *hint = NULL);
88 bool OnClose (bool deleteWindow = true);
90 void OnRevert (wxCommandEvent& event);
91 void OnExport (wxCommandEvent& event);
92 void OnProperties (wxCommandEvent& event);
94 void OnCompare (wxCommandEvent& event);
95 void OnScaleSize (wxCommandEvent& event);
96 void OnInvertValues (wxCommandEvent& event);
97 void OnSquare (wxCommandEvent& event);
98 void OnSquareRoot (wxCommandEvent& event);
99 void OnLog (wxCommandEvent& event);
100 void OnExp (wxCommandEvent& event);
101 void OnAdd (wxCommandEvent& event);
102 void OnSubtract (wxCommandEvent& event);
103 void OnMultiply (wxCommandEvent& event);
104 void OnDivide (wxCommandEvent& event);
105 void OnFourier (wxCommandEvent& event);
106 void OnInverseFourier (wxCommandEvent& event);
107 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
108 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
111 void OnFFT (wxCommandEvent& event);
112 void OnIFFT (wxCommandEvent& event);
113 void OnFFTRows (wxCommandEvent& event);
114 void OnIFFTRows (wxCommandEvent& event);
115 void OnFFTCols (wxCommandEvent& event);
116 void OnIFFTCols (wxCommandEvent& event);
119 void OnMagnitude (wxCommandEvent& event);
120 void OnPhase (wxCommandEvent& event);
122 void OnScaleAuto (wxCommandEvent& event);
123 void OnScaleMinMax (wxCommandEvent& event);
124 void OnScaleFull (wxCommandEvent& event);
125 void OnPlotRow (wxCommandEvent& event);
126 void OnPlotCol (wxCommandEvent& event);
128 void OnPlotFFTRow (wxCommandEvent& event);
129 void OnPlotFFTCol (wxCommandEvent& event);
131 void OnPlotHistogram (wxCommandEvent& event);
132 void OnCompareRow (wxCommandEvent& event);
133 void OnCompareCol (wxCommandEvent& event);
136 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
138 wxDocChildFrame* getFrame() { return m_pFrame; }
141 wxMenu* getMenuAnalyze() { return m_pMenuAnalyze; }
143 ImageFileDocument* GetDocument()
144 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
146 DECLARE_EVENT_TABLE()
149 class ImageFileCanvas: public wxScrolledWindow
152 ImageFileView* m_pView;
158 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
159 virtual ~ImageFileCanvas();
161 virtual void OnDraw(wxDC& dc);
162 void OnChar(wxKeyEvent& event);
163 void OnMouseEvent(wxMouseEvent& event);
164 void DrawRubberBandCursor (wxDC& dc, int x, int y);
165 bool GetCurrentCursor (int& x, int& y);
167 virtual wxSize GetBestSize() const;
168 void setView(ImageFileView* pView)
172 DECLARE_EVENT_TABLE()
176 class ProjectionFileCanvas;
177 class ProjectionFileView : public wxView
179 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
181 wxMemoryDC m_memoryDC;
185 ProjectionFileCanvas *CreateCanvas (wxFrame* parent);
187 wxDocMDIChildFrame* m_pFrame;
188 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
190 wxDocChildFrame* m_pFrame;
191 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
194 ProjectionFileCanvas *m_pCanvas;
199 int m_iDefaultFilter;
200 int m_iDefaultFilterMethod;
201 double m_dDefaultFilterParam;
202 int m_iDefaultFilterGeneration;
203 int m_iDefaultZeropad;
204 int m_iDefaultInterpolation;
205 int m_iDefaultInterpParam;
206 int m_iDefaultBackprojector;
209 int m_iDefaultPolarNX;
210 int m_iDefaultPolarNY;
211 int m_iDefaultPolarInterpolation;
212 int m_iDefaultPolarZeropad;
214 wxWindow* getFrameForChild()
216 { return theApp->getMainFrame(); }
222 ProjectionFileView();
223 virtual ~ProjectionFileView();
225 { m_pCanvas = NULL; m_pFrame = NULL; }
227 bool OnCreate(wxDocument *doc, long flags);
228 void OnDraw(wxDC* dc);
229 void OnUpdate(wxView *sender, wxObject *hint = NULL);
230 bool OnClose (bool deleteWindow = true);
231 void OnProperties (wxCommandEvent& event);
232 void OnReconstructFBP (wxCommandEvent& event);
233 void OnReconstructFourier (wxCommandEvent& event);
234 void OnConvertPolar (wxCommandEvent& event);
235 void OnConvertFFTPolar (wxCommandEvent& event);
238 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
240 wxDocChildFrame* getFrame() { return m_pFrame; }
242 ProjectionFileCanvas* getCanvas() { return m_pCanvas; }
244 wxMenu* getFileMenu() { return m_pFileMenu; }
246 ProjectionFileDocument* GetDocument()
247 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
248 DECLARE_EVENT_TABLE()
251 class ProjectionFileCanvas: public wxScrolledWindow
254 ProjectionFileView* m_pView;
257 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
258 virtual ~ProjectionFileCanvas() ;
260 virtual wxSize GetBestSize() const;
261 virtual void OnDraw(wxDC& dc);
262 void setView(ProjectionFileView* pView)
268 class PhantomFileView : public wxView
271 DECLARE_DYNAMIC_CLASS(PhantomFileView)
272 DECLARE_EVENT_TABLE()
274 PhantomCanvas *CreateCanvas (wxFrame* parent);
276 wxDocMDIChildFrame* m_pFrame;
277 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
279 wxDocChildFrame* m_pFrame;
280 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
283 PhantomCanvas *m_pCanvas;
288 int m_iDefaultNSample;
289 int m_iDefaultGeometry;
291 double m_dDefaultRotation;
292 double m_dDefaultFocalLength;
293 double m_dDefaultFieldOfView;
295 int m_iDefaultRasterNX;
296 int m_iDefaultRasterNY;
297 int m_iDefaultRasterNSamples;
299 wxWindow* getFrameForChild()
301 { return theApp->getMainFrame(); }
308 virtual ~PhantomFileView();
310 { m_pCanvas = NULL; m_pFrame = NULL; }
312 bool OnCreate(wxDocument *doc, long flags);
313 void OnUpdate(wxView *sender, wxObject *hint = NULL);
314 bool OnClose (bool deleteWindow = true);
315 void OnDraw(wxDC* dc);
316 void OnProperties (wxCommandEvent& event);
317 void OnRasterize (wxCommandEvent& event);
318 void OnProjections (wxCommandEvent& event);
320 PhantomFileDocument* GetDocument()
321 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
323 wxMenu* getFileMenu() { return m_pFileMenu; }
325 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
327 wxDocChildFrame* getFrame() { return m_pFrame; }
331 class PhantomCanvas: public wxScrolledWindow
334 PhantomFileView* m_pView;
337 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
338 virtual ~PhantomCanvas();
340 void setView(PhantomFileView* pView)
342 virtual void OnDraw(wxDC& dc);
345 class PlotFileCanvas;
346 class PlotFileView : public wxView
348 DECLARE_DYNAMIC_CLASS(PlotFileView)
352 wxDocMDIChildFrame* m_pFrame;
353 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
355 wxDocChildFrame* m_pFrame;
356 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
359 PlotFileCanvas *m_pCanvas;
363 bool m_bMinSpecified;
364 bool m_bMaxSpecified;
367 double m_dAutoScaleFactor;
369 PlotFileCanvas *CreateCanvas (wxFrame* parent);
370 wxWindow* getFrameForChild()
372 { return theApp->getMainFrame(); }
379 virtual ~PlotFileView();
381 { m_pCanvas = NULL; m_pFrame = NULL; }
383 bool OnCreate(wxDocument *doc, long flags);
384 void OnDraw(wxDC* dc);
385 void OnUpdate(wxView *sender, wxObject *hint = NULL);
386 bool OnClose (bool deleteWindow = true);
388 void OnProperties (wxCommandEvent& event);
389 void OnScaleMinMax (wxCommandEvent& event);
390 void OnScaleAuto (wxCommandEvent& event);
391 void OnScaleFull (wxCommandEvent& event);
394 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
396 wxDocChildFrame* getFrame() { return m_pFrame; }
399 wxMenu* getFileMenu() { return m_pFileMenu; }
400 PlotFileDocument* GetDocument()
401 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
403 DECLARE_EVENT_TABLE()
406 class PlotFileCanvas: public wxScrolledWindow
409 PlotFileView* m_pView;
412 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
413 virtual ~PlotFileCanvas();
415 virtual void OnDraw(wxDC& dc);
417 void setView (PlotFileView* pView)
422 class TextFileCanvas;
423 class TextFileView: public wxView
426 DECLARE_DYNAMIC_CLASS(TextFileView)
429 wxDocMDIChildFrame* m_pFrame;
430 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
432 wxDocChildFrame* m_pFrame;
433 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
436 TextFileCanvas *m_pCanvas;
440 : wxView() , m_pFrame(0), m_pCanvas(0)
446 bool OnCreate (wxDocument *doc, long flags);
447 void OnDraw (wxDC *dc);
448 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
449 bool OnClose (bool deleteWindow = TRUE);
451 TextFileDocument* GetDocument()
452 { return dynamic_cast<TextFileDocument*>(wxView::GetDocument()); }
454 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
455 wxMenu* getFileMenu() { return m_pFileMenu; }
457 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
459 wxDocChildFrame* getFrame() { return m_pFrame; }
463 class TextFileCanvas: public wxTextCtrl
465 TextFileView *m_pView;
468 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);