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.33 2001/01/27 01:51:47 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
145 ImageFileView* m_pView;
150 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
151 virtual ~ImageFileCanvas();
153 virtual void OnDraw(wxDC& dc);
154 void OnMouseEvent(wxMouseEvent& event);
155 void DrawRubberBandCursor (wxDC& dc, int x, int y);
156 bool GetCurrentCursor (int& x, int& y);
158 virtual wxSize GetBestSize() const;
159 void setView(ImageFileView* pView)
163 DECLARE_EVENT_TABLE()
167 class ProjectionFileCanvas;
168 class ProjectionFileView : public wxView
170 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
172 wxMemoryDC m_memoryDC;
176 ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
178 wxDocMDIChildFrame* m_pFrame;
179 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
181 wxDocChildFrame* m_pFrame;
182 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
185 ProjectionFileCanvas *m_canvas;
190 int m_iDefaultFilter;
191 int m_iDefaultFilterMethod;
192 double m_dDefaultFilterParam;
193 int m_iDefaultFilterGeneration;
194 int m_iDefaultZeropad;
195 int m_iDefaultInterpolation;
196 int m_iDefaultInterpParam;
197 int m_iDefaultBackprojector;
200 int m_iDefaultPolarNX;
201 int m_iDefaultPolarNY;
202 int m_iDefaultPolarInterpolation;
203 int m_iDefaultPolarZeropad;
205 wxWindow* getFrameForChild()
207 { return theApp->getMainFrame()->GetClientWindow(); }
213 ProjectionFileView();
214 virtual ~ProjectionFileView();
216 { m_canvas = NULL; m_pFrame = NULL; }
218 bool OnCreate(wxDocument *doc, long flags);
219 void OnDraw(wxDC* dc);
220 void OnUpdate(wxView *sender, wxObject *hint = NULL);
221 bool OnClose (bool deleteWindow = true);
222 void OnProperties (wxCommandEvent& event);
223 void OnReconstructFBP (wxCommandEvent& event);
224 void OnReconstructFourier (wxCommandEvent& event);
225 void OnConvertPolar (wxCommandEvent& event);
226 void OnConvertFFTPolar (wxCommandEvent& event);
228 wxFrame* getFrame () { return m_pFrame; }
230 wxMenu* getFileMenu() { return m_pFileMenu; }
232 ProjectionFileDocument* GetDocument()
233 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
234 DECLARE_EVENT_TABLE()
237 class ProjectionFileCanvas: public wxScrolledWindow
240 ProjectionFileView* m_pView;
243 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
244 virtual ~ProjectionFileCanvas() ;
246 virtual wxSize GetBestSize() const;
247 virtual void OnDraw(wxDC& dc);
248 void setView(ProjectionFileView* pView)
254 class PhantomFileView : public wxView
257 DECLARE_DYNAMIC_CLASS(PhantomFileView)
258 DECLARE_EVENT_TABLE()
260 PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
262 wxDocMDIChildFrame* m_pFrame;
263 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
265 wxDocChildFrame* m_pFrame;
266 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
269 PhantomCanvas *m_canvas;
274 int m_iDefaultNSample;
275 int m_iDefaultGeometry;
277 double m_dDefaultRotation;
278 double m_dDefaultFocalLength;
279 double m_dDefaultFieldOfView;
281 int m_iDefaultRasterNX;
282 int m_iDefaultRasterNY;
283 int m_iDefaultRasterNSamples;
285 wxWindow* getFrameForChild()
287 { return theApp->getMainFrame()->GetClientWindow(); }
294 virtual ~PhantomFileView();
296 { m_canvas = NULL; m_pFrame = NULL; }
298 bool OnCreate(wxDocument *doc, long flags);
299 void OnUpdate(wxView *sender, wxObject *hint = NULL);
300 bool OnClose (bool deleteWindow = true);
301 void OnDraw(wxDC* dc);
302 void OnProperties (wxCommandEvent& event);
303 void OnRasterize (wxCommandEvent& event);
304 void OnProjections (wxCommandEvent& event);
306 PhantomFileDocument* GetDocument()
307 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
309 wxMenu* getFileMenu() { return m_pFileMenu; }
310 wxFrame* getFrame() { return m_pFrame; }
313 class PhantomCanvas: public wxScrolledWindow
316 PhantomFileView* m_pView;
319 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
320 virtual ~PhantomCanvas();
322 void setView(PhantomFileView* pView)
324 virtual void OnDraw(wxDC& dc);
327 class PlotFileCanvas;
328 class PlotFileView : public wxView
330 DECLARE_DYNAMIC_CLASS(PlotFileView)
333 PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
335 wxDocMDIChildFrame* m_pFrame;
336 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
338 wxDocChildFrame* m_pFrame;
339 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
342 PlotFileCanvas *m_canvas;
346 bool m_bMinSpecified;
347 bool m_bMaxSpecified;
350 double m_dAutoScaleFactor;
352 wxWindow* getFrameForChild()
354 { return theApp->getMainFrame()->GetClientWindow(); }
361 virtual ~PlotFileView();
363 { m_canvas = NULL; m_pFrame = NULL; }
365 bool OnCreate(wxDocument *doc, long flags);
366 void OnDraw(wxDC* dc);
367 void OnUpdate(wxView *sender, wxObject *hint = NULL);
368 bool OnClose (bool deleteWindow = true);
370 void OnProperties (wxCommandEvent& event);
371 void OnScaleMinMax (wxCommandEvent& event);
372 void OnScaleAuto (wxCommandEvent& event);
373 void OnScaleFull (wxCommandEvent& event);
378 wxMenu* getFileMenu() { return m_pFileMenu; }
379 PlotFileDocument* GetDocument()
380 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
382 DECLARE_EVENT_TABLE()
385 class PlotFileCanvas: public wxScrolledWindow
388 PlotFileView* m_pView;
391 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
392 virtual ~PlotFileCanvas();
394 virtual void OnDraw(wxDC& dc);
396 void setView (PlotFileView* pView)
401 class TextFileCanvas;
402 class TextFileView: public wxView
405 DECLARE_DYNAMIC_CLASS(TextFileView)
408 wxDocMDIChildFrame* m_pFrame;
409 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
411 wxDocChildFrame* m_pFrame;
412 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
415 TextFileCanvas *m_pCanvas;
419 : wxView() , m_pFrame(0), m_pCanvas(0)
425 bool OnCreate (wxDocument *doc, long flags);
426 void OnDraw (wxDC *dc);
427 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
428 bool OnClose (bool deleteWindow = TRUE);
430 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
431 wxFrame* getFrame() { return m_pFrame; }
432 wxMenu* getFileMenu() { return m_pFileMenu; }
435 class TextFileCanvas: public wxTextCtrl
437 TextFileView *m_pView;
440 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);