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.27 2001/01/20 08:10:33 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
42 DECLARE_DYNAMIC_CLASS(ImageFileView)
44 wxMemoryDC m_memoryDC;
48 ImageFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
49 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
51 ImageFileCanvas *m_canvas;
57 double m_dAutoScaleFactor;
59 int m_iDefaultExportFormatID;
61 wxFrame* getFrameForChild()
63 { return theApp->getMainFrame(); }
70 virtual ~ImageFileView(void);
72 bool OnCreate(wxDocument *doc, long flags);
73 void OnDraw(wxDC* dc);
74 void OnUpdate(wxView *sender, wxObject *hint = NULL);
75 bool OnClose (bool deleteWindow = true);
77 void OnScaleSize (wxCommandEvent& event);
78 void OnExport (wxCommandEvent& event);
80 void OnProperties (wxCommandEvent& event);
81 void OnCompare (wxCommandEvent& event);
83 void OnInvertValues (wxCommandEvent& event);
84 void OnSquare (wxCommandEvent& event);
85 void OnSquareRoot (wxCommandEvent& event);
86 void OnLog (wxCommandEvent& event);
87 void OnExp (wxCommandEvent& event);
88 void OnAdd (wxCommandEvent& event);
89 void OnSubtract (wxCommandEvent& event);
90 void OnMultiply (wxCommandEvent& event);
91 void OnDivide (wxCommandEvent& event);
92 void OnFourier (wxCommandEvent& event);
93 void OnInverseFourier (wxCommandEvent& event);
94 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
95 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
98 void OnFFT (wxCommandEvent& event);
99 void OnIFFT (wxCommandEvent& event);
100 void OnFFTRows (wxCommandEvent& event);
101 void OnIFFTRows (wxCommandEvent& event);
102 void OnFFTCols (wxCommandEvent& event);
103 void OnIFFTCols (wxCommandEvent& event);
106 void OnMagnitude (wxCommandEvent& event);
107 void OnPhase (wxCommandEvent& event);
109 void OnScaleAuto (wxCommandEvent& event);
110 void OnScaleMinMax (wxCommandEvent& event);
111 void OnScaleFull (wxCommandEvent& event);
112 void OnPlotRow (wxCommandEvent& event);
113 void OnPlotCol (wxCommandEvent& event);
115 void OnPlotFFTRow (wxCommandEvent& event);
116 void OnPlotFFTCol (wxCommandEvent& event);
118 void OnPlotHistogram (wxCommandEvent& event);
119 void OnCompareRow (wxCommandEvent& event);
120 void OnCompareCol (wxCommandEvent& event);
125 ImageFileDocument* GetDocument(void)
126 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
128 DECLARE_EVENT_TABLE()
131 class ImageFileCanvas: public wxScrolledWindow
137 ImageFileView* m_pView;
140 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
141 virtual ~ImageFileCanvas()
144 virtual void OnDraw(wxDC& dc);
145 void OnMouseEvent(wxMouseEvent& event);
146 void DrawRubberBandCursor (wxDC& dc, int x, int y);
147 bool GetCurrentCursor (int& x, int& y);
149 virtual wxSize GetBestSize() const;
151 DECLARE_EVENT_TABLE()
155 class ProjectionFileCanvas;
156 class ProjectionFileView : public wxView
158 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
160 wxMemoryDC m_memoryDC;
164 ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
165 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
167 ProjectionFileCanvas *m_canvas;
172 int m_iDefaultFilter;
173 int m_iDefaultFilterMethod;
174 double m_dDefaultFilterParam;
175 int m_iDefaultFilterGeneration;
176 int m_iDefaultZeropad;
177 int m_iDefaultInterpolation;
178 int m_iDefaultInterpParam;
179 int m_iDefaultBackprojector;
182 int m_iDefaultPolarNX;
183 int m_iDefaultPolarNY;
184 int m_iDefaultPolarInterpolation;
185 int m_iDefaultPolarZeropad;
187 wxFrame* getFrameForChild()
189 { return theApp->getMainFrame(); }
195 ProjectionFileView(void);
196 virtual ~ProjectionFileView(void);
198 bool OnCreate(wxDocument *doc, long flags);
199 void OnDraw(wxDC* dc);
200 void OnUpdate(wxView *sender, wxObject *hint = NULL);
201 bool OnClose (bool deleteWindow = true);
202 void OnProperties (wxCommandEvent& event);
203 void OnReconstructFBP (wxCommandEvent& event);
204 void OnReconstructFourier (wxCommandEvent& event);
205 void OnConvertPolar (wxCommandEvent& event);
206 void OnConvertFFTPolar (wxCommandEvent& event);
211 ProjectionFileDocument* GetDocument(void)
212 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
213 DECLARE_EVENT_TABLE()
216 class ProjectionFileCanvas: public wxScrolledWindow
219 ProjectionFileView* m_pView;
222 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
223 virtual ~ProjectionFileCanvas()
226 virtual wxSize GetBestSize() const;
228 virtual void OnDraw(wxDC& dc);
233 class PhantomView : public wxView
235 DECLARE_DYNAMIC_CLASS(PhantomView)
238 PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
239 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
241 PhantomCanvas *m_canvas;
246 int m_iDefaultNSample;
247 int m_iDefaultGeometry;
249 double m_dDefaultRotation;
250 double m_dDefaultFocalLength;
251 double m_dDefaultFieldOfView;
253 int m_iDefaultRasterNX;
254 int m_iDefaultRasterNY;
255 int m_iDefaultRasterNSamples;
257 wxFrame* getFrameForChild()
259 { return theApp->getMainFrame(); }
266 virtual ~PhantomView(void);
268 bool OnCreate(wxDocument *doc, long flags);
269 void OnUpdate(wxView *sender, wxObject *hint = NULL);
270 bool OnClose (bool deleteWindow = true);
271 void OnDraw(wxDC* dc);
272 void OnProperties (wxCommandEvent& event);
273 void OnRasterize (wxCommandEvent& event);
274 void OnProjections (wxCommandEvent& event);
276 PhantomDocument* GetDocument(void)
277 { return dynamic_cast<PhantomDocument*>(wxView::GetDocument()); }
279 DECLARE_EVENT_TABLE()
282 class PhantomCanvas: public wxScrolledWindow
285 PhantomView* m_pView;
288 PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
289 virtual ~PhantomCanvas()
292 virtual void OnDraw(wxDC& dc);
295 class PlotFileCanvas;
296 class PlotFileView : public wxView
298 DECLARE_DYNAMIC_CLASS(PlotFileView)
301 PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
302 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
304 PlotFileCanvas *m_canvas;
308 bool m_bMinSpecified;
309 bool m_bMaxSpecified;
312 double m_dAutoScaleFactor;
314 wxFrame* getFrameForChild()
316 { return theApp->getMainFrame(); }
323 virtual ~PlotFileView(void);
325 bool OnCreate(wxDocument *doc, long flags);
326 void OnDraw(wxDC* dc);
327 void OnUpdate(wxView *sender, wxObject *hint = NULL);
328 bool OnClose (bool deleteWindow = true);
330 void OnProperties (wxCommandEvent& event);
331 void OnScaleMinMax (wxCommandEvent& event);
332 void OnScaleAuto (wxCommandEvent& event);
333 void OnScaleFull (wxCommandEvent& event);
338 PlotFileDocument* GetDocument(void)
339 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
341 DECLARE_EVENT_TABLE()
344 class PlotFileCanvas: public wxScrolledWindow
347 PlotFileView* m_pView;
350 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
351 virtual ~PlotFileCanvas()
354 virtual void OnDraw(wxDC& dc);