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.48 2001/03/10 23:14:16 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"
38 #include "threadrecon.h"
41 #include "graph3dview.h"
44 class ImageFileCanvas;
45 class ImageFileView : public wxView
48 DECLARE_DYNAMIC_CLASS(ImageFileView)
50 wxMemoryDC m_memoryDC;
52 wxMenu* m_pMenuAnalyze;
54 ImageFileCanvas *CreateCanvas (wxFrame* parent);
56 wxDocMDIChildFrame* m_pFrame;
57 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
59 wxDocChildFrame* m_pFrame;
60 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
63 ImageFileCanvas *m_pCanvas;
69 double m_dAutoScaleFactor;
71 int m_iDefaultExportFormatID;
73 wxWindow* getFrameForChild()
75 { return theApp->getMainFrame(); }
82 virtual ~ImageFileView();
84 { m_pCanvas = NULL; m_pFrame = NULL; }
87 { return m_pFileMenu; }
89 bool OnCreate(wxDocument *doc, long flags);
90 void OnDraw(wxDC* dc);
91 void OnUpdate(wxView *sender, wxObject *hint = NULL);
92 bool OnClose (bool deleteWindow = true);
94 void OnRevert (wxCommandEvent& event);
95 void OnExport (wxCommandEvent& event);
96 void OnProperties (wxCommandEvent& event);
98 void OnCompare (wxCommandEvent& event);
99 void OnScaleSize (wxCommandEvent& event);
100 void OnInvertValues (wxCommandEvent& event);
101 void OnSquare (wxCommandEvent& event);
102 void OnSquareRoot (wxCommandEvent& event);
103 void OnLog (wxCommandEvent& event);
104 void OnExp (wxCommandEvent& event);
105 void OnAdd (wxCommandEvent& event);
106 void OnSubtract (wxCommandEvent& event);
107 void OnMultiply (wxCommandEvent& event);
108 void OnDivide (wxCommandEvent& event);
109 void OnFourier (wxCommandEvent& event);
110 void OnInverseFourier (wxCommandEvent& event);
111 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
112 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
114 void OnConvert3d (wxCommandEvent& event);
118 void OnFFT (wxCommandEvent& event);
119 void OnIFFT (wxCommandEvent& event);
120 void OnFFTRows (wxCommandEvent& event);
121 void OnIFFTRows (wxCommandEvent& event);
122 void OnFFTCols (wxCommandEvent& event);
123 void OnIFFTCols (wxCommandEvent& event);
126 void OnMagnitude (wxCommandEvent& event);
127 void OnPhase (wxCommandEvent& event);
129 void OnScaleAuto (wxCommandEvent& event);
130 void OnScaleMinMax (wxCommandEvent& event);
131 void OnScaleFull (wxCommandEvent& event);
132 void OnPlotRow (wxCommandEvent& event);
133 void OnPlotCol (wxCommandEvent& event);
135 void OnPlotFFTRow (wxCommandEvent& event);
136 void OnPlotFFTCol (wxCommandEvent& event);
138 void OnPlotHistogram (wxCommandEvent& event);
139 void OnCompareRow (wxCommandEvent& event);
140 void OnCompareCol (wxCommandEvent& event);
143 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
145 wxDocChildFrame* getFrame() { return m_pFrame; }
148 wxMenu* getMenuAnalyze() { return m_pMenuAnalyze; }
150 ImageFileDocument* GetDocument()
151 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
153 DECLARE_EVENT_TABLE()
156 class ImageFileCanvas: public wxScrolledWindow
159 ImageFileView* m_pView;
165 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
166 virtual ~ImageFileCanvas();
168 virtual void OnDraw(wxDC& dc);
169 void OnChar(wxKeyEvent& event);
170 void OnMouseEvent(wxMouseEvent& event);
171 void DrawRubberBandCursor (wxDC& dc, int x, int y);
172 bool GetCurrentCursor (int& x, int& y);
174 virtual wxSize GetBestSize() const;
175 void setView(ImageFileView* pView)
179 DECLARE_EVENT_TABLE()
183 class ProjectionFileCanvas;
184 class ProjectionFileView : public wxView
187 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
189 wxMemoryDC m_memoryDC;
192 ProjectionFileCanvas *CreateCanvas (wxFrame* parent);
194 wxDocMDIChildFrame* m_pFrame;
195 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
197 wxDocChildFrame* m_pFrame;
198 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
201 ProjectionFileCanvas *m_pCanvas;
206 int m_iDefaultFilter;
207 int m_iDefaultFilterMethod;
208 double m_dDefaultFilterParam;
209 int m_iDefaultFilterGeneration;
210 int m_iDefaultZeropad;
211 int m_iDefaultInterpolation;
212 int m_iDefaultInterpParam;
213 int m_iDefaultBackprojector;
216 int m_iDefaultPolarNX;
217 int m_iDefaultPolarNY;
218 int m_iDefaultPolarInterpolation;
219 int m_iDefaultPolarZeropad;
221 wxWindow* getFrameForChild()
223 { return theApp->getMainFrame(); }
229 ProjectionFileView();
230 virtual ~ProjectionFileView();
232 { m_pCanvas = NULL; m_pFrame = NULL; }
234 bool OnCreate(wxDocument *doc, long flags);
235 void OnDraw(wxDC* dc);
236 void OnUpdate(wxView *sender, wxObject *hint = NULL);
237 bool OnClose (bool deleteWindow = true);
238 void OnProperties (wxCommandEvent& event);
239 void OnReconstructFBP (wxCommandEvent& event);
240 void OnReconstructFourier (wxCommandEvent& event);
241 void OnConvertPolar (wxCommandEvent& event);
242 void OnConvertFFTPolar (wxCommandEvent& event);
243 void OnPlotTThetaSampling (wxCommandEvent& event);
246 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
248 wxDocChildFrame* getFrame() { return m_pFrame; }
250 ProjectionFileCanvas* getCanvas() { return m_pCanvas; }
252 wxMenu* getFileMenu() { return m_pFileMenu; }
254 ProjectionFileDocument* GetDocument()
255 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
256 DECLARE_EVENT_TABLE()
259 class ProjectionFileCanvas: public wxScrolledWindow
262 ProjectionFileView* m_pView;
265 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
266 virtual ~ProjectionFileCanvas() ;
268 virtual wxSize GetBestSize() const;
269 virtual void OnDraw(wxDC& dc);
270 void setView(ProjectionFileView* pView)
276 class PhantomFileView : public wxView
279 DECLARE_DYNAMIC_CLASS(PhantomFileView)
280 DECLARE_EVENT_TABLE()
282 PhantomCanvas *CreateCanvas (wxFrame* parent);
284 wxDocMDIChildFrame* m_pFrame;
285 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
287 wxDocChildFrame* m_pFrame;
288 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
291 PhantomCanvas *m_pCanvas;
296 int m_iDefaultNSample;
297 int m_iDefaultGeometry;
299 double m_dDefaultRotation;
300 double m_dDefaultFocalLength;
301 double m_dDefaultCenterDetectorLength;
302 double m_dDefaultViewRatio;
303 double m_dDefaultScanRatio;
305 int m_iDefaultRasterNX;
306 int m_iDefaultRasterNY;
307 int m_iDefaultRasterNSamples;
308 double m_dDefaultRasterViewRatio;
310 wxWindow* getFrameForChild()
312 { return theApp->getMainFrame(); }
319 virtual ~PhantomFileView();
321 { m_pCanvas = NULL; m_pFrame = NULL; }
323 bool OnCreate(wxDocument *doc, long flags);
324 void OnUpdate(wxView *sender, wxObject *hint = NULL);
325 bool OnClose (bool deleteWindow = true);
326 void OnDraw(wxDC* dc);
327 void OnProperties (wxCommandEvent& event);
328 void OnRasterize (wxCommandEvent& event);
329 void OnProjections (wxCommandEvent& event);
331 PhantomFileDocument* GetDocument()
332 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
334 wxMenu* getFileMenu() { return m_pFileMenu; }
336 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
338 wxDocChildFrame* getFrame() { return m_pFrame; }
342 class PhantomCanvas: public wxScrolledWindow
345 PhantomFileView* m_pView;
348 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
349 virtual ~PhantomCanvas();
351 virtual wxSize GetBestSize() const;
352 void setView(PhantomFileView* pView)
354 virtual void OnDraw(wxDC& dc);
357 class PlotFileCanvas;
358 class PlotFileView : public wxView
360 DECLARE_DYNAMIC_CLASS(PlotFileView)
364 wxDocMDIChildFrame* m_pFrame;
365 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
367 wxDocChildFrame* m_pFrame;
368 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
371 PlotFileCanvas *m_pCanvas;
375 bool m_bMinSpecified;
376 bool m_bMaxSpecified;
379 double m_dAutoScaleFactor;
381 PlotFileCanvas *CreateCanvas (wxFrame* parent);
382 wxWindow* getFrameForChild()
384 { return theApp->getMainFrame(); }
391 virtual ~PlotFileView();
393 { m_pCanvas = NULL; m_pFrame = NULL; }
395 bool OnCreate(wxDocument *doc, long flags);
396 void OnDraw(wxDC* dc);
397 void OnUpdate(wxView *sender, wxObject *hint = NULL);
398 bool OnClose (bool deleteWindow = true);
400 void OnProperties (wxCommandEvent& event);
401 void OnScaleMinMax (wxCommandEvent& event);
402 void OnScaleAuto (wxCommandEvent& event);
403 void OnScaleFull (wxCommandEvent& event);
406 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
408 wxDocChildFrame* getFrame() { return m_pFrame; }
411 wxMenu* getFileMenu() { return m_pFileMenu; }
412 PlotFileDocument* GetDocument()
413 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
415 DECLARE_EVENT_TABLE()
418 class PlotFileCanvas: public wxScrolledWindow
421 PlotFileView* m_pView;
424 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
425 virtual ~PlotFileCanvas();
427 virtual void OnDraw(wxDC& dc);
429 void setView (PlotFileView* pView)
434 class TextFileCanvas;
435 class TextFileView: public wxView
438 DECLARE_DYNAMIC_CLASS(TextFileView)
441 wxDocMDIChildFrame* m_pFrame;
442 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
444 wxDocChildFrame* m_pFrame;
445 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
448 TextFileCanvas *m_pCanvas;
452 : wxView() , m_pFrame(0), m_pCanvas(0)
458 bool OnCreate (wxDocument *doc, long flags);
459 void OnDraw (wxDC *dc);
460 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
461 bool OnClose (bool deleteWindow = TRUE);
463 TextFileDocument* GetDocument()
464 { return dynamic_cast<TextFileDocument*>(wxView::GetDocument()); }
466 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
467 wxMenu* getFileMenu() { return m_pFileMenu; }
469 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
471 wxDocChildFrame* getFrame() { return m_pFrame; }
475 class TextFileCanvas: public wxTextCtrl
477 TextFileView *m_pView;
480 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);