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.45 2001/02/08 06:25:07 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"
40 #include "graph3dview.h"
43 class ImageFileCanvas;
44 class ImageFileView : public wxView
47 DECLARE_DYNAMIC_CLASS(ImageFileView)
49 wxMemoryDC m_memoryDC;
51 wxMenu* m_pMenuAnalyze;
53 ImageFileCanvas *CreateCanvas (wxFrame* parent);
55 wxDocMDIChildFrame* m_pFrame;
56 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
58 wxDocChildFrame* m_pFrame;
59 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
62 ImageFileCanvas *m_pCanvas;
68 double m_dAutoScaleFactor;
70 int m_iDefaultExportFormatID;
72 wxWindow* getFrameForChild()
74 { return theApp->getMainFrame(); }
81 virtual ~ImageFileView();
83 { m_pCanvas = NULL; m_pFrame = NULL; }
86 { return m_pFileMenu; }
88 bool OnCreate(wxDocument *doc, long flags);
89 void OnDraw(wxDC* dc);
90 void OnUpdate(wxView *sender, wxObject *hint = NULL);
91 bool OnClose (bool deleteWindow = true);
93 void OnRevert (wxCommandEvent& event);
94 void OnExport (wxCommandEvent& event);
95 void OnProperties (wxCommandEvent& event);
97 void OnCompare (wxCommandEvent& event);
98 void OnScaleSize (wxCommandEvent& event);
99 void OnInvertValues (wxCommandEvent& event);
100 void OnSquare (wxCommandEvent& event);
101 void OnSquareRoot (wxCommandEvent& event);
102 void OnLog (wxCommandEvent& event);
103 void OnExp (wxCommandEvent& event);
104 void OnAdd (wxCommandEvent& event);
105 void OnSubtract (wxCommandEvent& event);
106 void OnMultiply (wxCommandEvent& event);
107 void OnDivide (wxCommandEvent& event);
108 void OnFourier (wxCommandEvent& event);
109 void OnInverseFourier (wxCommandEvent& event);
110 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
111 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
113 void OnConvert3d (wxCommandEvent& event);
117 void OnFFT (wxCommandEvent& event);
118 void OnIFFT (wxCommandEvent& event);
119 void OnFFTRows (wxCommandEvent& event);
120 void OnIFFTRows (wxCommandEvent& event);
121 void OnFFTCols (wxCommandEvent& event);
122 void OnIFFTCols (wxCommandEvent& event);
125 void OnMagnitude (wxCommandEvent& event);
126 void OnPhase (wxCommandEvent& event);
128 void OnScaleAuto (wxCommandEvent& event);
129 void OnScaleMinMax (wxCommandEvent& event);
130 void OnScaleFull (wxCommandEvent& event);
131 void OnPlotRow (wxCommandEvent& event);
132 void OnPlotCol (wxCommandEvent& event);
134 void OnPlotFFTRow (wxCommandEvent& event);
135 void OnPlotFFTCol (wxCommandEvent& event);
137 void OnPlotHistogram (wxCommandEvent& event);
138 void OnCompareRow (wxCommandEvent& event);
139 void OnCompareCol (wxCommandEvent& event);
142 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
144 wxDocChildFrame* getFrame() { return m_pFrame; }
147 wxMenu* getMenuAnalyze() { return m_pMenuAnalyze; }
149 ImageFileDocument* GetDocument()
150 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
152 DECLARE_EVENT_TABLE()
155 class ImageFileCanvas: public wxScrolledWindow
158 ImageFileView* m_pView;
164 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
165 virtual ~ImageFileCanvas();
167 virtual void OnDraw(wxDC& dc);
168 void OnChar(wxKeyEvent& event);
169 void OnMouseEvent(wxMouseEvent& event);
170 void DrawRubberBandCursor (wxDC& dc, int x, int y);
171 bool GetCurrentCursor (int& x, int& y);
173 virtual wxSize GetBestSize() const;
174 void setView(ImageFileView* pView)
178 DECLARE_EVENT_TABLE()
182 class ProjectionFileCanvas;
183 class ProjectionFileView : public wxView
185 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
187 wxMemoryDC m_memoryDC;
191 ProjectionFileCanvas *CreateCanvas (wxFrame* parent);
193 wxDocMDIChildFrame* m_pFrame;
194 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
196 wxDocChildFrame* m_pFrame;
197 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
200 ProjectionFileCanvas *m_pCanvas;
205 int m_iDefaultFilter;
206 int m_iDefaultFilterMethod;
207 double m_dDefaultFilterParam;
208 int m_iDefaultFilterGeneration;
209 int m_iDefaultZeropad;
210 int m_iDefaultInterpolation;
211 int m_iDefaultInterpParam;
212 int m_iDefaultBackprojector;
215 int m_iDefaultPolarNX;
216 int m_iDefaultPolarNY;
217 int m_iDefaultPolarInterpolation;
218 int m_iDefaultPolarZeropad;
220 wxWindow* getFrameForChild()
222 { return theApp->getMainFrame(); }
228 ProjectionFileView();
229 virtual ~ProjectionFileView();
231 { m_pCanvas = NULL; m_pFrame = NULL; }
233 bool OnCreate(wxDocument *doc, long flags);
234 void OnDraw(wxDC* dc);
235 void OnUpdate(wxView *sender, wxObject *hint = NULL);
236 bool OnClose (bool deleteWindow = true);
237 void OnProperties (wxCommandEvent& event);
238 void OnReconstructFBP (wxCommandEvent& event);
239 void OnReconstructFourier (wxCommandEvent& event);
240 void OnConvertPolar (wxCommandEvent& event);
241 void OnConvertFFTPolar (wxCommandEvent& event);
244 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
246 wxDocChildFrame* getFrame() { return m_pFrame; }
248 ProjectionFileCanvas* getCanvas() { return m_pCanvas; }
250 wxMenu* getFileMenu() { return m_pFileMenu; }
252 ProjectionFileDocument* GetDocument()
253 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
254 DECLARE_EVENT_TABLE()
257 class ProjectionFileCanvas: public wxScrolledWindow
260 ProjectionFileView* m_pView;
263 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
264 virtual ~ProjectionFileCanvas() ;
266 virtual wxSize GetBestSize() const;
267 virtual void OnDraw(wxDC& dc);
268 void setView(ProjectionFileView* pView)
274 class PhantomFileView : public wxView
277 DECLARE_DYNAMIC_CLASS(PhantomFileView)
278 DECLARE_EVENT_TABLE()
280 PhantomCanvas *CreateCanvas (wxFrame* parent);
282 wxDocMDIChildFrame* m_pFrame;
283 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
285 wxDocChildFrame* m_pFrame;
286 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
289 PhantomCanvas *m_pCanvas;
294 int m_iDefaultNSample;
295 int m_iDefaultGeometry;
297 double m_dDefaultRotation;
298 double m_dDefaultFocalLength;
299 double m_dDefaultViewRatio;
300 double m_dDefaultScanRatio;
302 int m_iDefaultRasterNX;
303 int m_iDefaultRasterNY;
304 int m_iDefaultRasterNSamples;
305 double m_dDefaultRasterViewRatio;
307 wxWindow* getFrameForChild()
309 { return theApp->getMainFrame(); }
316 virtual ~PhantomFileView();
318 { m_pCanvas = NULL; m_pFrame = NULL; }
320 bool OnCreate(wxDocument *doc, long flags);
321 void OnUpdate(wxView *sender, wxObject *hint = NULL);
322 bool OnClose (bool deleteWindow = true);
323 void OnDraw(wxDC* dc);
324 void OnProperties (wxCommandEvent& event);
325 void OnRasterize (wxCommandEvent& event);
326 void OnProjections (wxCommandEvent& event);
328 PhantomFileDocument* GetDocument()
329 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
331 wxMenu* getFileMenu() { return m_pFileMenu; }
333 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
335 wxDocChildFrame* getFrame() { return m_pFrame; }
339 class PhantomCanvas: public wxScrolledWindow
342 PhantomFileView* m_pView;
345 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
346 virtual ~PhantomCanvas();
348 virtual wxSize GetBestSize() const;
349 void setView(PhantomFileView* pView)
351 virtual void OnDraw(wxDC& dc);
354 class PlotFileCanvas;
355 class PlotFileView : public wxView
357 DECLARE_DYNAMIC_CLASS(PlotFileView)
361 wxDocMDIChildFrame* m_pFrame;
362 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
364 wxDocChildFrame* m_pFrame;
365 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
368 PlotFileCanvas *m_pCanvas;
372 bool m_bMinSpecified;
373 bool m_bMaxSpecified;
376 double m_dAutoScaleFactor;
378 PlotFileCanvas *CreateCanvas (wxFrame* parent);
379 wxWindow* getFrameForChild()
381 { return theApp->getMainFrame(); }
388 virtual ~PlotFileView();
390 { m_pCanvas = NULL; m_pFrame = NULL; }
392 bool OnCreate(wxDocument *doc, long flags);
393 void OnDraw(wxDC* dc);
394 void OnUpdate(wxView *sender, wxObject *hint = NULL);
395 bool OnClose (bool deleteWindow = true);
397 void OnProperties (wxCommandEvent& event);
398 void OnScaleMinMax (wxCommandEvent& event);
399 void OnScaleAuto (wxCommandEvent& event);
400 void OnScaleFull (wxCommandEvent& event);
403 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
405 wxDocChildFrame* getFrame() { return m_pFrame; }
408 wxMenu* getFileMenu() { return m_pFileMenu; }
409 PlotFileDocument* GetDocument()
410 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
412 DECLARE_EVENT_TABLE()
415 class PlotFileCanvas: public wxScrolledWindow
418 PlotFileView* m_pView;
421 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
422 virtual ~PlotFileCanvas();
424 virtual void OnDraw(wxDC& dc);
426 void setView (PlotFileView* pView)
431 class TextFileCanvas;
432 class TextFileView: public wxView
435 DECLARE_DYNAMIC_CLASS(TextFileView)
438 wxDocMDIChildFrame* m_pFrame;
439 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
441 wxDocChildFrame* m_pFrame;
442 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
445 TextFileCanvas *m_pCanvas;
449 : wxView() , m_pFrame(0), m_pCanvas(0)
455 bool OnCreate (wxDocument *doc, long flags);
456 void OnDraw (wxDC *dc);
457 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
458 bool OnClose (bool deleteWindow = TRUE);
460 TextFileDocument* GetDocument()
461 { return dynamic_cast<TextFileDocument*>(wxView::GetDocument()); }
463 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
464 wxMenu* getFileMenu() { return m_pFileMenu; }
466 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
468 wxDocChildFrame* getFrame() { return m_pFrame; }
472 class TextFileCanvas: public wxTextCtrl
474 TextFileView *m_pView;
477 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);