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.43 2001/01/30 10:58:14 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);
109 void OnConvert3d (wxCommandEvent& event);
112 void OnFFT (wxCommandEvent& event);
113 void OnIFFT (wxCommandEvent& event);
114 void OnFFTRows (wxCommandEvent& event);
115 void OnIFFTRows (wxCommandEvent& event);
116 void OnFFTCols (wxCommandEvent& event);
117 void OnIFFTCols (wxCommandEvent& event);
120 void OnMagnitude (wxCommandEvent& event);
121 void OnPhase (wxCommandEvent& event);
123 void OnScaleAuto (wxCommandEvent& event);
124 void OnScaleMinMax (wxCommandEvent& event);
125 void OnScaleFull (wxCommandEvent& event);
126 void OnPlotRow (wxCommandEvent& event);
127 void OnPlotCol (wxCommandEvent& event);
129 void OnPlotFFTRow (wxCommandEvent& event);
130 void OnPlotFFTCol (wxCommandEvent& event);
132 void OnPlotHistogram (wxCommandEvent& event);
133 void OnCompareRow (wxCommandEvent& event);
134 void OnCompareCol (wxCommandEvent& event);
137 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
139 wxDocChildFrame* getFrame() { return m_pFrame; }
142 wxMenu* getMenuAnalyze() { return m_pMenuAnalyze; }
144 ImageFileDocument* GetDocument()
145 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
147 DECLARE_EVENT_TABLE()
150 class ImageFileCanvas: public wxScrolledWindow
153 ImageFileView* m_pView;
159 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
160 virtual ~ImageFileCanvas();
162 virtual void OnDraw(wxDC& dc);
163 void OnChar(wxKeyEvent& event);
164 void OnMouseEvent(wxMouseEvent& event);
165 void DrawRubberBandCursor (wxDC& dc, int x, int y);
166 bool GetCurrentCursor (int& x, int& y);
168 virtual wxSize GetBestSize() const;
169 void setView(ImageFileView* pView)
173 DECLARE_EVENT_TABLE()
177 class ProjectionFileCanvas;
178 class ProjectionFileView : public wxView
180 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
182 wxMemoryDC m_memoryDC;
186 ProjectionFileCanvas *CreateCanvas (wxFrame* parent);
188 wxDocMDIChildFrame* m_pFrame;
189 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
191 wxDocChildFrame* m_pFrame;
192 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
195 ProjectionFileCanvas *m_pCanvas;
200 int m_iDefaultFilter;
201 int m_iDefaultFilterMethod;
202 double m_dDefaultFilterParam;
203 int m_iDefaultFilterGeneration;
204 int m_iDefaultZeropad;
205 int m_iDefaultInterpolation;
206 int m_iDefaultInterpParam;
207 int m_iDefaultBackprojector;
210 int m_iDefaultPolarNX;
211 int m_iDefaultPolarNY;
212 int m_iDefaultPolarInterpolation;
213 int m_iDefaultPolarZeropad;
215 wxWindow* getFrameForChild()
217 { return theApp->getMainFrame(); }
223 ProjectionFileView();
224 virtual ~ProjectionFileView();
226 { m_pCanvas = NULL; m_pFrame = NULL; }
228 bool OnCreate(wxDocument *doc, long flags);
229 void OnDraw(wxDC* dc);
230 void OnUpdate(wxView *sender, wxObject *hint = NULL);
231 bool OnClose (bool deleteWindow = true);
232 void OnProperties (wxCommandEvent& event);
233 void OnReconstructFBP (wxCommandEvent& event);
234 void OnReconstructFourier (wxCommandEvent& event);
235 void OnConvertPolar (wxCommandEvent& event);
236 void OnConvertFFTPolar (wxCommandEvent& event);
239 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
241 wxDocChildFrame* getFrame() { return m_pFrame; }
243 ProjectionFileCanvas* getCanvas() { return m_pCanvas; }
245 wxMenu* getFileMenu() { return m_pFileMenu; }
247 ProjectionFileDocument* GetDocument()
248 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
249 DECLARE_EVENT_TABLE()
252 class ProjectionFileCanvas: public wxScrolledWindow
255 ProjectionFileView* m_pView;
258 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
259 virtual ~ProjectionFileCanvas() ;
261 virtual wxSize GetBestSize() const;
262 virtual void OnDraw(wxDC& dc);
263 void setView(ProjectionFileView* pView)
269 class PhantomFileView : public wxView
272 DECLARE_DYNAMIC_CLASS(PhantomFileView)
273 DECLARE_EVENT_TABLE()
275 PhantomCanvas *CreateCanvas (wxFrame* parent);
277 wxDocMDIChildFrame* m_pFrame;
278 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
280 wxDocChildFrame* m_pFrame;
281 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
284 PhantomCanvas *m_pCanvas;
289 int m_iDefaultNSample;
290 int m_iDefaultGeometry;
292 double m_dDefaultRotation;
293 double m_dDefaultFocalLength;
294 double m_dDefaultFieldOfView;
296 int m_iDefaultRasterNX;
297 int m_iDefaultRasterNY;
298 int m_iDefaultRasterNSamples;
300 wxWindow* getFrameForChild()
302 { return theApp->getMainFrame(); }
309 virtual ~PhantomFileView();
311 { m_pCanvas = NULL; m_pFrame = NULL; }
313 bool OnCreate(wxDocument *doc, long flags);
314 void OnUpdate(wxView *sender, wxObject *hint = NULL);
315 bool OnClose (bool deleteWindow = true);
316 void OnDraw(wxDC* dc);
317 void OnProperties (wxCommandEvent& event);
318 void OnRasterize (wxCommandEvent& event);
319 void OnProjections (wxCommandEvent& event);
321 PhantomFileDocument* GetDocument()
322 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
324 wxMenu* getFileMenu() { return m_pFileMenu; }
326 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
328 wxDocChildFrame* getFrame() { return m_pFrame; }
332 class PhantomCanvas: public wxScrolledWindow
335 PhantomFileView* m_pView;
338 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
339 virtual ~PhantomCanvas();
341 void setView(PhantomFileView* pView)
343 virtual void OnDraw(wxDC& dc);
346 class PlotFileCanvas;
347 class PlotFileView : public wxView
349 DECLARE_DYNAMIC_CLASS(PlotFileView)
353 wxDocMDIChildFrame* m_pFrame;
354 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
356 wxDocChildFrame* m_pFrame;
357 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
360 PlotFileCanvas *m_pCanvas;
364 bool m_bMinSpecified;
365 bool m_bMaxSpecified;
368 double m_dAutoScaleFactor;
370 PlotFileCanvas *CreateCanvas (wxFrame* parent);
371 wxWindow* getFrameForChild()
373 { return theApp->getMainFrame(); }
380 virtual ~PlotFileView();
382 { m_pCanvas = NULL; m_pFrame = NULL; }
384 bool OnCreate(wxDocument *doc, long flags);
385 void OnDraw(wxDC* dc);
386 void OnUpdate(wxView *sender, wxObject *hint = NULL);
387 bool OnClose (bool deleteWindow = true);
389 void OnProperties (wxCommandEvent& event);
390 void OnScaleMinMax (wxCommandEvent& event);
391 void OnScaleAuto (wxCommandEvent& event);
392 void OnScaleFull (wxCommandEvent& event);
395 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
397 wxDocChildFrame* getFrame() { return m_pFrame; }
400 wxMenu* getFileMenu() { return m_pFileMenu; }
401 PlotFileDocument* GetDocument()
402 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
404 DECLARE_EVENT_TABLE()
407 class PlotFileCanvas: public wxScrolledWindow
410 PlotFileView* m_pView;
413 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
414 virtual ~PlotFileCanvas();
416 virtual void OnDraw(wxDC& dc);
418 void setView (PlotFileView* pView)
423 class TextFileCanvas;
424 class TextFileView: public wxView
427 DECLARE_DYNAMIC_CLASS(TextFileView)
430 wxDocMDIChildFrame* m_pFrame;
431 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
433 wxDocChildFrame* m_pFrame;
434 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
437 TextFileCanvas *m_pCanvas;
441 : wxView() , m_pFrame(0), m_pCanvas(0)
447 bool OnCreate (wxDocument *doc, long flags);
448 void OnDraw (wxDC *dc);
449 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
450 bool OnClose (bool deleteWindow = TRUE);
452 TextFileDocument* GetDocument()
453 { return dynamic_cast<TextFileDocument*>(wxView::GetDocument()); }
455 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
456 wxMenu* getFileMenu() { return m_pFileMenu; }
458 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
460 wxDocChildFrame* getFrame() { return m_pFrame; }
464 class TextFileCanvas: public wxTextCtrl
466 TextFileView *m_pView;
469 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);