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.26 2001/01/06 15:33:15 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;
63 virtual ~ImageFileView(void);
65 bool OnCreate(wxDocument *doc, long flags);
66 void OnDraw(wxDC* dc);
67 void OnUpdate(wxView *sender, wxObject *hint = NULL);
68 bool OnClose (bool deleteWindow = true);
70 void OnScaleSize (wxCommandEvent& event);
71 void OnExport (wxCommandEvent& event);
73 void OnProperties (wxCommandEvent& event);
74 void OnCompare (wxCommandEvent& event);
76 void OnInvertValues (wxCommandEvent& event);
77 void OnSquare (wxCommandEvent& event);
78 void OnSquareRoot (wxCommandEvent& event);
79 void OnLog (wxCommandEvent& event);
80 void OnExp (wxCommandEvent& event);
81 void OnAdd (wxCommandEvent& event);
82 void OnSubtract (wxCommandEvent& event);
83 void OnMultiply (wxCommandEvent& event);
84 void OnDivide (wxCommandEvent& event);
85 void OnFourier (wxCommandEvent& event);
86 void OnInverseFourier (wxCommandEvent& event);
87 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
88 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
91 void OnFFT (wxCommandEvent& event);
92 void OnIFFT (wxCommandEvent& event);
93 void OnFFTRows (wxCommandEvent& event);
94 void OnIFFTRows (wxCommandEvent& event);
95 void OnFFTCols (wxCommandEvent& event);
96 void OnIFFTCols (wxCommandEvent& event);
99 void OnMagnitude (wxCommandEvent& event);
100 void OnPhase (wxCommandEvent& event);
102 void OnScaleAuto (wxCommandEvent& event);
103 void OnScaleMinMax (wxCommandEvent& event);
104 void OnScaleFull (wxCommandEvent& event);
105 void OnPlotRow (wxCommandEvent& event);
106 void OnPlotCol (wxCommandEvent& event);
108 void OnPlotFFTRow (wxCommandEvent& event);
109 void OnPlotFFTCol (wxCommandEvent& event);
111 void OnPlotHistogram (wxCommandEvent& event);
112 void OnCompareRow (wxCommandEvent& event);
113 void OnCompareCol (wxCommandEvent& event);
118 ImageFileDocument* GetDocument(void)
119 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
121 DECLARE_EVENT_TABLE()
124 class ImageFileCanvas: public wxScrolledWindow
132 ImageFileView* m_pView;
134 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
135 virtual void OnDraw(wxDC& dc);
136 void OnMouseEvent(wxMouseEvent& event);
137 void DrawRubberBandCursor (wxDC& dc, int x, int y);
138 bool GetCurrentCursor (int& x, int& y);
140 DECLARE_EVENT_TABLE()
144 class ProjectionFileCanvas;
145 class ProjectionFileView : public wxView
147 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
149 wxMemoryDC m_memoryDC;
153 ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
154 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
156 ProjectionFileCanvas *m_canvas;
161 int m_iDefaultFilter;
162 int m_iDefaultFilterMethod;
163 double m_dDefaultFilterParam;
164 int m_iDefaultFilterGeneration;
165 int m_iDefaultZeropad;
166 int m_iDefaultInterpolation;
167 int m_iDefaultInterpParam;
168 int m_iDefaultBackprojector;
171 int m_iDefaultPolarNX;
172 int m_iDefaultPolarNY;
173 int m_iDefaultPolarInterpolation;
174 int m_iDefaultPolarZeropad;
177 ProjectionFileView(void);
178 virtual ~ProjectionFileView(void);
180 bool OnCreate(wxDocument *doc, long flags);
181 void OnDraw(wxDC* dc);
182 void OnUpdate(wxView *sender, wxObject *hint = NULL);
183 bool OnClose (bool deleteWindow = true);
184 void OnProperties (wxCommandEvent& event);
185 void OnReconstructFBP (wxCommandEvent& event);
186 void OnReconstructFourier (wxCommandEvent& event);
187 void OnConvertPolar (wxCommandEvent& event);
188 void OnConvertFFTPolar (wxCommandEvent& event);
193 ProjectionFileDocument* GetDocument(void)
194 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
195 DECLARE_EVENT_TABLE()
198 class ProjectionFileCanvas: public wxScrolledWindow
201 ProjectionFileView* m_pView;
203 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
204 virtual void OnDraw(wxDC& dc);
209 class PhantomView : public wxView
211 DECLARE_DYNAMIC_CLASS(PhantomView)
214 PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
215 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
217 PhantomCanvas *m_canvas;
222 int m_iDefaultNSample;
223 int m_iDefaultGeometry;
225 double m_dDefaultRotation;
226 double m_dDefaultFocalLength;
227 double m_dDefaultFieldOfView;
229 int m_iDefaultRasterNX;
230 int m_iDefaultRasterNY;
231 int m_iDefaultRasterNSamples;
235 virtual ~PhantomView(void);
237 bool OnCreate(wxDocument *doc, long flags);
238 void OnUpdate(wxView *sender, wxObject *hint = NULL);
239 bool OnClose (bool deleteWindow = true);
240 void OnDraw(wxDC* dc);
241 void OnProperties (wxCommandEvent& event);
242 void OnRasterize (wxCommandEvent& event);
243 void OnProjections (wxCommandEvent& event);
245 PhantomDocument* GetDocument(void)
246 { return dynamic_cast<PhantomDocument*>(wxView::GetDocument()); }
248 DECLARE_EVENT_TABLE()
251 class PhantomCanvas: public wxScrolledWindow
254 PhantomView* m_pView;
256 PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
257 virtual void OnDraw(wxDC& dc);
260 class PlotFileCanvas;
261 class PlotFileView : public wxView
263 DECLARE_DYNAMIC_CLASS(PlotFileView)
266 PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
267 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
269 PlotFileCanvas *m_canvas;
273 bool m_bMinSpecified;
274 bool m_bMaxSpecified;
277 double m_dAutoScaleFactor;
281 virtual ~PlotFileView(void);
283 bool OnCreate(wxDocument *doc, long flags);
284 void OnDraw(wxDC* dc);
285 void OnUpdate(wxView *sender, wxObject *hint = NULL);
286 bool OnClose (bool deleteWindow = true);
288 void OnProperties (wxCommandEvent& event);
289 void OnScaleMinMax (wxCommandEvent& event);
290 void OnScaleAuto (wxCommandEvent& event);
291 void OnScaleFull (wxCommandEvent& event);
296 PlotFileDocument* GetDocument(void)
297 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
299 DECLARE_EVENT_TABLE()
302 class PlotFileCanvas: public wxScrolledWindow
305 PlotFileView* m_pView;
307 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
308 virtual void OnDraw(wxDC& dc);