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.32 2001/01/26 23:23:00 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);
58 ImageFileCanvas *m_canvas;
63 double m_dAutoScaleFactor;
65 int m_iDefaultExportFormatID;
67 wxWindow* getFrameForChild()
69 { return theApp->getMainFrame()->GetClientWindow(); }
76 virtual ~ImageFileView();
78 { m_canvas = 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);
136 ImageFileDocument* GetDocument()
137 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
139 DECLARE_EVENT_TABLE()
142 class ImageFileCanvas: public wxScrolledWindow
148 ImageFileView* m_pView;
151 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
152 virtual ~ImageFileCanvas();
154 virtual void OnDraw(wxDC& dc);
155 void OnMouseEvent(wxMouseEvent& event);
156 void DrawRubberBandCursor (wxDC& dc, int x, int y);
157 bool GetCurrentCursor (int& x, int& y);
159 virtual wxSize GetBestSize() const;
160 void setView(ImageFileView* pView)
164 DECLARE_EVENT_TABLE()
168 class ProjectionFileCanvas;
169 class ProjectionFileView : public wxView
171 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
173 wxMemoryDC m_memoryDC;
177 ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
179 wxDocMDIChildFrame* m_pFrame;
180 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
182 wxDocChildFrame* m_pFrame;
183 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
186 ProjectionFileCanvas *m_canvas;
191 int m_iDefaultFilter;
192 int m_iDefaultFilterMethod;
193 double m_dDefaultFilterParam;
194 int m_iDefaultFilterGeneration;
195 int m_iDefaultZeropad;
196 int m_iDefaultInterpolation;
197 int m_iDefaultInterpParam;
198 int m_iDefaultBackprojector;
201 int m_iDefaultPolarNX;
202 int m_iDefaultPolarNY;
203 int m_iDefaultPolarInterpolation;
204 int m_iDefaultPolarZeropad;
206 wxWindow* getFrameForChild()
208 { return theApp->getMainFrame()->GetClientWindow(); }
214 ProjectionFileView();
215 virtual ~ProjectionFileView();
217 { m_canvas = NULL; m_pFrame = NULL; }
219 bool OnCreate(wxDocument *doc, long flags);
220 void OnDraw(wxDC* dc);
221 void OnUpdate(wxView *sender, wxObject *hint = NULL);
222 bool OnClose (bool deleteWindow = true);
223 void OnProperties (wxCommandEvent& event);
224 void OnReconstructFBP (wxCommandEvent& event);
225 void OnReconstructFourier (wxCommandEvent& event);
226 void OnConvertPolar (wxCommandEvent& event);
227 void OnConvertFFTPolar (wxCommandEvent& event);
229 wxFrame* getFrame () { return m_pFrame; }
231 wxMenu* getFileMenu() { return m_pFileMenu; }
233 ProjectionFileDocument* GetDocument()
234 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
235 DECLARE_EVENT_TABLE()
238 class ProjectionFileCanvas: public wxScrolledWindow
241 ProjectionFileView* m_pView;
244 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
245 virtual ~ProjectionFileCanvas() ;
247 virtual wxSize GetBestSize() const;
248 virtual void OnDraw(wxDC& dc);
249 void setView(ProjectionFileView* pView)
255 class PhantomFileView : public wxView
258 DECLARE_DYNAMIC_CLASS(PhantomFileView)
259 DECLARE_EVENT_TABLE()
261 PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
263 wxDocMDIChildFrame* m_pFrame;
264 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
266 wxDocChildFrame* m_pFrame;
267 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
270 PhantomCanvas *m_canvas;
275 int m_iDefaultNSample;
276 int m_iDefaultGeometry;
278 double m_dDefaultRotation;
279 double m_dDefaultFocalLength;
280 double m_dDefaultFieldOfView;
282 int m_iDefaultRasterNX;
283 int m_iDefaultRasterNY;
284 int m_iDefaultRasterNSamples;
286 wxWindow* getFrameForChild()
288 { return theApp->getMainFrame()->GetClientWindow(); }
295 virtual ~PhantomFileView();
297 { m_canvas = NULL; m_pFrame = NULL; }
299 bool OnCreate(wxDocument *doc, long flags);
300 void OnUpdate(wxView *sender, wxObject *hint = NULL);
301 bool OnClose (bool deleteWindow = true);
302 void OnDraw(wxDC* dc);
303 void OnProperties (wxCommandEvent& event);
304 void OnRasterize (wxCommandEvent& event);
305 void OnProjections (wxCommandEvent& event);
307 PhantomFileDocument* GetDocument()
308 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
310 wxMenu* getFileMenu() { return m_pFileMenu; }
311 wxFrame* getFrame() { return m_pFrame; }
314 class PhantomCanvas: public wxScrolledWindow
317 PhantomFileView* m_pView;
320 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
321 virtual ~PhantomCanvas();
323 void setView(PhantomFileView* pView)
325 virtual void OnDraw(wxDC& dc);
328 class PlotFileCanvas;
329 class PlotFileView : public wxView
331 DECLARE_DYNAMIC_CLASS(PlotFileView)
334 PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
336 wxDocMDIChildFrame* m_pFrame;
337 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
339 wxDocChildFrame* m_pFrame;
340 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
343 PlotFileCanvas *m_canvas;
347 bool m_bMinSpecified;
348 bool m_bMaxSpecified;
351 double m_dAutoScaleFactor;
353 wxWindow* getFrameForChild()
355 { return theApp->getMainFrame()->GetClientWindow(); }
362 virtual ~PlotFileView();
364 { m_canvas = NULL; m_pFrame = NULL; }
366 bool OnCreate(wxDocument *doc, long flags);
367 void OnDraw(wxDC* dc);
368 void OnUpdate(wxView *sender, wxObject *hint = NULL);
369 bool OnClose (bool deleteWindow = true);
371 void OnProperties (wxCommandEvent& event);
372 void OnScaleMinMax (wxCommandEvent& event);
373 void OnScaleAuto (wxCommandEvent& event);
374 void OnScaleFull (wxCommandEvent& event);
379 wxMenu* getFileMenu() { return m_pFileMenu; }
380 PlotFileDocument* GetDocument()
381 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
383 DECLARE_EVENT_TABLE()
386 class PlotFileCanvas: public wxScrolledWindow
389 PlotFileView* m_pView;
392 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
393 virtual ~PlotFileCanvas();
395 virtual void OnDraw(wxDC& dc);
397 void setView (PlotFileView* pView)
402 class TextFileCanvas;
403 class TextFileView: public wxView
406 DECLARE_DYNAMIC_CLASS(TextFileView)
409 wxDocMDIChildFrame* m_pFrame;
410 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
412 wxDocChildFrame* m_pFrame;
413 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
416 TextFileCanvas *m_pCanvas;
420 : wxView() , m_pFrame(0), m_pCanvas(0)
426 bool OnCreate (wxDocument *doc, long flags);
427 void OnDraw (wxDC *dc);
428 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
429 bool OnClose (bool deleteWindow = TRUE);
431 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
432 wxFrame* getFrame() { return m_pFrame; }
433 wxMenu* getFileMenu() { return m_pFileMenu; }
436 class TextFileCanvas: public wxTextCtrl
438 TextFileView *m_pView;
441 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);