Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

pointarray.h

Go to the documentation of this file.
00001 
00005 /*
00006  * Author: Wen Jiang, 08/11/2004 (jiang12@purdue.edu)
00007  * Copyright (c) 2000-2006 Baylor College of Medicine
00008  *
00009  * This software is issued under a joint BSD/GNU license. You may use the
00010  * source code in this file under either license. However, note that the
00011  * complete EMAN2 and SPARX software packages have some GPL dependencies,
00012  * so you are responsible for compliance with the licenses of these packages
00013  * if you opt to use BSD licensing. The warranty disclaimer below holds
00014  * in either instance.
00015  *
00016  * This complete copyright notice must be included in any revised version of the
00017  * source code. Additional authorship citations may be added, but existing
00018  * author citations must be preserved.
00019  *
00020  * This program is free software; you can redistribute it and/or modify
00021  * it under the terms of the GNU General Public License as published by
00022  * the Free Software Foundation; either version 2 of the License, or
00023  * (at your option) any later version.
00024  *
00025  * This program is distributed in the hope that it will be useful,
00026  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00027  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00028  * GNU General Public License for more details.
00029  *
00030  * You should have received a copy of the GNU General Public License
00031  * along with this program; if not, write to the Free Software
00032  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00033  *
00034  * */
00035 
00036 #ifndef eman_pointarray_h_
00037 #define eman_pointarray_h_
00038 
00039 #include "emdata.h"
00040 #include "transform.h"
00041 
00042 #if defined NFFT || NFFT2
00043 extern "C"
00044 {
00045         #include "nfft.h"
00046         #include "utils.h"
00047 }
00048 #endif
00049 
00050 #include <sys/stat.h>
00051 
00052 namespace EMAN
00053 {
00055         class PointArray
00056         {
00057                 public:
00058                 enum Density2PointsArrayAlgorithm
00059                 {
00060                         PEAKS_SUB, PEAKS_DIV, KMEANS
00061                 };
00062 
00063                 public:
00064                 PointArray();
00065                 explicit PointArray(int nn);
00066                 ~PointArray();
00067                 void zero();
00068                 PointArray *copy();
00069                 PointArray & operator=(PointArray & pa);
00070                 size_t get_number_points() const;
00071                 void set_number_points(size_t nn);
00072                 bool read_from_pdb(const char *file);
00073                 void save_to_pdb(const char *file);
00074                 FloatPoint get_center();
00075                 void center_to_zero();  // shift center to zero
00076                 Region get_bounding_box();
00077                 double *get_points_array();
00078                 Vec3f get_vector_at(int i);     // get the ith vector in the list
00079                 double get_value_at(int i);  // get the amplitude of the ith vector
00080                 void set_vector_at(int i,Vec3f vec,double value);
00081                 void set_vector_at(int i,vector<double>);
00082                 void set_points_array(double *p);
00087                 vector<float> get_points();
00088 
00094                 EMData *distmx(int sortrows=0); // computes a distance matrix
00095 
00104                 vector<int> match_points(PointArray *to,float max_miss=-1.0);
00105 
00106 
00113                 Transform *align_2d(PointArray *to,float max_dist);     // computes the optimal alignment between two (non-identical) sets of points
00114 
00123                 vector<float> align_trans_2d(PointArray *to,int flags=0,float dxhint=0,float dyhint=0 );                // translational alignment of point sets in 2-D
00124 
00125                 void mask(double rmax, double rmin = 0.0);
00126                 void mask_asymmetric_unit(const string & sym);
00127                 void transform(const Transform& transform);
00128 
00132                 void right_transform(const Transform& transform);
00133 
00134                 void set_from(vector<float>);
00135                 void set_from(PointArray * source, const string & sym = "", Transform *transform=0);
00136                 void set_from(double *source, int num, const string & sym = "", Transform *transform=0);
00137                 void set_from_density_map(EMData * map, int num, float thresh, float apix,
00138                                                                   Density2PointsArrayAlgorithm mode = PEAKS_DIV);
00139                 void sort_by_axis(int axis = 1);        // x,y,z axes = 0, 1, 2
00140                 EMData *pdb2mrc_by_nfft(int map_size, float apix, float res);   // return real space 3-D map
00141                 EMData *pdb2mrc_by_summation(int map_size, float apix, float res, int addpdbbfactor);   // return real space 3-D map
00142                 EMData *projection_by_nfft(int image_size, float apix, float res = 0);  // return 2-D Fourier Transform
00143                 EMData *projection_by_summation(int image_size, float apix, float res); // return 2-D real space image
00144                 void replace_by_summation(EMData *image, int i, Vec3f vec, float amp, float apix, float res); // changes a single Gaussian from the projection
00145 
00153                 void opt_from_proj(const vector<EMData*> & proj,float pixres);
00154 
00155                 private:
00156                 double *points;
00157                 size_t n;
00158                 double *bfactor;
00159         };
00160 }
00161 
00162 #endif

Generated on Tue Jun 11 13:46:16 2013 for EMAN2 by  doxygen 1.3.9.1