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.25 2001/01/04 21:28:41 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);
95 void OnMagnitude (wxCommandEvent& event);
96 void OnPhase (wxCommandEvent& event);
98 void OnScaleAuto (wxCommandEvent& event);
99 void OnScaleMinMax (wxCommandEvent& event);
100 void OnScaleFull (wxCommandEvent& event);
101 void OnPlotRow (wxCommandEvent& event);
102 void OnPlotCol (wxCommandEvent& event);
103 void OnPlotHistogram (wxCommandEvent& event);
104 void OnCompareRow (wxCommandEvent& event);
105 void OnCompareCol (wxCommandEvent& event);
110 ImageFileDocument* GetDocument(void)
111 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
113 DECLARE_EVENT_TABLE()
116 class ImageFileCanvas: public wxScrolledWindow
124 ImageFileView* m_pView;
126 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
127 virtual void OnDraw(wxDC& dc);
128 void OnMouseEvent(wxMouseEvent& event);
129 void DrawRubberBandCursor (wxDC& dc, int x, int y);
130 bool GetCurrentCursor (int& x, int& y);
132 DECLARE_EVENT_TABLE()
136 class ProjectionFileCanvas;
137 class ProjectionFileView : public wxView
139 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
141 wxMemoryDC m_memoryDC;
145 ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
146 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
148 ProjectionFileCanvas *m_canvas;
153 int m_iDefaultFilter;
154 int m_iDefaultFilterMethod;
155 double m_dDefaultFilterParam;
156 int m_iDefaultFilterGeneration;
157 int m_iDefaultZeropad;
158 int m_iDefaultInterpolation;
159 int m_iDefaultInterpParam;
160 int m_iDefaultBackprojector;
163 int m_iDefaultPolarNX;
164 int m_iDefaultPolarNY;
165 int m_iDefaultPolarInterpolation;
166 int m_iDefaultPolarZeropad;
169 ProjectionFileView(void);
170 virtual ~ProjectionFileView(void);
172 bool OnCreate(wxDocument *doc, long flags);
173 void OnDraw(wxDC* dc);
174 void OnUpdate(wxView *sender, wxObject *hint = NULL);
175 bool OnClose (bool deleteWindow = true);
176 void OnProperties (wxCommandEvent& event);
177 void OnReconstructFBP (wxCommandEvent& event);
178 void OnReconstructFourier (wxCommandEvent& event);
179 void OnConvertPolar (wxCommandEvent& event);
180 void OnConvertFFTPolar (wxCommandEvent& event);
185 ProjectionFileDocument* GetDocument(void)
186 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
187 DECLARE_EVENT_TABLE()
190 class ProjectionFileCanvas: public wxScrolledWindow
193 ProjectionFileView* m_pView;
195 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
196 virtual void OnDraw(wxDC& dc);
201 class PhantomView : public wxView
203 DECLARE_DYNAMIC_CLASS(PhantomView)
206 PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
207 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
209 PhantomCanvas *m_canvas;
214 int m_iDefaultNSample;
215 int m_iDefaultGeometry;
217 double m_dDefaultRotation;
218 double m_dDefaultFocalLength;
219 double m_dDefaultFieldOfView;
223 virtual ~PhantomView(void);
225 bool OnCreate(wxDocument *doc, long flags);
226 void OnUpdate(wxView *sender, wxObject *hint = NULL);
227 bool OnClose (bool deleteWindow = true);
228 void OnDraw(wxDC* dc);
229 void OnProperties (wxCommandEvent& event);
230 void OnRasterize (wxCommandEvent& event);
231 void OnProjections (wxCommandEvent& event);
233 PhantomDocument* GetDocument(void)
234 { return dynamic_cast<PhantomDocument*>(wxView::GetDocument()); }
236 DECLARE_EVENT_TABLE()
239 class PhantomCanvas: public wxScrolledWindow
242 PhantomView* m_pView;
244 PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
245 virtual void OnDraw(wxDC& dc);
248 class PlotFileCanvas;
249 class PlotFileView : public wxView
251 DECLARE_DYNAMIC_CLASS(PlotFileView)
254 PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
255 wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
257 PlotFileCanvas *m_canvas;
261 bool m_bMinSpecified;
262 bool m_bMaxSpecified;
265 double m_dAutoScaleFactor;
269 virtual ~PlotFileView(void);
271 bool OnCreate(wxDocument *doc, long flags);
272 void OnDraw(wxDC* dc);
273 void OnUpdate(wxView *sender, wxObject *hint = NULL);
274 bool OnClose (bool deleteWindow = true);
276 void OnProperties (wxCommandEvent& event);
277 void OnScaleMinMax (wxCommandEvent& event);
278 void OnScaleAuto (wxCommandEvent& event);
279 void OnScaleFull (wxCommandEvent& event);
284 PlotFileDocument* GetDocument(void)
285 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
287 DECLARE_EVENT_TABLE()
290 class PlotFileCanvas: public wxScrolledWindow
293 PlotFileView* m_pView;
295 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
296 virtual void OnDraw(wxDC& dc);