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.50 2001/03/11 17:55:29 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 OnEditCopy (wxCommandEvent& event);
95 void OnEditCut (wxCommandEvent& event);
96 void OnEditPaste (wxCommandEvent& event);
98 void OnRevert (wxCommandEvent& event);
99 void OnExport (wxCommandEvent& event);
100 void OnProperties (wxCommandEvent& event);
102 void OnCompare (wxCommandEvent& event);
103 void OnScaleSize (wxCommandEvent& event);
104 void OnInvertValues (wxCommandEvent& event);
105 void OnSquare (wxCommandEvent& event);
106 void OnSquareRoot (wxCommandEvent& event);
107 void OnLog (wxCommandEvent& event);
108 void OnExp (wxCommandEvent& event);
109 void OnAdd (wxCommandEvent& event);
110 void OnSubtract (wxCommandEvent& event);
111 void OnMultiply (wxCommandEvent& event);
112 void OnDivide (wxCommandEvent& event);
113 void OnFourier (wxCommandEvent& event);
114 void OnInverseFourier (wxCommandEvent& event);
115 void OnShuffleNaturalToFourierOrder (wxCommandEvent& event);
116 void OnShuffleFourierToNaturalOrder (wxCommandEvent& event);
118 void OnConvert3d (wxCommandEvent& event);
122 void OnFFT (wxCommandEvent& event);
123 void OnIFFT (wxCommandEvent& event);
124 void OnFFTRows (wxCommandEvent& event);
125 void OnIFFTRows (wxCommandEvent& event);
126 void OnFFTCols (wxCommandEvent& event);
127 void OnIFFTCols (wxCommandEvent& event);
130 void OnMagnitude (wxCommandEvent& event);
131 void OnPhase (wxCommandEvent& event);
133 void OnScaleAuto (wxCommandEvent& event);
134 void OnScaleMinMax (wxCommandEvent& event);
135 void OnScaleFull (wxCommandEvent& event);
136 void OnPlotRow (wxCommandEvent& event);
137 void OnPlotCol (wxCommandEvent& event);
139 void OnPlotFFTRow (wxCommandEvent& event);
140 void OnPlotFFTCol (wxCommandEvent& event);
142 void OnPlotHistogram (wxCommandEvent& event);
143 void OnCompareRow (wxCommandEvent& event);
144 void OnCompareCol (wxCommandEvent& event);
147 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
149 wxDocChildFrame* getFrame() { return m_pFrame; }
152 wxMenu* getMenuAnalyze() { return m_pMenuAnalyze; }
154 ImageFileDocument* GetDocument()
155 { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
157 DECLARE_EVENT_TABLE()
160 class ImageFileCanvas: public wxScrolledWindow
163 ImageFileView* m_pView;
169 ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
170 virtual ~ImageFileCanvas();
172 virtual void OnDraw(wxDC& dc);
173 void OnChar(wxKeyEvent& event);
174 void OnMouseEvent(wxMouseEvent& event);
175 void DrawRubberBandCursor (wxDC& dc, int x, int y);
176 bool GetCurrentCursor (int& x, int& y);
178 virtual wxSize GetBestSize() const;
179 void setView(ImageFileView* pView)
183 DECLARE_EVENT_TABLE()
187 class ProjectionFileCanvas;
188 class ProjectionFileView : public wxView
191 DECLARE_DYNAMIC_CLASS(ProjectionFileView)
193 wxMemoryDC m_memoryDC;
196 ProjectionFileCanvas *CreateCanvas (wxFrame* parent);
198 wxDocMDIChildFrame* m_pFrame;
199 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
201 wxDocChildFrame* m_pFrame;
202 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
205 ProjectionFileCanvas *m_pCanvas;
210 int m_iDefaultFilter;
211 int m_iDefaultFilterMethod;
212 double m_dDefaultFilterParam;
213 int m_iDefaultFilterGeneration;
214 int m_iDefaultZeropad;
215 int m_iDefaultInterpolation;
216 int m_iDefaultInterpParam;
217 int m_iDefaultBackprojector;
220 int m_iDefaultPolarNX;
221 int m_iDefaultPolarNY;
222 int m_iDefaultPolarInterpolation;
223 int m_iDefaultPolarZeropad;
225 wxWindow* getFrameForChild()
227 { return theApp->getMainFrame(); }
233 ProjectionFileView();
234 virtual ~ProjectionFileView();
236 { m_pCanvas = NULL; m_pFrame = NULL; }
238 bool OnCreate(wxDocument *doc, long flags);
239 void OnDraw(wxDC* dc);
240 void OnUpdate(wxView *sender, wxObject *hint = NULL);
241 bool OnClose (bool deleteWindow = true);
242 void OnProperties (wxCommandEvent& event);
243 void OnReconstructFBP (wxCommandEvent& event);
244 void OnReconstructFourier (wxCommandEvent& event);
245 void OnConvertPolar (wxCommandEvent& event);
246 void OnConvertFFTPolar (wxCommandEvent& event);
247 void OnPlotTThetaSampling (wxCommandEvent& event);
248 void OnConvertParallel (wxCommandEvent& event);
249 void OnArtifactReduction (wxCommandEvent& event);
252 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
254 wxDocChildFrame* getFrame() { return m_pFrame; }
256 ProjectionFileCanvas* getCanvas() { return m_pCanvas; }
258 wxMenu* getFileMenu() { return m_pFileMenu; }
260 ProjectionFileDocument* GetDocument()
261 { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
262 DECLARE_EVENT_TABLE()
265 class ProjectionFileCanvas: public wxScrolledWindow
268 ProjectionFileView* m_pView;
271 ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
272 virtual ~ProjectionFileCanvas() ;
274 virtual wxSize GetBestSize() const;
275 virtual void OnDraw(wxDC& dc);
276 void setView(ProjectionFileView* pView)
282 class PhantomFileView : public wxView
285 DECLARE_DYNAMIC_CLASS(PhantomFileView)
286 DECLARE_EVENT_TABLE()
288 PhantomCanvas *CreateCanvas (wxFrame* parent);
290 wxDocMDIChildFrame* m_pFrame;
291 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
293 wxDocChildFrame* m_pFrame;
294 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
297 PhantomCanvas *m_pCanvas;
302 int m_iDefaultNSample;
303 int m_iDefaultGeometry;
305 double m_dDefaultRotation;
306 double m_dDefaultFocalLength;
307 double m_dDefaultCenterDetectorLength;
308 double m_dDefaultViewRatio;
309 double m_dDefaultScanRatio;
311 int m_iDefaultRasterNX;
312 int m_iDefaultRasterNY;
313 int m_iDefaultRasterNSamples;
314 double m_dDefaultRasterViewRatio;
316 wxWindow* getFrameForChild()
318 { return theApp->getMainFrame(); }
325 virtual ~PhantomFileView();
327 { m_pCanvas = NULL; m_pFrame = NULL; }
329 bool OnCreate(wxDocument *doc, long flags);
330 void OnUpdate(wxView *sender, wxObject *hint = NULL);
331 bool OnClose (bool deleteWindow = true);
332 void OnDraw(wxDC* dc);
333 void OnProperties (wxCommandEvent& event);
334 void OnRasterize (wxCommandEvent& event);
335 void OnProjections (wxCommandEvent& event);
337 PhantomFileDocument* GetDocument()
338 { return dynamic_cast<PhantomFileDocument*>(wxView::GetDocument()); }
340 wxMenu* getFileMenu() { return m_pFileMenu; }
342 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
344 wxDocChildFrame* getFrame() { return m_pFrame; }
348 class PhantomCanvas: public wxScrolledWindow
351 PhantomFileView* m_pView;
354 PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
355 virtual ~PhantomCanvas();
357 virtual wxSize GetBestSize() const;
358 void setView(PhantomFileView* pView)
360 virtual void OnDraw(wxDC& dc);
363 class PlotFileCanvas;
364 class PlotFileView : public wxView
366 DECLARE_DYNAMIC_CLASS(PlotFileView)
370 wxDocMDIChildFrame* m_pFrame;
371 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
373 wxDocChildFrame* m_pFrame;
374 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
377 PlotFileCanvas *m_pCanvas;
381 bool m_bMinSpecified;
382 bool m_bMaxSpecified;
385 double m_dAutoScaleFactor;
387 PlotFileCanvas *CreateCanvas (wxFrame* parent);
388 wxWindow* getFrameForChild()
390 { return theApp->getMainFrame(); }
397 virtual ~PlotFileView();
399 { m_pCanvas = NULL; m_pFrame = NULL; }
401 bool OnCreate(wxDocument *doc, long flags);
402 void OnDraw(wxDC* dc);
403 void OnUpdate(wxView *sender, wxObject *hint = NULL);
404 bool OnClose (bool deleteWindow = true);
406 void OnProperties (wxCommandEvent& event);
407 void OnScaleMinMax (wxCommandEvent& event);
408 void OnScaleAuto (wxCommandEvent& event);
409 void OnScaleFull (wxCommandEvent& event);
412 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
414 wxDocChildFrame* getFrame() { return m_pFrame; }
417 wxMenu* getFileMenu() { return m_pFileMenu; }
418 PlotFileDocument* GetDocument()
419 { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
421 DECLARE_EVENT_TABLE()
424 class PlotFileCanvas: public wxScrolledWindow
427 PlotFileView* m_pView;
430 PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
431 virtual ~PlotFileCanvas();
433 virtual void OnDraw(wxDC& dc);
435 void setView (PlotFileView* pView)
440 class TextFileCanvas;
441 class TextFileView: public wxView
444 DECLARE_DYNAMIC_CLASS(TextFileView)
447 wxDocMDIChildFrame* m_pFrame;
448 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
450 wxDocChildFrame* m_pFrame;
451 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
454 TextFileCanvas *m_pCanvas;
458 : wxView() , m_pFrame(0), m_pCanvas(0)
464 bool OnCreate (wxDocument *doc, long flags);
465 void OnDraw (wxDC *dc);
466 void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);
467 bool OnClose (bool deleteWindow = TRUE);
469 TextFileDocument* GetDocument()
470 { return dynamic_cast<TextFileDocument*>(wxView::GetDocument()); }
472 TextFileCanvas* getTextCtrl() { return m_pCanvas; }
473 wxMenu* getFileMenu() { return m_pFileMenu; }
475 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
477 wxDocChildFrame* getFrame() { return m_pFrame; }
481 class TextFileCanvas: public wxTextCtrl
483 TextFileView *m_pView;
486 TextFileCanvas (TextFileView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);