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 #include "emdata.h"
00037 #include "processor.h"
00038 #include "cmp.h"
00039 #include "aligner.h"
00040 #include "projector.h"
00041 #include "analyzer.h"
00042
00043 using namespace EMAN;
00044
00045 void EMData::process_inplace(const string & processorname, const Dict & params)
00046 {
00047 ENTERFUNC;
00048 Processor *f = Factory < Processor >::get(processorname, params);
00049 if (f) {
00050 f->process_inplace(this);
00051 if( f )
00052 {
00053 delete f;
00054 f = 0;
00055 }
00056 }
00057 EXITFUNC;
00058 }
00059
00060 void EMData::process_inplace(Processor * p)
00061 {
00062 ENTERFUNC;
00063 if(p) {
00064 p->process_inplace(this);
00065 }
00066 EXITFUNC;
00067 }
00068
00069 EMData* EMData::process(const string & processorname, const Dict & params) const
00070 {
00071 ENTERFUNC;
00072 Processor *f = Factory < Processor >::get(processorname, params);
00073 EMData * result = 0;
00074 if (f) {
00075 result = f->process(this);
00076 if( f )
00077 {
00078 delete f;
00079 f = 0;
00080 }
00081 }
00082 return result;
00083 EXITFUNC;
00084 }
00085
00086 EMData * EMData::process(Processor * p) const
00087 {
00088 ENTERFUNC;
00089 EMData * result = 0;
00090 if(p) {
00091 result = p->process(this);
00092 }
00093 return result;
00094 EXITFUNC;
00095 }
00096
00097 float EMData::cmp(const string & cmpname, EMData * with, const Dict & params)
00098 {
00099 ENTERFUNC;
00100 float result = 0;
00101 Cmp *c = Factory < Cmp >::get(cmpname, params);
00102 if (c) {
00103 result = c->cmp(this, with);
00104 if( c )
00105 {
00106 delete c;
00107 c = 0;
00108 }
00109 }
00110
00111 EXITFUNC;
00112 return result;
00113 }
00114
00115
00116 EMData *EMData::align(const string & aligner_name, EMData * to_img,
00117 const Dict & params, const string & cmp_name, const Dict& cmp_params)
00118 {
00119 ENTERFUNC;
00120 EMData *result = 0;
00121 Aligner *a = Factory < Aligner >::get(aligner_name, params);
00122 if (a) {
00123 if (cmp_name == "") {
00124 result = a->align(this, to_img);
00125 }
00126 else {
00127 result = a->align(this, to_img, cmp_name, cmp_params);
00128 }
00129 if( a )
00130 {
00131 delete a;
00132 a = 0;
00133 }
00134 }
00135
00136 EXITFUNC;
00137 return result;
00138 }
00139
00140 vector<Dict> EMData::xform_align_nbest(const string & aligner_name, EMData * to_img,
00141 const Dict & params, const unsigned int nsoln, const string & cmp_name,
00142 const Dict& cmp_params)
00143 {
00144 ENTERFUNC;
00145 Aligner *a = Factory < Aligner >::get(aligner_name, params);
00146 vector<Dict> result;
00147 if (a) {
00148 result = a->xform_align_nbest(this,to_img,nsoln,cmp_name,cmp_params);
00149 }
00150
00151 return result;
00152 }
00153
00154 EMData *EMData::project(const string & projector_name, const Dict & params)
00155 {
00156 ENTERFUNC;
00157 EMData *result = 0;
00158 Projector *p = Factory < Projector >::get(projector_name, params);
00159 if (p) {
00160 result = p->project3d(this);
00161 if( p )
00162 {
00163 delete p;
00164 p = 0;
00165 }
00166 }
00167
00168 EXITFUNC;
00169 return result;
00170 }
00171
00172
00173 EMData *EMData::project(const string & projector_name, const Transform & t3d)
00174 {
00175 ENTERFUNC;
00176 EMData *result = 0;
00177 Dict params;
00178 params["transform"] = (Transform*) &t3d;
00179 Projector *p = Factory < Projector >::get(projector_name, params);
00180 if (p) {
00181 result = p->project3d(this);
00182 if( p )
00183 {
00184 delete p;
00185 p = 0;
00186 }
00187 }
00188
00189 EXITFUNC;
00190 return result;
00191 }
00192
00193 EMData *EMData::backproject(const string & projector_name, const Dict & params)
00194 {
00195 ENTERFUNC;
00196 EMData *result = 0;
00197 Projector *p = Factory < Projector >::get(projector_name, params);
00198 if (p) {
00199 result = p->backproject3d(this);
00200 if( p )
00201 {
00202 delete p;
00203 p = 0;
00204 }
00205 }
00206
00207 EXITFUNC;
00208 return result;
00209 }