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.35 2001/01/27 03:08:16 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);
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()->GetClientWindow(); }
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(wxView *view, 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()->GetClientWindow(); }
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 wxMenu* getFileMenu() { return m_pFileMenu; }
238 ProjectionFileDocument* GetDocument()
239 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
240 DECLARE_EVENT_TABLE()
243 class ProjectionFileCanvas: public wxScrolledWindow
246 ProjectionFileView* m_pView;
249 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
250 virtual ~ProjectionFileCanvas() ;
252 virtual wxSize GetBestSize() const;
253 virtual void OnDraw(wxDC& dc);
254 void setView(ProjectionFileView* pView)
260 class PhantomFileView : public wxView
263 DECLARE_DYNAMIC_CLASS(PhantomFileView)
264 DECLARE_EVENT_TABLE()
266 PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
268 wxDocMDIChildFrame* m_pFrame;
269 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
271 wxDocChildFrame* m_pFrame;
272 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
275 PhantomCanvas *m_pCanvas;
280 int m_iDefaultNSample;
281 int m_iDefaultGeometry;
283 double m_dDefaultRotation;
284 double m_dDefaultFocalLength;
285 double m_dDefaultFieldOfView;
287 int m_iDefaultRasterNX;
288 int m_iDefaultRasterNY;
289 int m_iDefaultRasterNSamples;
291 wxWindow* getFrameForChild()
293 { return theApp->getMainFrame()->GetClientWindow(); }
300 virtual ~PhantomFileView();
302 { m_pCanvas = NULL; m_pFrame = NULL; }
304 bool OnCreate(wxDocument *doc, long flags);
305 void OnUpdate(wxView *sender, wxObject *hint = NULL);
306 bool OnClose (bool deleteWindow = true);
307 void OnDraw(wxDC* dc);
308 void OnProperties (wxCommandEvent& event);
309 void OnRasterize (wxCommandEvent& event);
310 void OnProjections (wxCommandEvent& event);
312 PhantomFileDocument* GetDocument()
313 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
315 wxMenu* getFileMenu() { return m_pFileMenu; }
317 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
319 wxDocChildFrame* getFrame() { return m_pFrame; }
323 class PhantomCanvas: public wxScrolledWindow
326 PhantomFileView* m_pView;
329 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
330 virtual ~PhantomCanvas();
332 void setView(PhantomFileView* pView)
334 virtual void OnDraw(wxDC& dc);
337 class PlotFileCanvas;
338 class PlotFileView : public wxView
340 DECLARE_DYNAMIC_CLASS(PlotFileView)
344 wxDocMDIChildFrame* m_pFrame;
345 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
347 wxDocChildFrame* m_pFrame;
348 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
351 PlotFileCanvas *m_pCanvas;
355 bool m_bMinSpecified;
356 bool m_bMaxSpecified;
359 double m_dAutoScaleFactor;
361 PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
362 wxWindow* getFrameForChild()
364 { return theApp->getMainFrame()->GetClientWindow(); }
371 virtual ~PlotFileView();
373 { m_pCanvas = NULL; m_pFrame = NULL; }
375 bool OnCreate(wxDocument *doc, long flags);
376 void OnDraw(wxDC* dc);
377 void OnUpdate(wxView *sender, wxObject *hint = NULL);
378 bool OnClose (bool deleteWindow = true);
380 void OnProperties (wxCommandEvent& event);
381 void OnScaleMinMax (wxCommandEvent& event);
382 void OnScaleAuto (wxCommandEvent& event);
383 void OnScaleFull (wxCommandEvent& event);
386 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
388 wxDocChildFrame* getFrame() { return m_pFrame; }
391 wxMenu* getFileMenu() { return m_pFileMenu; }
392 PlotFileDocument* GetDocument()
393 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
395 DECLARE_EVENT_TABLE()
398 class PlotFileCanvas: public wxScrolledWindow
401 PlotFileView* m_pView;
404 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
405 virtual ~PlotFileCanvas();
407 virtual void OnDraw(wxDC& dc);
409 void setView (PlotFileView* pView)
414 class TextFileCanvas;
415 class TextFileView: public wxView
418 DECLARE_DYNAMIC_CLASS(TextFileView)
421 wxDocMDIChildFrame* m_pFrame;
422 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
424 wxDocChildFrame* m_pFrame;
425 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
428 TextFileCanvas *m_pCanvas;
432 : wxView() , m_pFrame(0), m_pCanvas(0)
438 bool OnCreate (wxDocument *doc, long flags);
439 void OnDraw (wxDC *dc);
440 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
441 bool OnClose (bool deleteWindow = TRUE);
443 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
444 wxMenu* getFileMenu() { return m_pFileMenu; }
446 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
448 wxDocChildFrame* getFrame() { return m_pFrame; }
452 class TextFileCanvas: public wxTextCtrl
454 TextFileView *m_pView;
457 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);