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.30 2001/01/26 05:37:24 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);
49 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
52 ImageFileCanvas *m_canvas;
58 double m_dAutoScaleFactor;
60 int m_iDefaultExportFormatID;
62 wxWindow* getFrameForChild()
64 { return theApp->getMainFrame()->GetClientWindow(); }
71 virtual ~ImageFileView(void);
73 { m_canvas = NULL; m_frame = NULL; }
76 { return m_pFileMenu; }
78 bool OnCreate(wxDocument *doc, long flags);
79 void OnDraw(wxDC* dc);
80 void OnUpdate(wxView *sender, wxObject *hint = NULL);
81 bool OnClose (bool deleteWindow = true);
83 void OnScaleSize (wxCommandEvent& event);
84 void OnExport (wxCommandEvent& event);
86 void OnProperties (wxCommandEvent& event);
87 void OnCompare (wxCommandEvent& event);
89 void OnInvertValues (wxCommandEvent& event);
90 void OnSquare (wxCommandEvent& event);
91 void OnSquareRoot (wxCommandEvent& event);
92 void OnLog (wxCommandEvent& event);
93 void OnExp (wxCommandEvent& event);
94 void OnAdd (wxCommandEvent& event);
95 void OnSubtract (wxCommandEvent& event);
96 void OnMultiply (wxCommandEvent& event);
97 void OnDivide (wxCommandEvent& event);
98 void OnFourier (wxCommandEvent& event);
99 void OnInverseFourier (wxCommandEvent& event);
100 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
101 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
104 void OnFFT (wxCommandEvent& event);
105 void OnIFFT (wxCommandEvent& event);
106 void OnFFTRows (wxCommandEvent& event);
107 void OnIFFTRows (wxCommandEvent& event);
108 void OnFFTCols (wxCommandEvent& event);
109 void OnIFFTCols (wxCommandEvent& event);
112 void OnMagnitude (wxCommandEvent& event);
113 void OnPhase (wxCommandEvent& event);
115 void OnScaleAuto (wxCommandEvent& event);
116 void OnScaleMinMax (wxCommandEvent& event);
117 void OnScaleFull (wxCommandEvent& event);
118 void OnPlotRow (wxCommandEvent& event);
119 void OnPlotCol (wxCommandEvent& event);
121 void OnPlotFFTRow (wxCommandEvent& event);
122 void OnPlotFFTCol (wxCommandEvent& event);
124 void OnPlotHistogram (wxCommandEvent& event);
125 void OnCompareRow (wxCommandEvent& event);
126 void OnCompareCol (wxCommandEvent& event);
131 ImageFileDocument* GetDocument(void)
132 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
134 DECLARE_EVENT_TABLE()
137 class ImageFileCanvas: public wxScrolledWindow
143 ImageFileView* m_pView;
146 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
147 virtual ~ImageFileCanvas();
149 virtual void OnDraw(wxDC& dc);
150 void OnMouseEvent(wxMouseEvent& event);
151 void DrawRubberBandCursor (wxDC& dc, int x, int y);
152 bool GetCurrentCursor (int& x, int& y);
154 virtual wxSize GetBestSize() const;
155 void setView(ImageFileView* pView)
159 DECLARE_EVENT_TABLE()
163 class ProjectionFileCanvas;
164 class ProjectionFileView : public wxView
166 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
168 wxMemoryDC m_memoryDC;
172 ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
173 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
175 ProjectionFileCanvas *m_canvas;
181 int m_iDefaultFilter;
182 int m_iDefaultFilterMethod;
183 double m_dDefaultFilterParam;
184 int m_iDefaultFilterGeneration;
185 int m_iDefaultZeropad;
186 int m_iDefaultInterpolation;
187 int m_iDefaultInterpParam;
188 int m_iDefaultBackprojector;
191 int m_iDefaultPolarNX;
192 int m_iDefaultPolarNY;
193 int m_iDefaultPolarInterpolation;
194 int m_iDefaultPolarZeropad;
196 wxWindow* getFrameForChild()
198 { return theApp->getMainFrame()->GetClientWindow(); }
204 ProjectionFileView(void);
205 virtual ~ProjectionFileView(void);
207 { m_canvas = NULL; m_frame = NULL; }
209 bool OnCreate(wxDocument *doc, long flags);
210 void OnDraw(wxDC* dc);
211 void OnUpdate(wxView *sender, wxObject *hint = NULL);
212 bool OnClose (bool deleteWindow = true);
213 void OnProperties (wxCommandEvent& event);
214 void OnReconstructFBP (wxCommandEvent& event);
215 void OnReconstructFourier (wxCommandEvent& event);
216 void OnConvertPolar (wxCommandEvent& event);
217 void OnConvertFFTPolar (wxCommandEvent& event);
219 wxFrame* getFrame () { return m_frame; }
221 wxMenu* getFileMenu() { return m_pFileMenu; }
223 ProjectionFileDocument* GetDocument(void)
224 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
225 DECLARE_EVENT_TABLE()
228 class ProjectionFileCanvas: public wxScrolledWindow
231 ProjectionFileView* m_pView;
234 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
235 virtual ~ProjectionFileCanvas() ;
237 virtual wxSize GetBestSize() const;
238 virtual void OnDraw(wxDC& dc);
239 void setView(ProjectionFileView* pView)
245 class PhantomFileView : public wxView
248 DECLARE_DYNAMIC_CLASS(PhantomFileView)
249 DECLARE_EVENT_TABLE()
251 PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
252 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
254 PhantomCanvas *m_canvas;
260 int m_iDefaultNSample;
261 int m_iDefaultGeometry;
263 double m_dDefaultRotation;
264 double m_dDefaultFocalLength;
265 double m_dDefaultFieldOfView;
267 int m_iDefaultRasterNX;
268 int m_iDefaultRasterNY;
269 int m_iDefaultRasterNSamples;
271 wxWindow* getFrameForChild()
273 { return theApp->getMainFrame()->GetClientWindow(); }
279 PhantomFileView(void);
280 virtual ~PhantomFileView(void);
282 { m_canvas = NULL; m_frame = NULL; }
284 bool OnCreate(wxDocument *doc, long flags);
285 void OnUpdate(wxView *sender, wxObject *hint = NULL);
286 bool OnClose (bool deleteWindow = true);
287 void OnDraw(wxDC* dc);
288 void OnProperties (wxCommandEvent& event);
289 void OnRasterize (wxCommandEvent& event);
290 void OnProjections (wxCommandEvent& event);
292 PhantomFileDocument* GetDocument(void)
293 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
295 wxMenu* getFileMenu() { return m_pFileMenu; }
296 wxFrame* getFrame() { return m_frame; }
299 class PhantomCanvas: public wxScrolledWindow
302 PhantomFileView* m_pView;
305 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
306 virtual ~PhantomCanvas();
308 void setView(PhantomFileView* pView)
310 virtual void OnDraw(wxDC& dc);
313 class PlotFileCanvas;
314 class PlotFileView : public wxView
316 DECLARE_DYNAMIC_CLASS(PlotFileView)
319 PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
320 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
322 PlotFileCanvas *m_canvas;
327 bool m_bMinSpecified;
328 bool m_bMaxSpecified;
331 double m_dAutoScaleFactor;
333 wxWindow* getFrameForChild()
335 { return theApp->getMainFrame()->GetClientWindow(); }
342 virtual ~PlotFileView(void);
344 { m_canvas = NULL; m_frame = NULL; }
346 bool OnCreate(wxDocument *doc, long flags);
347 void OnDraw(wxDC* dc);
348 void OnUpdate(wxView *sender, wxObject *hint = NULL);
349 bool OnClose (bool deleteWindow = true);
351 void OnProperties (wxCommandEvent& event);
352 void OnScaleMinMax (wxCommandEvent& event);
353 void OnScaleAuto (wxCommandEvent& event);
354 void OnScaleFull (wxCommandEvent& event);
359 wxMenu* getFileMenu() { return m_pFileMenu; }
360 PlotFileDocument* GetDocument(void)
361 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
363 DECLARE_EVENT_TABLE()
366 class PlotFileCanvas: public wxScrolledWindow
369 PlotFileView* m_pView;
372 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
373 virtual ~PlotFileCanvas();
375 virtual void OnDraw(wxDC& dc);
377 void setView (PlotFileView* pView)
382 class TextFileCanvas;
383 class TextFileView: public wxView
386 DECLARE_DYNAMIC_CLASS(TextFileView)
390 TextFileCanvas *m_pCanvas;
394 : wxView() , m_pFrame(0), m_pCanvas(0)
400 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
402 bool OnCreate (wxDocument *doc, long flags);
403 void OnDraw (wxDC *dc);
404 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
405 bool OnClose (bool deleteWindow = TRUE);
407 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
408 wxFrame* getFrame() { return m_pFrame; }
409 wxMenu* getFileMenu() { return m_pFileMenu; }
412 class TextFileCanvas: public wxTextCtrl
414 TextFileView *m_pView;
417 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);