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.39 2001/01/30 01:21:37 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 OnChar(wxKeyEvent& event);
162 void OnMouseEvent(wxMouseEvent& event);
163 void DrawRubberBandCursor (wxDC& dc, int x, int y);
164 bool GetCurrentCursor (int& x, int& y);
166 virtual wxSize GetBestSize() const;
167 void setView(ImageFileView* pView)
171 DECLARE_EVENT_TABLE()
175 class ProjectionFileCanvas;
176 class ProjectionFileView : public wxView
178 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
180 wxMemoryDC m_memoryDC;
184 ProjectionFileCanvas *CreateCanvas (wxFrame* parent);
186 wxDocMDIChildFrame* m_pFrame;
187 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
189 wxDocChildFrame* m_pFrame;
190 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
193 ProjectionFileCanvas *m_pCanvas;
198 int m_iDefaultFilter;
199 int m_iDefaultFilterMethod;
200 double m_dDefaultFilterParam;
201 int m_iDefaultFilterGeneration;
202 int m_iDefaultZeropad;
203 int m_iDefaultInterpolation;
204 int m_iDefaultInterpParam;
205 int m_iDefaultBackprojector;
208 int m_iDefaultPolarNX;
209 int m_iDefaultPolarNY;
210 int m_iDefaultPolarInterpolation;
211 int m_iDefaultPolarZeropad;
213 wxWindow* getFrameForChild()
215 { return theApp->getMainFrame(); }
221 ProjectionFileView();
222 virtual ~ProjectionFileView();
224 { m_pCanvas = NULL; m_pFrame = NULL; }
226 bool OnCreate(wxDocument *doc, long flags);
227 void OnDraw(wxDC* dc);
228 void OnUpdate(wxView *sender, wxObject *hint = NULL);
229 bool OnClose (bool deleteWindow = true);
230 void OnProperties (wxCommandEvent& event);
231 void OnReconstructFBP (wxCommandEvent& event);
232 void OnReconstructFourier (wxCommandEvent& event);
233 void OnConvertPolar (wxCommandEvent& event);
234 void OnConvertFFTPolar (wxCommandEvent& event);
237 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
239 wxDocChildFrame* getFrame() { return m_pFrame; }
241 ProjectionFileCanvas* getCanvas() { return m_pCanvas; }
243 wxMenu* getFileMenu() { return m_pFileMenu; }
245 ProjectionFileDocument* GetDocument()
246 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
247 DECLARE_EVENT_TABLE()
250 class ProjectionFileCanvas: public wxScrolledWindow
253 ProjectionFileView* m_pView;
256 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
257 virtual ~ProjectionFileCanvas() ;
259 virtual wxSize GetBestSize() const;
260 virtual void OnDraw(wxDC& dc);
261 void setView(ProjectionFileView* pView)
267 class PhantomFileView : public wxView
270 DECLARE_DYNAMIC_CLASS(PhantomFileView)
271 DECLARE_EVENT_TABLE()
273 PhantomCanvas *CreateCanvas (wxFrame* parent);
275 wxDocMDIChildFrame* m_pFrame;
276 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
278 wxDocChildFrame* m_pFrame;
279 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
282 PhantomCanvas *m_pCanvas;
287 int m_iDefaultNSample;
288 int m_iDefaultGeometry;
290 double m_dDefaultRotation;
291 double m_dDefaultFocalLength;
292 double m_dDefaultFieldOfView;
294 int m_iDefaultRasterNX;
295 int m_iDefaultRasterNY;
296 int m_iDefaultRasterNSamples;
298 wxWindow* getFrameForChild()
300 { return theApp->getMainFrame(); }
307 virtual ~PhantomFileView();
309 { m_pCanvas = NULL; m_pFrame = NULL; }
311 bool OnCreate(wxDocument *doc, long flags);
312 void OnUpdate(wxView *sender, wxObject *hint = NULL);
313 bool OnClose (bool deleteWindow = true);
314 void OnDraw(wxDC* dc);
315 void OnProperties (wxCommandEvent& event);
316 void OnRasterize (wxCommandEvent& event);
317 void OnProjections (wxCommandEvent& event);
319 PhantomFileDocument* GetDocument()
320 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
322 wxMenu* getFileMenu() { return m_pFileMenu; }
324 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
326 wxDocChildFrame* getFrame() { return m_pFrame; }
330 class PhantomCanvas: public wxScrolledWindow
333 PhantomFileView* m_pView;
336 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
337 virtual ~PhantomCanvas();
339 void setView(PhantomFileView* pView)
341 virtual void OnDraw(wxDC& dc);
344 class PlotFileCanvas;
345 class PlotFileView : public wxView
347 DECLARE_DYNAMIC_CLASS(PlotFileView)
351 wxDocMDIChildFrame* m_pFrame;
352 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
354 wxDocChildFrame* m_pFrame;
355 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
358 PlotFileCanvas *m_pCanvas;
362 bool m_bMinSpecified;
363 bool m_bMaxSpecified;
366 double m_dAutoScaleFactor;
368 PlotFileCanvas *CreateCanvas (wxFrame* parent);
369 wxWindow* getFrameForChild()
371 { return theApp->getMainFrame(); }
378 virtual ~PlotFileView();
380 { m_pCanvas = NULL; m_pFrame = NULL; }
382 bool OnCreate(wxDocument *doc, long flags);
383 void OnDraw(wxDC* dc);
384 void OnUpdate(wxView *sender, wxObject *hint = NULL);
385 bool OnClose (bool deleteWindow = true);
387 void OnProperties (wxCommandEvent& event);
388 void OnScaleMinMax (wxCommandEvent& event);
389 void OnScaleAuto (wxCommandEvent& event);
390 void OnScaleFull (wxCommandEvent& event);
393 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
395 wxDocChildFrame* getFrame() { return m_pFrame; }
398 wxMenu* getFileMenu() { return m_pFileMenu; }
399 PlotFileDocument* GetDocument()
400 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
402 DECLARE_EVENT_TABLE()
405 class PlotFileCanvas: public wxScrolledWindow
408 PlotFileView* m_pView;
411 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
412 virtual ~PlotFileCanvas();
414 virtual void OnDraw(wxDC& dc);
416 void setView (PlotFileView* pView)
421 class TextFileCanvas;
422 class TextFileView: public wxView
425 DECLARE_DYNAMIC_CLASS(TextFileView)
428 wxDocMDIChildFrame* m_pFrame;
429 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
431 wxDocChildFrame* m_pFrame;
432 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
435 TextFileCanvas *m_pCanvas;
439 : wxView() , m_pFrame(0), m_pCanvas(0)
445 bool OnCreate (wxDocument *doc, long flags);
446 void OnDraw (wxDC *dc);
447 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
448 bool OnClose (bool deleteWindow = TRUE);
450 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
451 wxMenu* getFileMenu() { return m_pFileMenu; }
453 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
455 wxDocChildFrame* getFrame() { return m_pFrame; }
459 class TextFileCanvas: public wxTextCtrl
461 TextFileView *m_pView;
464 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);