Xmipp  v3.23.11-Nereus
arotation_estimator.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: David Strelak (davidstrelak@gmail.com)
4  *
5  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA
21  *
22  * All comments concerning this program package may be sent to the
23  * e-mail address 'xmipp@cnb.csic.es'
24  ***************************************************************************/
25 
26 #include "arotation_estimator.h"
27 
28 namespace Alignment {
29 
30 template<typename T>
31 void ARotationEstimator<T>::init(const RotationEstimationSetting settings, bool reuse) {
32  // check that settings is not completely wrong
33  settings.check();
34  bool skipInit = m_isInit && reuse && this->canBeReused(settings);
35  // set it
36  m_settings = settings;
37  // initialize estimator
38  if ( ! skipInit) {
39  if (m_settings.otherDims.is2D()) {
40  this->init2D();
41  } else {
42  REPORT_ERROR(ERR_NOT_IMPLEMENTED, "Not implemented");
43  }
44  // check that there's no logical problem
45  this->check();
46  // no issue found, we're good to go
47  m_isInit = true;
48  }
49 }
50 
51 template<typename T>
53  if (m_settings.otherDims.is2D()) {
54  return this->canBeReused2D(s);
55  }
56  REPORT_ERROR(ERR_NOT_IMPLEMENTED, "Not implemented");
57 }
58 
59 template<typename T>
61  if (m_settings.otherDims.is2D()) {
62  if (AlignType::OneToN == m_settings.type) {
63  this->load2DReferenceOneToN(ref);
64  m_isRefLoaded = true;
65  return;
66  }
67  }
68  REPORT_ERROR(ERR_NOT_IMPLEMENTED, "Not implemented");
69 }
70 
71 template<typename T>
72 void ARotationEstimator<T>::compute(T *others) { // FIXME DS should be const?
73  if (m_settings.otherDims.is2D()) {
74  m_rotations2D.resize(0);
75  m_rotations2D.reserve(m_settings.otherDims.n());
76  if (AlignType::OneToN == m_settings.type) {
77  return this->computeRotation2DOneToN(others);
78  }
79  }
80  REPORT_ERROR(ERR_NOT_IMPLEMENTED, "Not implemented");
81 }
82 
83 // explicit instantiation
84 template class ARotationEstimator<float>;
85 template class ARotationEstimator<double>;
86 
87 } /* namespace Alignment */
Case or algorithm not implemented yet.
Definition: xmipp_error.h:177
void init(const RotationEstimationSetting settings, bool reuse)
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)