EMAN2
projector.h
Go to the documentation of this file.
1/*
2 * Author: Steven Ludtke, 04/10/2003 (sludtke@bcm.edu)
3 * Copyright (c) 2000-2006 Baylor College of Medicine
4 *
5 * This software is issued under a joint BSD/GNU license. You may use the
6 * source code in this file under either license. However, note that the
7 * complete EMAN2 and SPARX software packages have some GPL dependencies,
8 * so you are responsible for compliance with the licenses of these packages
9 * if you opt to use BSD licensing. The warranty disclaimer below holds
10 * in either instance.
11 *
12 * This complete copyright notice must be included in any revised version of the
13 * source code. Additional authorship citations may be added, but existing
14 * author citations must be preserved.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 *
30 * */
31
32#ifndef eman__projector_h__
33#define eman__projector_h__ 1
34
35#include "transform.h"
36
37using std::string;
38
39namespace EMAN
40{
41 class EMData;
42
78 {
79 public:
80 virtual ~ Projector()
81 {
82 }
83
87 virtual EMData *project3d(EMData * image) const = 0;
88
92 virtual EMData *backproject3d(EMData * image) const = 0;
93
98 virtual string get_name() const = 0;
99
100 virtual string get_desc() const = 0;
101
106 virtual Dict get_params() const
107 {
108 return params;
109 }
111 void set_params(const Dict & new_params)
112 {
113 params = new_params;
114 }
121 virtual TypeDict get_param_types() const
122 {
123 TypeDict d;
124 return d;
125 }
126
127 protected:
129 };
130
147 {
148 public:
150 {
151 }
152
153 EMData *project3d(EMData * image) const;
154 // no implementation yet
155 EMData *backproject3d(EMData * image) const;
156
157
158 void set_params(const Dict & new_params)
159 {
160 Projector::set_params(new_params);
161 alt = params["alt"];
162 az = params["az"];
163 phi = params["phi"];
164 }
165
166 string get_name() const
167 {
168 return NAME;
169 }
170
171 string get_desc() const
172 {
173 return "Projections using a Gaussian kernel in Fourier space. Produces artifacts, not recommended.";
174 }
175
176 static Projector *NEW()
177 {
178 return new GaussFFTProjector();
179 }
180
182 {
183 TypeDict d;
184 d.put("transform", EMObject::TRANSFORM);
185 d.put("mode", EMObject::INT);
186 d.put("returnfft", EMObject::INT);
187 return d;
188 }
189
190 static const string NAME;
191
192 private:
193 float alt, az, phi;
194 bool interp_ft_3d(int mode, EMData * image, float x, float y,
195 float z, float *data, float gauss_width) const;
196 };
197
204 {
205 public:
206 EMData * project3d(EMData * image) const;
207 // no implementation yet
208 EMData * backproject3d(EMData * image) const;
209
210
211 string get_name() const
212 {
213 return NAME;
214 }
215
216 string get_desc() const
217 {
218 return "Fourier-space projection using gridding.";
219 }
220
221 static Projector *NEW()
222 {
223 return new FourierGriddingProjector();
224 }
226 {
227 TypeDict d;
228 d.put("transform", EMObject::TRANSFORM);
229 d.put("kb_alpha", EMObject::FLOAT);
230 d.put("kb_K", EMObject::FLOAT);
231 d.put("angletype", EMObject::STRING);
232 d.put("anglelist", EMObject::FLOATARRAY);
233 d.put("theta", EMObject::FLOAT);
234 d.put("psi", EMObject::FLOAT);
235 d.put("npad", EMObject::INT);
236 return d;
237 }
238
239 static const string NAME;
240 };
241
242
246 {
247 public:
248 EMData * project3d(EMData * image) const;
249 EMData * backproject3d(EMData * image) const;
250
251 string get_name() const
252 {
253 return NAME;
254 }
255
256 string get_desc() const
257 {
258 return "Pawel Penczek's optimized real-space projection generation. Minor interpolation artifacts.";
259 }
260
261 static Projector *NEW()
262 {
263 return new PawelProjector();
264 }
265
267 {
268 TypeDict d;
269 d.put("transform", EMObject::TRANSFORM);
270 d.put("origin_x", EMObject::INT);
271 d.put("origin_y", EMObject::INT);
272 d.put("origin_z", EMObject::INT);
273 d.put("radius", EMObject::INT);
274 d.put("anglelist", EMObject::FLOATARRAY);
275 d.put("angletype", EMObject::STRING);
276 d.put("theta", EMObject::FLOAT);
277 d.put("psi", EMObject::FLOAT);
278 return d;
279 }
280
281 static const string NAME;
282
283 private:
284 // Same structure as the IPCUBE structure in Spider
285 struct IPCube
286 {
287 int start;
288 int end;
290 };
291 // Process the number of valid x-lines (rows)
292 // within the radius
293 void prepcubes(int nx, int ny, int nz, int ri, Vec3i origin,
294 int& nn, IPCube* ipcube=NULL) const;
295 };
296
301 {
302 public:
304 {
305 TypeDict d;
306 d.put("transform", EMObject::TRANSFORM, "Transform object used for projection");
307 return d;
308 }
309
310 EMData * project3d(EMData * image) const;
311 // no implementation yet
312 EMData * backproject3d(EMData * image) const;
313
314 string get_name() const
315 {
316 return NAME;
317 }
318
319 string get_desc() const
320 {
321 return "Real-space projection which computes the maximum value along each line projection rather than the sum";
322 }
323
324 static Projector *NEW()
325 {
326 return new MaxValProjector();
327 }
328
329 static const string NAME;
330 };
331
332
338 {
339 public:
341 {
342 TypeDict d;
343 d.put("transform", EMObject::TRANSFORM, "Transform object used for projection");
344 return d;
345 }
346
347 EMData * project3d(EMData * image) const;
348 // no implementation yet
349 EMData * backproject3d(EMData * image) const;
350
351 string get_name() const
352 {
353 return NAME;
354 }
355
356 string get_desc() const
357 {
358 return "Simple real-space projection. Most accurate.";
359 }
360
361 static Projector *NEW()
362 {
363 return new StandardProjector();
364 }
365
366 static const string NAME;
367 };
368
372 {
373 public:
374 EMData * project3d(EMData * vol) const;
375 EMData * backproject3d(EMData * imagestack) const;
376
377 string get_name() const
378 {
379 return NAME;
380 }
381
382 string get_desc() const
383 {
384 return "Fast real space projection generation with Bi-Linear interpolation.";
385 }
386
387 static Projector *NEW()
388 {
389 return new ChaoProjector();
390 }
391
393 {
394 TypeDict d;
395 d.put("transform", EMObject::TRANSFORM);
396 d.put("origin_x", EMObject::INT);
397 d.put("origin_y", EMObject::INT);
398 d.put("origin_z", EMObject::INT);
399 d.put("anglelist", EMObject::FLOATARRAY);
400 d.put("radius", EMObject::FLOAT);
401 return d;
402 }
403
404 static const string NAME;
405
406 private:
407 int getnnz(Vec3i volsize, int ri, Vec3i origin, int *nray, int *nnz) const;
408 int cb2sph(float *cube, Vec3i volsize, int ri, Vec3i origin, int nnz0, int *ptrs,
409 int *cord , float *sphere) const;
410 int sph2cb(float *sphere, Vec3i volsize, int nray, int ri, int nnz0,
411 int *ptrs , int *cord, float *cube) const;
412 int fwdpj3(Vec3i volsize, int nray, int nnz , float *dm,
413 Vec3i origin, int ri , int *ptrs,
414 int *cord, float *x, float *y) const;
415 int bckpj3(Vec3i volsize, int nray, int nnz, float *dm,
416 Vec3i origin, int ri, int *ptrs, int *cord,
417 float *x, float *y) const;
418 int ifix(float a) const;
419 void setdm(vector<float> anglelist, string const angletype, float *dm) const;
420 };
421
423
424 void dump_projectors();
425 map<string, vector<string> > dump_projectors_list();
426}
427
428#endif //eman__projector_h__
Fast real space projection using Bi-Linear interpolation.
Definition: projector.h:372
int cb2sph(float *cube, Vec3i volsize, int ri, Vec3i origin, int nnz0, int *ptrs, int *cord, float *sphere) const
Definition: projector.cpp:1350
EMData * backproject3d(EMData *imagestack) const
Back-project a 2D image into a 3D image.
Definition: projector.cpp:1767
string get_desc() const
Definition: projector.h:382
void setdm(vector< float > anglelist, string const angletype, float *dm) const
Definition: projector.cpp:1610
int sph2cb(float *sphere, Vec3i volsize, int nray, int ri, int nnz0, int *ptrs, int *cord, float *cube) const
Definition: projector.cpp:1409
int ifix(float a) const
Definition: projector.cpp:1593
TypeDict get_param_types() const
Get processor parameter information in a dictionary.
Definition: projector.h:392
EMData * project3d(EMData *vol) const
Project an 3D image into a 2D image.
Definition: projector.cpp:1648
int fwdpj3(Vec3i volsize, int nray, int nnz, float *dm, Vec3i origin, int ri, int *ptrs, int *cord, float *x, float *y) const
Definition: projector.cpp:1444
int bckpj3(Vec3i volsize, int nray, int nnz, float *dm, Vec3i origin, int ri, int *ptrs, int *cord, float *x, float *y) const
Definition: projector.cpp:1520
int getnnz(Vec3i volsize, int ri, Vec3i origin, int *nray, int *nnz) const
Definition: projector.cpp:1290
static Projector * NEW()
Definition: projector.h:387
string get_name() const
Get the projector's name.
Definition: projector.h:377
static const string NAME
Definition: projector.h:404
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
Factory is used to store objects to create new instances.
Definition: emobject.h:725
Fourier gridding projection routine.
Definition: projector.h:204
EMData * project3d(EMData *image) const
Project an 3D image into a 2D image.
Definition: projector.cpp:1190
string get_name() const
Get the projector's name.
Definition: projector.h:211
static const string NAME
Definition: projector.h:239
TypeDict get_param_types() const
Get processor parameter information in a dictionary.
Definition: projector.h:225
EMData * backproject3d(EMData *image) const
Back-project a 2D image into a 3D image.
Definition: projector.cpp:2144
static Projector * NEW()
Definition: projector.h:221
Gaussian FFT 3D projection.
Definition: projector.h:147
string get_name() const
Get the projector's name.
Definition: projector.h:166
string get_desc() const
Definition: projector.h:171
TypeDict get_param_types() const
Get processor parameter information in a dictionary.
Definition: projector.h:181
static Projector * NEW()
Definition: projector.h:176
static const string NAME
Definition: projector.h:190
EMData * project3d(EMData *image) const
Project an 3D image into a 2D image.
Definition: projector.cpp:69
bool interp_ft_3d(int mode, EMData *image, float x, float y, float z, float *data, float gauss_width) const
Definition: projector.cpp:216
EMData * backproject3d(EMData *image) const
Back-project a 2D image into a 3D image.
Definition: projector.cpp:1890
void set_params(const Dict &new_params)
Definition: projector.h:158
Real-space projection which computes the maximum value along each line projection rather than a sum.
Definition: projector.h:301
EMData * project3d(EMData *image) const
Project an 3D image into a 2D image.
Definition: projector.cpp:944
static Projector * NEW()
Definition: projector.h:324
TypeDict get_param_types() const
Get processor parameter information in a dictionary.
Definition: projector.h:303
string get_name() const
Get the projector's name.
Definition: projector.h:314
string get_desc() const
Definition: projector.h:319
static const string NAME
Definition: projector.h:329
EMData * backproject3d(EMData *image) const
Back-project a 2D image into a 3D image.
Definition: projector.cpp:2136
Pawel Penczek's optimized projection routine.
Definition: projector.h:246
static Projector * NEW()
Definition: projector.h:261
static const string NAME
Definition: projector.h:281
string get_name() const
Get the projector's name.
Definition: projector.h:251
string get_desc() const
Definition: projector.h:256
EMData * backproject3d(EMData *image) const
Back-project a 2D image into a 3D image.
Definition: projector.cpp:2013
TypeDict get_param_types() const
Get processor parameter information in a dictionary.
Definition: projector.h:266
EMData * project3d(EMData *image) const
Project an 3D image into a 2D image.
Definition: projector.cpp:602
void prepcubes(int nx, int ny, int nz, int ri, Vec3i origin, int &nn, IPCube *ipcube=NULL) const
Definition: projector.cpp:559
Projector class defines a method to generate 2D projections from a 3D model.
Definition: projector.h:78
virtual string get_name() const =0
Get the projector's name.
void set_params(const Dict &new_params)
Set the projector parameters using a key/value dictionary.
Definition: projector.h:111
virtual TypeDict get_param_types() const
Get processor parameter information in a dictionary.
Definition: projector.h:121
virtual EMData * backproject3d(EMData *image) const =0
Back-project a 2D image into a 3D image.
virtual Dict get_params() const
Get the projector parameters in a key/value dictionary.
Definition: projector.h:106
virtual string get_desc() const =0
virtual EMData * project3d(EMData *image) const =0
Project an 3D image into a 2D image.
Fast real-space 3D projection.
Definition: projector.h:338
static Projector * NEW()
Definition: projector.h:361
static const string NAME
Definition: projector.h:366
string get_name() const
Get the projector's name.
Definition: projector.h:351
string get_desc() const
Definition: projector.h:356
EMData * project3d(EMData *image) const
Project an 3D image into a 2D image.
Definition: projector.cpp:765
TypeDict get_param_types() const
Get processor parameter information in a dictionary.
Definition: projector.h:340
EMData * backproject3d(EMData *image) const
Back-project a 2D image into a 3D image.
Definition: projector.cpp:2129
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330
E2Exception class.
Definition: aligner.h:40
map< string, vector< string > > dump_projectors_list()
Definition: projector.cpp:2158
void dump_projectors()
Definition: projector.cpp:2153
#define y(i, j)
Definition: projector.cpp:1516
#define cube(i, j, k)
Definition: projector.cpp:1344
#define ptrs(i)
Definition: projector.cpp:1347
#define sphere(i)
Definition: projector.cpp:1345
#define cord(i, j)
Definition: projector.cpp:1346
#define x(i)
Definition: projector.cpp:1517
#define anglelist(i, j)
Definition: projector.cpp:1607
#define dm(i)
Definition: projector.cpp:1606