r355: Polar conversions of projections
[ctsim.git] / src / ctsim.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          ctsim.cpp
5 **   Purpose:       Top-level routines for CTSim program
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  July 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2000 Kevin Rosenberg
11 **
12 **  $Id: ctsim.h,v 1.22 2001/01/06 15:33:15 kevin Exp $
13 **
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.
17 **
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.
22 **
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 ******************************************************************************/
27
28 #ifndef __CTSIMH__
29 #define __CTSIMH__
30
31 #ifdef HAVE_CONFIG_H
32 #include "config.h"
33 #endif
34 #ifdef HAVE_DMALLOC
35 #include <dmalloc.h>
36 #endif
37
38 #ifdef MSVC
39 // #define CTSIM_MDI 1
40 #endif
41
42
43 class wxMenu;
44 class wxDocument;
45
46 class ImageFileDocument;
47
48 #include <vector>
49
50
51 #include "wx/docview.h"
52
53
54 // Define a new frame for main window
55 #if CTSIM_MDI
56 class MainFrame: public wxMDIParentFrame
57 #else
58 class MainFrame: public wxDocParentFrame
59 #endif
60 {
61     DECLARE_CLASS(MainFrame)
62 private:
63     wxTextCtrl* m_pLog;
64     wxMenu* m_pWindowMenu;
65
66     enum { MAX_WINDOW_MENUITEMS = 20 };
67     wxMenuItem* m_apWindowMenuItems[MAX_WINDOW_MENUITEMS];
68     wxDocument* m_apWindowMenuData[MAX_WINDOW_MENUITEMS];
69
70
71     int m_iDefaultPhantomID;
72     int m_iDefaultFilterID;
73     int m_iDefaultFilterDomainID;
74     unsigned int m_iDefaultFilterXSize;    
75     unsigned int m_iDefaultFilterYSize;
76     double m_dDefaultFilterParam;
77     double m_dDefaultFilterBandwidth;
78     double m_dDefaultFilterInputScale;
79     double m_dDefaultFilterOutputScale;
80
81
82 public:
83     MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
84     
85     void OnAbout (wxCommandEvent& event);
86     void OnHelpContents (wxCommandEvent& event);
87     void OnCreatePhantom (wxCommandEvent& event);
88
89     void OnCreateFilter (wxCommandEvent& event);
90     void OnExit (wxCommandEvent& event);
91
92     void OnUpdateUI (wxUpdateUIEvent& event);
93
94     wxTextCtrl* getLog() 
95         { return m_pLog; }
96
97     void OnWindowMenu0 (wxCommandEvent& event);
98     void OnWindowMenu1 (wxCommandEvent& event);
99     void OnWindowMenu2 (wxCommandEvent& event);
100     void OnWindowMenu3 (wxCommandEvent& event);
101     void OnWindowMenu4 (wxCommandEvent& event);
102     void OnWindowMenu5 (wxCommandEvent& event);
103     void OnWindowMenu6 (wxCommandEvent& event);
104     void OnWindowMenu7 (wxCommandEvent& event);
105     void OnWindowMenu8 (wxCommandEvent& event);
106     void OnWindowMenu9 (wxCommandEvent& event);
107     void OnWindowMenu10 (wxCommandEvent& event);
108     void OnWindowMenu11 (wxCommandEvent& event);
109     void OnWindowMenu12 (wxCommandEvent& event);
110     void OnWindowMenu13 (wxCommandEvent& event);
111     void OnWindowMenu14 (wxCommandEvent& event);
112     void OnWindowMenu15 (wxCommandEvent& event);
113     void OnWindowMenu16 (wxCommandEvent& event);
114     void OnWindowMenu17 (wxCommandEvent& event);
115     void OnWindowMenu18 (wxCommandEvent& event);
116     void OnWindowMenu19 (wxCommandEvent& event);
117
118     void DoWindowMenu (int iMenuPosition, wxCommandEvent& event);
119
120     DECLARE_EVENT_TABLE()
121 };
122
123
124 class wxDocManager;
125 class CTSimApp: public wxApp
126 {
127 public:
128     CTSimApp();
129     bool OnInit();
130     int OnExit();
131     MainFrame* getMainFrame() const
132       { return m_pFrame; }
133     wxTextCtrl* getLog()
134       { return m_pFrame->getLog(); }
135     wxDocManager* getDocManager() 
136         { return m_docManager; }
137
138     wxString getUntitledFilename();
139
140
141     void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);
142
143
144
145     bool getSetModifyNewDocs() const
146
147     { return true; }
148
149
150 private:
151     wxDocManager* m_docManager;
152     MainFrame* m_pFrame;
153
154     void usage (const char* program);
155
156     static struct option ctsimOptions[];
157
158     enum { O_HELP, O_VERSION };
159 };
160
161 DECLARE_APP(CTSimApp)
162
163 extern class CTSimApp* theApp;
164
165
166 enum {
167   MAINMENU_HELP_ABOUT = 500,
168   MAINMENU_WINDOW_BASE,
169   MAINMENU_HELP_CONTENTS,
170   MAINMENU_FILE_CREATE_PHANTOM,
171
172   MAINMENU_FILE_CREATE_FILTER,
173   MAINMENU_FILE_EXIT,
174
175   PJMENU_FILE_PROPERTIES,
176   PJMENU_RECONSTRUCT_FBP,
177   PJMENU_RECONSTRUCT_FOURIER,
178   PJMENU_CONVERT_POLAR,
179   PJMENU_CONVERT_FFT_POLAR,
180
181   IFMENU_FILE_EXPORT,
182   IFMENU_FILE_PROPERTIES,
183
184         IFMENU_PLOT_ROW,
185         IFMENU_PLOT_COL,
186         IFMENU_PLOT_FFT_ROW,
187         IFMENU_PLOT_FFT_COL,
188   IFMENU_PLOT_HISTOGRAM,
189
190   IFMENU_VIEW_SCALE_AUTO,
191   IFMENU_VIEW_SCALE_MINMAX,
192   IFMENU_VIEW_SCALE_FULL,
193
194         IFMENU_COMPARE_IMAGES,
195         IFMENU_COMPARE_ROW,
196         IFMENU_COMPARE_COL,
197   IFMENU_IMAGE_SCALESIZE,
198   IFMENU_IMAGE_ADD,
199   IFMENU_IMAGE_SUBTRACT,
200   IFMENU_IMAGE_MULTIPLY,
201   IFMENU_IMAGE_DIVIDE,
202
203   IFMENU_FILTER_INVERTVALUES,
204   IFMENU_FILTER_SQRT,
205   IFMENU_FILTER_SQUARE,
206   IFMENU_FILTER_LOG,
207   IFMENU_FILTER_EXP,
208   IFMENU_FILTER_FOURIER,
209   IFMENU_FILTER_INVERSE_FOURIER,
210   IFMENU_FILTER_FFT,
211   IFMENU_FILTER_IFFT,
212   IFMENU_FILTER_FFT_ROWS,
213   IFMENU_FILTER_FFT_COLS,
214   IFMENU_FILTER_IFFT_ROWS,
215   IFMENU_FILTER_IFFT_COLS,
216   IFMENU_FILTER_MAGNITUDE,
217   IFMENU_FILTER_PHASE,
218   IFMENU_FILTER_SHUFFLENATURALTOFOURIERORDER,
219   IFMENU_FILTER_SHUFFLEFOURIERTONATURALORDER,
220
221   PHMMENU_FILE_PROPERTIES,
222   PHMMENU_PROCESS_RASTERIZE,
223   PHMMENU_PROCESS_PROJECTIONS,
224
225         PLOTMENU_VIEW_SCALE_MINMAX,
226         PLOTMENU_VIEW_SCALE_AUTO,
227         PLOTMENU_VIEW_SCALE_FULL,
228
229 };
230
231 #endif