00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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();
00076 Region get_bounding_box();
00077 double *get_points_array();
00078 Vec3f get_vector_at(int i);
00079 double get_value_at(int i);
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);
00095
00104 vector<int> match_points(PointArray *to,float max_miss=-1.0);
00105
00106
00113 Transform *align_2d(PointArray *to,float max_dist);
00114
00123 vector<float> align_trans_2d(PointArray *to,int flags=0,float dxhint=0,float dyhint=0 );
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);
00140 EMData *pdb2mrc_by_nfft(int map_size, float apix, float res);
00141 EMData *pdb2mrc_by_summation(int map_size, float apix, float res, int addpdbbfactor);
00142 EMData *projection_by_nfft(int image_size, float apix, float res = 0);
00143 EMData *projection_by_summation(int image_size, float apix, float res);
00144 void replace_by_summation(EMData *image, int i, Vec3f vec, float amp, float apix, float res);
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