Xmipp  v3.23.11-Nereus
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members

#include <forward_zernike_subtomos.h>

Inheritance diagram for ProgForwardZernikeSubtomos:
Inheritance graph
[legend]
Collaboration diagram for ProgForwardZernikeSubtomos:
Collaboration graph
[legend]

Public Types

enum  Direction { Direction::ROTATE, Direction::UNROTATE }
 

Public Member Functions

 ProgForwardZernikeSubtomos ()
 Empty constructor. More...
 
 ~ProgForwardZernikeSubtomos ()
 Destructor. More...
 
void readParams ()
 Read argument from command line. More...
 
void show ()
 Show. More...
 
void defineParams ()
 Define parameters. More...
 
void preProcess ()
 
void processImage (const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
 
void numCoefficients (int l1, int l2, int &vecSize)
 Length of coefficients vector. More...
 
void minimizepos (int L1, int l2, Matrix1D< double > &steps)
 Determine the positions to be minimize of a vector containing spherical harmonic coefficients. More...
 
void fillVectorTerms (int l1, int l2, Matrix1D< int > &vL1, Matrix1D< int > &vN, Matrix1D< int > &vL2, Matrix1D< int > &vM)
 Zernike and SPH coefficients allocation. More...
 
void deformVol (MultidimArray< double > &mVD, const MultidimArray< double > &mV, double &def, double rot, double tilt, double psi)
 Deform a volumen using Zernike-Spherical harmonic basis. More...
 
void updateCTFImage (double defocusU, double defocusV, double angle)
 
double transformImageSph (double *pclnm)
 
template<Direction DIRECTION>
void rotateCoefficients ()
 
virtual void finishProcessing ()
 
virtual void writeImageParameters (MDRow &row)
 
virtual void checkPoint ()
 For very long programs, it may be needed to write checkpoints. More...
 
Matrix1D< double > weightsInterpolation3D (double x, double y, double z)
 
void splattingAtPos (std::array< double, 3 > r, double weight, MultidimArray< double > &mP, const MultidimArray< double > &mV)
 
void rotatePositions (double rot, double tilt, double psi)
 
void preComputeDF ()
 
- Public Member Functions inherited from XmippMetadataProgram
MetaDatagetInputMd ()
 
MetaDataVecgetOutputMd ()
 
 XmippMetadataProgram ()
 Empty constructor. More...
 
virtual int tryRead (int argc, const char **argv, bool reportErrors=true)
 
virtual void init ()
 
virtual void setup (MetaData *md, const FileName &o="", const FileName &oroot="", bool applyGeo=false, MDLabel label=MDL_IMAGE)
 
virtual ~XmippMetadataProgram ()
 
void setMode (WriteModeMetaData _mode)
 
void setupRowOut (const FileName &fnImgIn, const MDRow &rowIn, const FileName &fnImgOut, MDRow &rowOut) const
 Prepare rowout. More...
 
virtual void wait ()
 Wait for the distributor to finish. More...
 
virtual void run ()
 Run over all images. More...
 
- Public Member Functions inherited from XmippProgram
const char * getParam (const char *param, int arg=0)
 
const char * getParam (const char *param, const char *subparam, int arg=0)
 
int getIntParam (const char *param, int arg=0)
 
int getIntParam (const char *param, const char *subparam, int arg=0)
 
double getDoubleParam (const char *param, int arg=0)
 
double getDoubleParam (const char *param, const char *subparam, int arg=0)
 
float getFloatParam (const char *param, int arg=0)
 
float getFloatParam (const char *param, const char *subparam, int arg=0)
 
void getListParam (const char *param, StringVector &list)
 
int getCountParam (const char *param)
 
bool checkParam (const char *param)
 
bool existsParam (const char *param)
 
void addParamsLine (const String &line)
 
void addParamsLine (const char *line)
 
ParamDefgetParamDef (const char *param) const
 
virtual void quit (int exit_code=0) const
 
virtual int tryRun ()
 
void initProgress (size_t total, size_t stepBin=60)
 
void setProgress (size_t value=0)
 
void endProgress ()
 
void processDefaultComment (const char *param, const char *left)
 
void setDefaultComment (const char *param, const char *comment)
 
void setProgramName (const char *name)
 
void addUsageLine (const char *line, bool verbatim=false)
 
void clearUsage ()
 
void addExampleLine (const char *example, bool verbatim=true)
 
void addSeeAlsoLine (const char *seeAlso)
 
void addKeywords (const char *keywords)
 
const char * name () const
 
virtual void usage (int verb=0) const
 
virtual void usage (const String &param, int verb=2)
 
int version () const
 
virtual void read (int argc, const char **argv, bool reportErrors=true)
 
virtual void read (int argc, char **argv, bool reportErrors=true)
 
void read (const String &argumentsLine)
 
 XmippProgram ()
 
 XmippProgram (int argc, const char **argv)
 
virtual ~XmippProgram ()
 

Public Attributes

FileName fnVolR
 
FileName fnMaskR
 
FileName fnOutDir
 Output directory. More...
 
int L1
 
int L2
 
Matrix1D< int > vL1
 
Matrix1D< int > vN
 
Matrix1D< int > vL2
 
Matrix1D< int > vM
 
double maxShift
 
double maxAngularChange
 
double maxResol
 
double Ts
 
int Rmax
 
bool optimizeAlignment
 
bool optimizeDeformation
 
bool optimizeDefocus
 
bool ignoreCTF
 
bool optimizeRadius
 
bool phaseFlipped
 
double lambda
 
int RmaxDef
 
int num_images
 
int algn_params
 
int ctf_params
 
Matrix1D< double > p
 
int flagEnabled
 
bool useCTF
 
double t1
 
double t2
 
bool resume
 
MultidimArray< int > mask3D
 
MultidimArray< int > V_mask
 
size_t Xdim
 
FileName fnImage
 
Image< double > V
 
Image< double > Vdeformed
 
Image< double > I
 
Image< double > Ifiltered
 
Image< double > Ifilteredp
 
Image< double > P
 
FourierFilter filter
 
FourierFilter filterMW
 
Matrix2D< double > A
 
double old_rot
 
double old_tilt
 
double old_psi
 
double deltaRot
 
double deltaTilt
 
double deltaPsi
 
double old_shiftX
 
double old_shiftY
 
double old_shiftZ
 
double deltaX
 
double deltaY
 
double deltaZ
 
bool old_flip
 
bool hasCTF
 
double old_defocusU
 
double old_defocusV
 
double old_defocusAngle
 
double deltaDefocusU
 
double deltaDefocusV
 
double deltaDefocusAngle
 
double currentDefocusU
 
double currentDefocusV
 
double currentAngle
 
FourierFilter FilterCTF
 
int vecSize
 
Matrix1D< double > clnm
 
Matrix1D< double > prev_clnm
 
Matrix1D< double > steps_cp
 
double totalDeformation
 
double prior_deformation
 
int sumV
 
bool showOptimization
 
double correlation
 
int loop_step
 
struct blobtype blob
 
double blob_r
 
double sigma4
 
Matrix1D< double > gaussianProjectionTable
 
Matrix1D< double > gaussianProjectionTable2
 
MultidimArray< double > vpos
 
MultidimArray< double > df
 
std::vector< size_t > idx_z_clnm
 
std::vector< double > z_clnm_diff
 
Matrix2D< double > R
 
- Public Attributes inherited from XmippMetadataProgram
FileName fn_in
 Filenames of input and output Metadata. More...
 
FileName fn_out
 
FileName baseName
 
FileName pathBaseName
 
FileName oextBaseName
 
bool apply_geo
 Apply geo. More...
 
size_t ndimOut
 Output dimensions. More...
 
size_t zdimOut
 
size_t ydimOut
 
size_t xdimOut
 
DataType datatypeOut
 
size_t mdInSize
 Number of input elements. More...
 
- Public Attributes inherited from XmippProgram
bool doRun
 
bool runWithoutArgs
 
int verbose
 Verbosity level. More...
 
int debug
 

Protected Member Functions

void createWorkFiles ()
 
- Protected Member Functions inherited from XmippMetadataProgram
virtual void initComments ()
 
virtual void postProcess ()
 
virtual bool getImageToProcess (size_t &objId, size_t &objIndex)
 
void show () const override
 
virtual void startProcessing ()
 
virtual void writeOutput ()
 
virtual void showProgress ()
 
virtual void defineLabelParam ()
 
- Protected Member Functions inherited from XmippProgram
void defineCommons ()
 
- Protected Member Functions inherited from Rerunable
 Rerunable (const FileName &fn)
 
virtual void createWorkFiles (bool resume, MetaData *md)
 
const FileNamegetFileName () const
 
void setFileName (const FileName &fn)
 

Additional Inherited Members

- Protected Attributes inherited from XmippMetadataProgram
WriteModeMetaData mode
 Metadata writing mode: OVERWRITE, APPEND. More...
 
FileName oext
 Output extension and root. More...
 
FileName oroot
 
MDLabel image_label
 MDLabel to be used to read/write images, usually will be MDL_IMAGE. More...
 
bool produces_an_output
 Indicate that a unique final output is produced. More...
 
bool produces_a_metadata
 Indicate that the unique final output file is a Metadata. More...
 
bool each_image_produces_an_output
 Indicate that an output is produced for each image in the input. More...
 
bool allow_apply_geo
 
bool decompose_stacks
 Input Metadata will treat a stack file as a set of images instead of a unique file. More...
 
bool delete_output_stack
 Delete previous output stack file prior to process images. More...
 
bool get_image_info
 Get the input image file dimensions to further operations. More...
 
bool save_metadata_stack
 Save the associated output metadata when output file is a stack. More...
 
bool track_origin
 Include the original input image filename in the output stack. More...
 
bool keep_input_columns
 Keep input metadata columns. More...
 
bool remove_disabled
 Remove disabled images from the input selfile. More...
 
bool allow_time_bar
 Show process time bar. More...
 
bool input_is_metadata
 Input is a metadata. More...
 
bool single_image
 Input is a single image. More...
 
bool input_is_stack
 Input is a stack. More...
 
bool output_is_stack
 Output is a stack. More...
 
bool create_empty_stackfile
 
bool delete_mdIn
 
size_t time_bar_step
 Some time bar related counters. More...
 
size_t time_bar_size
 
size_t time_bar_done
 
- Protected Attributes inherited from XmippProgram
int errorCode
 
ProgramDefprogDef
 Program definition and arguments parser. More...
 
std::map< String, CommentListdefaultComments
 
int argc
 Original command line arguments. More...
 
const char ** argv
 

Detailed Description

Predict Continuous Parameters.

Definition at line 43 of file forward_zernike_subtomos.h.

Member Enumeration Documentation

◆ Direction

Enumerator
ROTATE 
UNROTATE 

Definition at line 162 of file forward_zernike_subtomos.h.

162 { ROTATE, UNROTATE };

Constructor & Destructor Documentation

◆ ProgForwardZernikeSubtomos()

ProgForwardZernikeSubtomos::ProgForwardZernikeSubtomos ( )

Empty constructor.

Definition at line 35 of file forward_zernike_subtomos.cpp.

35  : Rerunable("")
36 {
37  resume = false;
38  produces_a_metadata = true;
40  showOptimization = false;
41 }
bool each_image_produces_an_output
Indicate that an output is produced for each image in the input.
Rerunable(const FileName &fn)
bool produces_a_metadata
Indicate that the unique final output file is a Metadata.

◆ ~ProgForwardZernikeSubtomos()

ProgForwardZernikeSubtomos::~ProgForwardZernikeSubtomos ( )
default

Destructor.

Member Function Documentation

◆ checkPoint()

void ProgForwardZernikeSubtomos::checkPoint ( )
virtual

For very long programs, it may be needed to write checkpoints.

Reimplemented from XmippMetadataProgram.

Reimplemented in MpiProgForwardZernikeSubtomos.

Definition at line 622 of file forward_zernike_subtomos.cpp.

622  {
623  MDRowVec rowAppend;
625  getOutputMd().getRow(rowAppend, getOutputMd().lastRowId());
626  checkPoint.addRow(rowAppend);
627  checkPoint.append(Rerunable::getFileName());
628 }
std::unique_ptr< MDRow > getRow(size_t id) override
size_t addRow(const MDRow &row) override
const FileName & getFileName() const
virtual void checkPoint()
For very long programs, it may be needed to write checkpoints.
void append(const FileName &outFile) const

◆ createWorkFiles()

void ProgForwardZernikeSubtomos::createWorkFiles ( )
inlineprotected

Definition at line 231 of file forward_zernike_subtomos.h.

virtual void createWorkFiles(bool resume, MetaData *md)

◆ defineParams()

void ProgForwardZernikeSubtomos::defineParams ( )
virtual

Define parameters.

Reimplemented from XmippMetadataProgram.

Definition at line 105 of file forward_zernike_subtomos.cpp.

106 {
107  addUsageLine("Make a continuous angular assignment with deformations");
108  defaultComments["-i"].clear();
109  defaultComments["-i"].addComment("Metadata with initial alignment");
110  defaultComments["-o"].clear();
111  defaultComments["-o"].addComment("Metadata with the angular alignment and deformation parameters");
113  addParamsLine(" --ref <volume> : Reference volume");
114  addParamsLine(" [--mask <m=\"\">] : Reference volume");
115  addParamsLine(" [--odir <outputDir=\".\">] : Output directory");
116  addParamsLine(" [--max_shift <s=-1>] : Maximum shift allowed in pixels");
117  addParamsLine(" [--max_angular_change <a=5>] : Maximum angular change allowed (in degrees)");
118  addParamsLine(" [--max_resolution <f=4>] : Maximum resolution (A)");
119  addParamsLine(" [--sampling <Ts=1>] : Sampling rate (A/pixel)");
120  addParamsLine(" [--Rmax <R=-1>] : Maximum radius (px). -1=Half of volume size");
121  addParamsLine(" [--RDef <r=-1>] : Maximum radius of the deformation (px). -1=Half of volume size");
122  addParamsLine(" [--l1 <l1=3>] : Degree Zernike Polynomials=1,2,3,...");
123  addParamsLine(" [--l2 <l2=2>] : Harmonical depth of the deformation=1,2,3,...");
124  addParamsLine(" [--step <step=1>] : Voxel index step");
125  addParamsLine(" [--useCTF] : Correct CTF");
126  addParamsLine(" [--optimizeAlignment] : Optimize alignment");
127  addParamsLine(" [--optimizeDeformation] : Optimize deformation");
128  addParamsLine(" [--optimizeDefocus] : Optimize defocus");
129  addParamsLine(" [--phaseFlipped] : Input images have been phase flipped");
130  addParamsLine(" [--regularization <l=0.01>] : Regularization weight");
131  addParamsLine(" [--blobr <b=4>] : Blob radius for forward mapping splatting");
132  addParamsLine(" [--t1 <t1=-60>] : First tilt angle range");
133  addParamsLine(" [--t2 <t2=60>] : Second tilt angle range");
134  addParamsLine(" [--resume] : Resume processing");
135  addExampleLine("A typical use is:",false);
136  addExampleLine("xmipp_forward_zernike_subtomos -i anglesFromContinuousAssignment.xmd --ref reference.vol -o assigned_anglesAndDeformations.xmd --optimizeAlignment --optimizeDeformation --depth 1");
137 }
void addExampleLine(const char *example, bool verbatim=true)
void addUsageLine(const char *line, bool verbatim=false)
void addParamsLine(const String &line)
std::map< String, CommentList > defaultComments
Definition: xmipp_program.h:83

◆ deformVol()

void ProgForwardZernikeSubtomos::deformVol ( MultidimArray< double > &  mVD,
const MultidimArray< double > &  mV,
double &  def,
double  rot,
double  tilt,
double  psi 
)

Deform a volumen using Zernike-Spherical harmonic basis.

Definition at line 729 of file forward_zernike_subtomos.cpp.

731 {
732  size_t idxY0=(VEC_XSIZE(clnm)-9)/3;
733  double Ncount=0.0;
734  double modg=0.0;
735  double diff2=0.0;
736 
737  def=0.0;
738  size_t idxZ0=2*idxY0;
739  // sumVd=0.0;
740  double RmaxF=RmaxDef;
741  double RmaxF2=RmaxF*RmaxF;
742  double iRmaxF=1.0/RmaxF;
743  // Rotation Matrix
744  // Matrix2D<double> R, R_inv;
745  // Matrix2D<double> R;
746  // R.initIdentity(3);
747  // Euler_angles2matrix(rot, tilt, psi, R, false);
748  // Matrix2D<double> R_inv = R.inv();
749  // R_inv = R.inv();
750 
751  // auto stepsMask = std::vector<size_t>();
752  // if (optimizeDeformation)
753  // {
754  // for (size_t idx = 0; idx < idxY0; idx++)
755  // {
756  // if (1 == VEC_ELEM(steps_cp, idx))
757  // {
758  // stepsMask.emplace_back(idx);
759  // }
760  // }
761  // }
762  // else {
763  // for (size_t idx = 0; idx < idxY0; idx++)
764  // {
765  // stepsMask.emplace_back(idx);
766  // }
767  // }
768 
769  auto sz = idx_z_clnm.size();
770  Matrix1D<int> l1, l2, n, m, idx_v;
771 
772  if (!idx_z_clnm.empty())
773  {
774  l1.initZeros(sz);
775  l2.initZeros(sz);
776  n.initZeros(sz);
777  m.initZeros(sz);
778  idx_v.initZeros(sz);
779  for (auto j=0; j<sz; j++)
780  {
781  auto idx = idx_z_clnm[j];
782  if (idx >= idxY0 && idx < idxZ0)
783  idx -= idxY0;
784  else if (idx >= idxZ0)
785  idx -= idxZ0;
786 
787  VEC_ELEM(idx_v,j) = idx;
788  VEC_ELEM(l1,j) = VEC_ELEM(vL1, idx);
789  VEC_ELEM(n,j) = VEC_ELEM(vN, idx);
790  VEC_ELEM(l2,j) = VEC_ELEM(vL2, idx);
791  VEC_ELEM(m,j) = VEC_ELEM(vM, idx);
792  }
793  }
794 
795  // // TODO: Poner primero i y j en el loop, acumular suma y guardar al final
796  // const auto lastZ = FINISHINGZ(mV);
797  // const auto lastY = FINISHINGY(mV);
798  // const auto lastX = FINISHINGX(mV);
799  // for (int k=STARTINGZ(mV); k<=lastZ; k+=loop_step)
800  // {
801  // for (int i=STARTINGY(mV); i<=lastY; i+=loop_step)
802  // {
803  // for (int j=STARTINGX(mV); j<=lastX; j+=loop_step)
804  // {
805  // if (A3D_ELEM(V_mask,k,i,j) == 1) {
806  // // ZZ(p) = k; YY(p) = i; XX(p) = j;
807  // // pos = R_inv * pos;
808  // // pos = R * pos;
809  // double gx=0.0, gy=0.0, gz=0.0;
810  // double k2=k*k;
811  // double kr=k*iRmaxF;
812  // double k2i2=k2+i*i;
813  // double ir=i*iRmaxF;
814  // double r2=k2i2+j*j;
815  // double jr=j*iRmaxF;
816  // double rr=sqrt(r2)*iRmaxF;
817  // for (auto idx : stepsMask) {
818  // auto l1 = VEC_ELEM(vL1,idx);
819  // auto n = VEC_ELEM(vN,idx);
820  // auto l2 = VEC_ELEM(vL2,idx);
821  // auto m = VEC_ELEM(vM,idx);
822  // auto zsph=ZernikeSphericalHarmonics(l1,n,l2,m,jr,ir,kr,rr);
823  // auto c = std::array<double, 3>{};
824  // // XX(c_rot) = VEC_ELEM(clnm,idx); YY(c_rot) = VEC_ELEM(clnm,idx+idxY0); ZZ(c_rot) = VEC_ELEM(clnm,idx+idxZ0);
825  // // if (num_images == 1 && optimizeDeformation)
826  // // {
827  // // //? Hacer algun check para ahorrarnos cuentas si no usamos priors (en ese
828  // // //? caso podemos usar las lineas comentadas)
829  // // double c_x = VEC_ELEM(clnm,idx);
830  // // double c_y = VEC_ELEM(clnm,idx+idxY0);
831  // // // c[0] = R_inv.mdata[0] * c_x + R_inv.mdata[1] * c_y;
832  // // // c[1] = R_inv.mdata[3] * c_x + R_inv.mdata[4] * c_y;
833  // // // c[2] = R_inv.mdata[6] * c_x + R_inv.mdata[7] * c_y;
834  // // double c_z = VEC_ELEM(clnm, idx + idxZ0);
835  // // c[0] = R_inv.mdata[0] * c_x + R_inv.mdata[1] * c_y + R_inv.mdata[2] * c_z;
836  // // c[1] = R_inv.mdata[3] * c_x + R_inv.mdata[4] * c_y + R_inv.mdata[5] * c_z;
837  // // c[2] = R_inv.mdata[6] * c_x + R_inv.mdata[7] * c_y + R_inv.mdata[8] * c_z;
838  // // }
839  // // else {
840  // c[0] = VEC_ELEM(clnm,idx);
841  // c[1] = VEC_ELEM(clnm,idx+idxY0);
842  // c[2] = VEC_ELEM(clnm,idx+idxZ0);
843  // // }
844  // if (rr>0 || l2==0) {
845  // gx += c[0] *(zsph);
846  // gy += c[1] *(zsph);
847  // gz += c[2] *(zsph);
848  // }
849  // }
850 
851  // auto pos = std::array<double, 3>{};
852  // double r_x = j + gx;
853  // double r_y = i + gy;
854  // double r_z = k + gz;
855  // pos[0] = R.mdata[0] * r_x + R.mdata[1] * r_y + R.mdata[2] * r_z;
856  // pos[1] = R.mdata[3] * r_x + R.mdata[4] * r_y + R.mdata[5] * r_z;
857  // pos[2] = R.mdata[6] * r_x + R.mdata[7] * r_y + R.mdata[8] * r_z;
858 
859  // double voxel_mV = A3D_ELEM(mV,k,i,j);
860  // splattingAtPos(pos, voxel_mV, mP, mV);
861  // if (!mV.outside(pos[2], pos[1], pos[0]))
862  // sumVd += voxel_mV;
863  // modg += gx*gx+gy*gy+gz*gz;
864  // Ncount++;
865  // }
866  // }
867  // }
868  // }
869 
870  const auto &mVpos = vpos;
871  const auto lastY = FINISHINGY(mVpos);
872  for (int i=STARTINGY(mVpos); i<=lastY; i++)
873  {
874  double &gx = A2D_ELEM(df, i, 0);
875  double &gy = A2D_ELEM(df, i, 1);
876  double &gz = A2D_ELEM(df, i, 2);
877  double r_x = A2D_ELEM(mVpos, i, 0);
878  double r_y = A2D_ELEM(mVpos, i, 1);
879  double r_z = A2D_ELEM(mVpos, i, 2);
880  double xr = A2D_ELEM(mVpos, i, 3);
881  double yr = A2D_ELEM(mVpos, i, 4);
882  double zr = A2D_ELEM(mVpos, i, 5);
883  double rr = A2D_ELEM(mVpos, i, 6);
884 
885  if (!idx_z_clnm.empty())
886  {
887  for (auto j = 0; j < sz; j++)
888  {
889  auto idx = VEC_ELEM(idx_v, j);
890  auto aux_l2 = VEC_ELEM(l2, j);
891  auto zsph = ZernikeSphericalHarmonics(VEC_ELEM(l1, j), VEC_ELEM(n, j),
892  aux_l2, VEC_ELEM(m, j), xr, yr, zr, rr);
893 
894  auto diff_c_x = VEC_ELEM(clnm, idx) - VEC_ELEM(prev_clnm, idx);
895  auto diff_c_y = VEC_ELEM(clnm, idx + idxY0) - VEC_ELEM(prev_clnm, idx + idxY0);
896  auto diff_c_z = VEC_ELEM(clnm, idx + idxZ0) - VEC_ELEM(prev_clnm, idx + idxZ0);
897  // auto i_diff_c_x = R_inv.mdata[0] * diff_c_x + R_inv.mdata[1] * diff_c_y;
898  // auto i_diff_c_y = R_inv.mdata[3] * diff_c_x + R_inv.mdata[4] * diff_c_y;
899  // auto i_diff_c_z = R_inv.mdata[6] * diff_c_x + R_inv.mdata[7] * diff_c_y;
900  if (rr > 0 || aux_l2 == 0)
901  {
902  gx += diff_c_x * (zsph);
903  gy += diff_c_y * (zsph);
904  gz += diff_c_z * (zsph);
905  }
906  }
907  }
908 
909  auto r_gx = R.mdata[0] * gx + R.mdata[1] * gy + R.mdata[2] * gz;
910  auto r_gy = R.mdata[3] * gx + R.mdata[4] * gy + R.mdata[5] * gz;
911  auto r_gz = R.mdata[6] * gx + R.mdata[7] * gy + R.mdata[8] * gz;
912 
913  auto pos = std::array<double, 3>{};
914  pos[0] = r_x + r_gx;
915  pos[1] = r_y + r_gy;
916  pos[2] = r_z + r_gz;
917 
918  double voxel_mV = A2D_ELEM(mVpos, i, 7);
919  splattingAtPos(pos, voxel_mV, mP, mV);
920 
921  modg += gx * gx + gy * gy + gz * gz;
922  Ncount++;
923  }
924 
925  // def=sqrt(modg/Ncount);
926  def = sqrt(modg/Ncount);
927  totalDeformation = def;
928 }
#define A2D_ELEM(v, i, j)
#define VEC_ELEM(v, i)
Definition: matrix1d.h:245
#define VEC_XSIZE(m)
Definition: matrix1d.h:77
void sqrt(Image< double > &op)
T * mdata
Definition: matrix2d.h:395
#define i
#define STARTINGY(v)
void initZeros()
Definition: matrix1d.h:592
#define j
int m
#define FINISHINGY(v)
double ZernikeSphericalHarmonics(int n, int m, double xr, double yr, double zr, double r)
void splattingAtPos(std::array< double, 3 > r, double weight, MultidimArray< double > &mP, const MultidimArray< double > &mV)
int * n

◆ fillVectorTerms()

void ProgForwardZernikeSubtomos::fillVectorTerms ( int  l1,
int  l2,
Matrix1D< int > &  vL1,
Matrix1D< int > &  vN,
Matrix1D< int > &  vL2,
Matrix1D< int > &  vM 
)

Zernike and SPH coefficients allocation.

Definition at line 673 of file forward_zernike_subtomos.cpp.

675 {
676  int idx = 0;
677  vL1.initZeros(vecSize);
678  vN.initZeros(vecSize);
679  vL2.initZeros(vecSize);
680  vM.initZeros(vecSize);
681  for (int h=0; h<=l2; h++) {
682  int totalSPH = 2*h+1;
683  int aux = std::floor(totalSPH/2);
684  for (int l=h; l<=l1; l+=2) {
685  for (int m=0; m<totalSPH; m++) {
686  VEC_ELEM(vL1,idx) = l;
687  VEC_ELEM(vN,idx) = h;
688  VEC_ELEM(vL2,idx) = h;
689  VEC_ELEM(vM,idx) = m-aux;
690  idx++;
691  }
692  }
693  }
694 }
#define VEC_ELEM(v, i)
Definition: matrix1d.h:245
__host__ __device__ float2 floor(const float2 v)
void initZeros()
Definition: matrix1d.h:592
int m

◆ finishProcessing()

void ProgForwardZernikeSubtomos::finishProcessing ( )
virtual

Write the final parameters.

Reimplemented from XmippMetadataProgram.

Reimplemented in MpiProgForwardZernikeSubtomos.

Definition at line 249 of file forward_zernike_subtomos.cpp.

249  {
251  rename(Rerunable::getFileName().c_str(), (fnOutDir + fn_out).c_str());
252 }
const FileName & getFileName() const
FileName fnOutDir
Output directory.

◆ minimizepos()

void ProgForwardZernikeSubtomos::minimizepos ( int  L1,
int  l2,
Matrix1D< double > &  steps 
)

Determine the positions to be minimize of a vector containing spherical harmonic coefficients.

Definition at line 646 of file forward_zernike_subtomos.cpp.

647 {
648  int size = 0;
649  int prevSize = 0;
650  numCoefficients(L1,l2,size);
651  numCoefficients(L1,l2-1,prevSize);
652  int totalSize = (steps.size()-9)/3;
653  if (l2 > 1)
654  {
655  for (int idx = prevSize; idx < size; idx++)
656  {
657  VEC_ELEM(steps, idx) = 1.;
658  VEC_ELEM(steps, idx + totalSize) = 1.;
659  VEC_ELEM(steps, idx + 2 * totalSize) = 1.;
660  }
661  }
662  else
663  {
664  for (int idx = 0; idx < size; idx++)
665  {
666  VEC_ELEM(steps, idx) = 1.;
667  VEC_ELEM(steps, idx + totalSize) = 1.;
668  VEC_ELEM(steps, idx + 2 * totalSize) = 1.;
669  }
670  }
671 }
#define VEC_ELEM(v, i)
Definition: matrix1d.h:245
size_t size() const
Definition: matrix1d.h:508
void numCoefficients(int l1, int l2, int &vecSize)
Length of coefficients vector.

◆ numCoefficients()

void ProgForwardZernikeSubtomos::numCoefficients ( int  l1,
int  l2,
int &  vecSize 
)

Length of coefficients vector.

Definition at line 630 of file forward_zernike_subtomos.cpp.

631 {
632  for (int h=0; h<=l2; h++)
633  {
634  int numSPH = 2*h+1;
635  int count=l1-h+1;
636  int numEven=(count>>1)+(count&1 && !(h&1));
637  if (h%2 == 0) {
638  vecSize += numSPH*numEven;
639  }
640  else {
641  vecSize += numSPH*(l1-h+1-numEven);
642  }
643  }
644 }

◆ preComputeDF()

void ProgForwardZernikeSubtomos::preComputeDF ( )

Definition at line 1072 of file forward_zernike_subtomos.cpp.

1073 {
1074  size_t idxY0=(VEC_XSIZE(clnm)-9)/3;
1075  size_t idxZ0=2*idxY0;
1076  // Matrix2D<double> R_inv = R.inv();
1077  const auto &mVpos = vpos;
1078  const auto lastY = FINISHINGY(mVpos);
1079  for (int i=STARTINGY(mVpos); i<=lastY; i++)
1080  {
1081  double &gx = A2D_ELEM(df, i, 0);
1082  double &gy = A2D_ELEM(df, i, 1);
1083  double &gz = A2D_ELEM(df, i, 2);
1084  double r_x = A2D_ELEM(mVpos, i, 0);
1085  double r_y = A2D_ELEM(mVpos, i, 1);
1086  double r_z = A2D_ELEM(mVpos, i, 2);
1087  double xr = A2D_ELEM(mVpos, i, 3);
1088  double yr = A2D_ELEM(mVpos, i, 4);
1089  double zr = A2D_ELEM(mVpos, i, 5);
1090  double rr = A2D_ELEM(mVpos, i, 6);
1091 
1092  if (!idx_z_clnm.empty())
1093  {
1094  for (int idx = 0; idx < idxY0; idx++)
1095  {
1096  auto aux_l2 = VEC_ELEM(vL2, idx);
1097  auto zsph = ZernikeSphericalHarmonics(VEC_ELEM(vL1, idx), VEC_ELEM(vN, idx),
1098  aux_l2, VEC_ELEM(vM, idx), xr, yr, zr, rr);
1099  auto c_x = VEC_ELEM(clnm, idx);
1100  auto c_y = VEC_ELEM(clnm, idx + idxY0);
1101  auto c_z = VEC_ELEM(clnm, idx + idxZ0);
1102  // auto i_c_x = R_inv.mdata[0] * c_x + R_inv.mdata[1] * c_y + R_inv.mdata[2] * c_z;
1103  // auto i_c_y = R_inv.mdata[3] * c_x + R_inv.mdata[4] * c_y + R_inv.mdata[5] * c_z;
1104  // auto i_c_z = R_inv.mdata[6] * c_x + R_inv.mdata[7] * c_y + R_inv.mdata[8] * c_z;
1105  if (rr > 0 || aux_l2 == 0)
1106  {
1107  gx += c_x * (zsph);
1108  gy += c_y * (zsph);
1109  gz += c_z * (zsph);
1110  }
1111  }
1112  }
1113  }
1114 }
#define A2D_ELEM(v, i, j)
#define VEC_ELEM(v, i)
Definition: matrix1d.h:245
#define VEC_XSIZE(m)
Definition: matrix1d.h:77
#define i
#define STARTINGY(v)
#define FINISHINGY(v)
double ZernikeSphericalHarmonics(int n, int m, double xr, double yr, double zr, double r)

◆ preProcess()

void ProgForwardZernikeSubtomos::preProcess ( )
virtual

Produce side info. An exception is thrown if any of the files is not found

Reimplemented from XmippMetadataProgram.

Definition at line 139 of file forward_zernike_subtomos.cpp.

140 {
141  V.read(fnVolR);
142  V().setXmippOrigin();
143  Xdim=XSIZE(V());
144  Vdeformed().initZeros(V());
145  Vdeformed().setXmippOrigin();
146  // sumV=V().sum();
147 
148  Ifilteredp().initZeros(Xdim,Xdim,Xdim);
149  Ifilteredp().setXmippOrigin();
150  P().initZeros(Xdim,Xdim,Xdim);
151 
152  if (RmaxDef<0)
153  RmaxDef = Xdim/2;
154 
155  // Read Reference mask if avalaible (otherwise sphere of radius RmaxDef is used)
156  Mask mask;
157  mask.type = BINARY_CIRCULAR_MASK;
158  mask.mode = INNER_MASK;
159  if (fnMaskR != "") {
160  Image<double> aux;
161  aux.read(fnMaskR);
162  typeCast(aux(), V_mask);
164  double Rmax2 = RmaxDef*RmaxDef;
165  for (int k=STARTINGZ(V_mask); k<=FINISHINGZ(V_mask); k++) {
166  for (int i=STARTINGY(V_mask); i<=FINISHINGY(V_mask); i++) {
167  for (int j=STARTINGX(V_mask); j<=FINISHINGX(V_mask); j++) {
168  double r2 = k*k + i*i + j*j;
169  if (r2>=Rmax2)
170  A3D_ELEM(V_mask,k,i,j) = 0;
171  }
172  }
173  }
174  }
175  else {
176  mask.R1 = RmaxDef;
177  mask.generate_mask(V());
178  V_mask = mask.get_binary_mask();
180  }
181 
182  // Total Volume Mass (Inside Mask)
183  sumV = 0;
184  for (int k = STARTINGZ(V()); k <= FINISHINGZ(V()); k += loop_step)
185  {
186  for (int i = STARTINGY(V()); i <= FINISHINGY(V()); i += loop_step)
187  {
188  for (int j = STARTINGX(V()); j <= FINISHINGX(V()); j += loop_step)
189  {
190  if (A3D_ELEM(V_mask, k, i, j) == 1)
191  {
192  sumV++;
193  }
194  }
195  }
196  }
197 
198  // Construct mask
199  if (Rmax<0)
200  Rmax=Xdim/2;
201  mask.R1 = Rmax;
202  mask.generate_mask(Xdim,Xdim,Xdim);
203  mask3D=mask.get_binary_mask();
204 
205  // Low pass filter
207  filter.do_generate_3dmask = true;
209  filter.raised_w=0.02;
210 
211  // MW filter
212  // filterMW.FilterBand=WEDGE;
213  // filterMW.FilterShape=WEDGE;
214  // filterMW.do_generate_3dmask = true;
215  // filterMW.t1 = t1;
216  // filterMW.t2 = t2;
217  // filterMW.rot=filterMW.tilt=filterMW.psi=0.0;
221  filterMW.t1 = t1;
222  filterMW.t2 = t2;
225  filterMW.raised_w=0.02;
226 
227  // Transformation matrix
228  A.initIdentity(4);
229 
230  // CTF Filter
233  FilterCTF.ctf.enable_CTFnoise = false;
235 
236  vecSize = 0;
239 
240  createWorkFiles();
241 
242  // Blob
243  blob.radius = blob_r; // Blob radius in voxels
244  blob.order = 2; // Order of the Bessel function
245  blob.alpha = 7.05; // Smoothness parameter
246 
247 }
double alpha
Smoothness parameter.
Definition: blobs.h:121
CTFDescription ctf
#define FINISHINGX(v)
Definition: mask.h:360
#define FINISHINGZ(v)
void numCoefficients(int l1, int l2, int &vecSize)
Length of coefficients vector.
#define STARTINGX(v)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define STARTINGY(v)
#define A3D_ELEM(V, k, i, j)
#define CTF
double R1
Definition: mask.h:413
#define XSIZE(v)
int type
Definition: mask.h:402
#define j
#define WEDGE_RC
#define FINISHINGY(v)
void generate_mask(bool apply_geo=false)
Definition: mask.cpp:1577
void typeCast(const Matrix1D< T1 > &v1, Matrix1D< T2 > &v2)
Definition: matrix1d.h:1227
#define BINARY_CIRCULAR_MASK
Definition: mask.h:365
void produceSideInfo()
Produce Side information.
Definition: ctf.cpp:1392
int order
Derivation order and Bessel function order.
Definition: blobs.h:118
void fillVectorTerms(int l1, int l2, Matrix1D< int > &vL1, Matrix1D< int > &vN, Matrix1D< int > &vL2, Matrix1D< int > &vM)
Zernike and SPH coefficients allocation.
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
float r2
bool enable_CTFnoise
Enable CTFnoise part.
Definition: ctf.h:273
const MultidimArray< int > & get_binary_mask() const
Definition: mask.h:707
#define STARTINGZ(v)
double radius
Spatial radius in Universal System units.
Definition: blobs.h:115
#define LOWPASS
void initIdentity()
Definition: matrix2d.h:673
int mode
Definition: mask.h:407
constexpr int INNER_MASK
Definition: mask.h:47

◆ processImage()

void ProgForwardZernikeSubtomos::processImage ( const FileName fnImg,
const FileName fnImgOut,
const MDRow rowIn,
MDRow rowOut 
)
virtual

Predict angles and shift. At the input the pose parameters must have an initial guess of the parameters. At the output they have the estimated pose.

Implements XmippMetadataProgram.

Definition at line 416 of file forward_zernike_subtomos.cpp.

417 {
419  // totalSize = 3*num_Z_coeff + 3 shifts + 3 angles + 3 CTF
420  int totalSize = 3*vecSize + 9;
421  p.initZeros(totalSize);
422  clnm.initZeros(totalSize);
423  prev_clnm.initZeros(totalSize);
424 
425  // Init positions and deformation field
426  vpos.initZeros(sumV, 8);
427  df.initZeros(sumV, 3);
428 
429  flagEnabled=1;
430 
431  rowIn.getValueOrDefault(MDL_IMAGE, fnImage, "");
438  I.read(fnImage);
439  I().setXmippOrigin();
440  Ifiltered() = I();
443 
444  if (verbose >= 2)
445  std::cout << "Processing Image (" << fnImage << ")" << std::endl;
446 
447  if (rowIn.containsLabel(MDL_FLIP))
448  rowIn.getValue(MDL_FLIP,old_flip);
449  else
450  old_flip = false;
451 
452  prior_deformation = 0.0;
454  {
455  std::vector<double> vectortemp;
456  rowIn.getValue(MDL_SPH_COEFFICIENTS, vectortemp);
458  for (int i=0; i<3*vecSize; i++)
459  {
460  clnm[i] = vectortemp[i];
461  }
462  // if (optimizeDeformation)
463  // rotateCoefficients<Direction::ROTATE>();
464  p = clnm;
465  prev_clnm = clnm;
466  preComputeDF();
467  }
468 
469  // FIXME: Add defocus per image and make CTF correction available
471  {
472  hasCTF=true;
473  FilterCTF.ctf.readFromMdRow(rowIn);
474  FilterCTF.ctf.Tm = Ts;
479  }
480  else
481  hasCTF=false;
482 
483  // If deformation is not optimized, do a single iteration
484  //? Si usamos priors es mejor ir poco a poco, ir poco a poco pero usar todos los coeffs cada vez (mas lento)
485  //? O dar solo una iteracion con todos los coeffs?
486  int h = 1;
487  // if (!optimizeDeformation)
488  // if (rowIn.containsLabel(MDL_SPH_COEFFICIENTS))
489  // h = L2;
490 
491  for (;h<=L2;h++)
492  {
493  if (verbose>=2)
494  {
495  std::cout<<std::endl;
496  std::cout<<"------------------------------ Basis Degrees: ("<<L1<<","<<h<<") ----------------------------"<<std::endl;
497  }
498  steps.clear();
499  steps.initZeros(totalSize);
500 
501  // Optimize
502  double cost=-1;
503  correlation = 0.0;
504  try
505  {
506  cost=1e38;
507  int iter;
508  if (optimizeAlignment)
509  {
510  int init = steps.size() - 9;
511  int end = steps.size() - 3;
512  for (int i = init; i < end; i++)
513  steps(i)=1.;
514  }
515  if (optimizeDefocus)
516  {
517  int init = steps.size() - 3;
518  int end = steps.size();
519  for (int i = init; i < end; i++)
520  steps(i)=1.;
521  }
523  {
524  minimizepos(L1,h,steps);
525  }
526  steps_cp = steps;
527  powellOptimizer(p, 1, totalSize, &continuousZernikeSubtomoCost, this, 0.1, cost, iter, steps, verbose>=2);
528 
529  if (verbose>=3)
530  {
531  showOptimization = true;
533  showOptimization = false;
534  }
535 
536  if (cost>0)
537  {
538  flagEnabled=-1;
539  p.initZeros();
540  }
541  cost=-cost;
542  correlation=cost;
543  if (verbose>=2)
544  {
545  std::cout<<std::endl;
546  for (int j=1;j<4;j++)
547  {
548  switch (j)
549  {
550  case 1:
551  std::cout << "X Coefficients=(";
552  break;
553  case 2:
554  std::cout << "Y Coefficients=(";
555  break;
556  case 3:
557  std::cout << "Z Coefficients=(";
558  break;
559  }
560  for (int i=(j-1)*vecSize;i<j*vecSize;i++)
561  {
562  std::cout << p(i);
563  if (i<j*vecSize-1)
564  std::cout << ",";
565  }
566  std::cout << ")" << std::endl;
567  }
568  std::cout << "Radius=" << RmaxDef << std::endl;
569  std::cout << " Dshift=(" << p(totalSize-5) << "," << p(totalSize-4) << ") "
570  << "Drot=" << p(totalSize-3) << " Dtilt=" << p(totalSize-2)
571  << " Dpsi=" << p(totalSize-1) << std::endl;
572  std::cout << " Total deformation=" << totalDeformation << std::endl;
573  std::cout<<std::endl;
574  }
575  }
576  catch (XmippError &XE)
577  {
578  std::cerr << XE.what() << std::endl;
579  std::cerr << "Warning: Cannot refine " << fnImg << std::endl;
580  flagEnabled=-1;
581  }
582  }
583 
584  // if (optimizeDeformation)
585  // {
586  // rotateCoefficients<Direction::UNROTATE>();
587  // }
588 
589  //AJ NEW
590  writeImageParameters(rowOut);
591  //END AJ
592 
593 }
Rotation angle of an image (double,degrees)
Defocus U (Angstroms)
double continuousZernikeSubtomoCost(double *x, void *_prm)
CTFDescription ctf
void clear()
Definition: matrix1d.cpp:67
size_t size() const
Definition: matrix1d.h:508
void rotatePositions(double rot, double tilt, double psi)
Tilting angle of an image (double,degrees)
double DeltafV
Defocus in V (in Angstroms). Negative values are underfocused.
Definition: ctf.h:830
Shift for the image in the X axis (double)
Special label to be used when gathering MDs in MpiMetadataPrograms.
Name for the CTF Model (std::string)
void powellOptimizer(Matrix1D< double > &p, int i0, int n, double(*f)(double *x, void *), void *prm, double ftol, double &fret, int &iter, const Matrix1D< double > &steps, bool show)
glob_prnt iter
#define i
double DeltafU
Global gain. By default, 1.
Definition: ctf.h:828
double azimuthal_angle
Azimuthal angle (between X and U) in degrees.
Definition: ctf.h:832
T & getValue(MDLabel label)
Deformation in voxels.
Flip the image? (bool)
double Tm
Sampling rate (A/pixel)
Definition: ctf.h:240
void readFromMdRow(const MDRow &row, bool disable_if_not_K=true)
Definition: ctf.cpp:1172
int verbose
Verbosity level.
void initZeros()
Definition: matrix1d.h:592
#define j
double steps
const T & getValueOrDefault(MDLabel label, const T &def) const
virtual void writeImageParameters(MDRow &row)
void minimizepos(int L1, int l2, Matrix1D< double > &steps)
Determine the positions to be minimize of a vector containing spherical harmonic coefficients.
virtual bool containsLabel(MDLabel label) const =0
void produceSideInfo()
Produce Side information.
Definition: ctf.cpp:1392
Deformation coefficients.
Shift for the image in the Z axis (double)
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
Shift for the image in the Y axis (double)
void initZeros(const MultidimArray< T1 > &op)
T * adaptForNumericalRecipes() const
Definition: matrix1d.h:844
Name of an image (std::string)
void applyMaskSpace(MultidimArray< double > &v)

◆ readParams()

void ProgForwardZernikeSubtomos::readParams ( )
virtual

Read argument from command line.

Reimplemented from XmippMetadataProgram.

Definition at line 46 of file forward_zernike_subtomos.cpp.

47 {
49  fnVolR = getParam("--ref");
50  fnMaskR = getParam("--mask");
51  fnOutDir = getParam("--odir");
52  maxShift = getDoubleParam("--max_shift");
53  maxAngularChange = getDoubleParam("--max_angular_change");
54  maxResol = getDoubleParam("--max_resolution");
55  Ts = getDoubleParam("--sampling");
56  Rmax = getIntParam("--Rmax");
57  RmaxDef = getIntParam("--RDef");
58  optimizeAlignment = checkParam("--optimizeAlignment");
59  optimizeDeformation = checkParam("--optimizeDeformation");
60  optimizeDefocus = checkParam("--optimizeDefocus");
61  phaseFlipped = checkParam("--phaseFlipped");
62  useCTF = checkParam("--useCTF");
63  L1 = getIntParam("--l1");
64  L2 = getIntParam("--l2");
65  loop_step = getIntParam("--step");
66  lambda = getDoubleParam("--regularization");
67  resume = checkParam("--resume");
68  Rerunable::setFileName(fnOutDir + "/sphDone.xmd");
69  blob_r = getDoubleParam("--blobr");
70  t1 = getDoubleParam("--t1");
71  t2 = getDoubleParam("--t2");
72  keep_input_columns = true;
73 }
double getDoubleParam(const char *param, int arg=0)
void setFileName(const FileName &fn)
const char * getParam(const char *param, int arg=0)
FileName fnOutDir
Output directory.
bool keep_input_columns
Keep input metadata columns.
bool checkParam(const char *param)
int getIntParam(const char *param, int arg=0)

◆ rotateCoefficients()

template<ProgForwardZernikeSubtomos::Direction DIRECTION>
void ProgForwardZernikeSubtomos::rotateCoefficients ( )

Definition at line 706 of file forward_zernike_subtomos.cpp.

706  {
707  int pos = 3*vecSize;
708  size_t idxY0=(VEC_XSIZE(clnm)-9)/3;
709  size_t idxZ0=2*idxY0;
710 
711  double rot = old_rot+p(pos+2);
712  double tilt = old_tilt+p(pos+3);
713  double psi = old_psi+p(pos+4);
714 
716  R.initIdentity(3);
717  Euler_angles2matrix(rot, tilt, psi, R, false);
718  if (DIRECTION == Direction::UNROTATE)
719  R = R.inv();
721  c.initZeros(3);
722  for (size_t idx=0; idx<idxY0; idx++) {
723  XX(c) = VEC_ELEM(clnm,idx); YY(c) = VEC_ELEM(clnm,idx+idxY0); ZZ(c) = VEC_ELEM(clnm,idx+idxZ0);
724  c = R * c;
725  VEC_ELEM(clnm,idx) = XX(c); VEC_ELEM(clnm,idx+idxY0) = YY(c); VEC_ELEM(clnm,idx+idxZ0) = ZZ(c);
726  }
727 }
#define VEC_ELEM(v, i)
Definition: matrix1d.h:245
#define VEC_XSIZE(m)
Definition: matrix1d.h:77
void Euler_angles2matrix(T alpha, T beta, T gamma, Matrix2D< T > &A, bool homogeneous)
Definition: geometry.cpp:624
doublereal * c
void inv(Matrix2D< T > &result) const
Definition: matrix2d.cpp:663
#define XX(v)
Definition: matrix1d.h:85
void initZeros()
Definition: matrix1d.h:592
#define YY(v)
Definition: matrix1d.h:93
double psi(const double x)
#define ZZ(v)
Definition: matrix1d.h:101
void initIdentity()
Definition: matrix2d.h:673

◆ rotatePositions()

void ProgForwardZernikeSubtomos::rotatePositions ( double  rot,
double  tilt,
double  psi 
)

Definition at line 1028 of file forward_zernike_subtomos.cpp.

1029 {
1030  // Matrix2D<double> R;
1031  R.initIdentity(3);
1032  Euler_angles2matrix(rot, tilt, psi, R, false);
1033 
1034  const MultidimArray<double> &mV=V();
1035 
1036  const auto lastZ = FINISHINGZ(mV);
1037  const auto lastY = FINISHINGY(mV);
1038  const auto lastX = FINISHINGX(mV);
1039  size_t count = 0;
1040  double iRmaxF=1.0/RmaxDef;
1041  for (int k=STARTINGZ(mV); k<=lastZ; k+=loop_step)
1042  {
1043  for (int i=STARTINGY(mV); i<=lastY; i+=loop_step)
1044  {
1045  for (int j=STARTINGX(mV); j<=lastX; j+=loop_step)
1046  {
1047  if (A3D_ELEM(V_mask,k,i,j) == 1) {
1048  double x = j;
1049  double y = i;
1050  double z = k;
1051  double r_x = R.mdata[0] * x + R.mdata[1] * y + R.mdata[2] * z;
1052  double r_y = R.mdata[3] * x + R.mdata[4] * y + R.mdata[5] * z;
1053  double r_z = R.mdata[6] * x + R.mdata[7] * y + R.mdata[8] * z;
1054 
1055  A2D_ELEM(vpos, count, 0) = r_x;
1056  A2D_ELEM(vpos, count, 1) = r_y;
1057  A2D_ELEM(vpos, count, 2) = r_z;
1058  A2D_ELEM(vpos, count, 3) = j * iRmaxF;
1059  A2D_ELEM(vpos, count, 4) = i * iRmaxF;
1060  A2D_ELEM(vpos, count, 5) = z * iRmaxF;
1061  A2D_ELEM(vpos, count, 6) = sqrt(x*x + y*y + z*z) * iRmaxF;
1062  A2D_ELEM(vpos, count, 7) = A3D_ELEM(mV, k, i, j);
1063 
1064  count++;
1065  }
1066  }
1067  }
1068  }
1069 }
#define A2D_ELEM(v, i, j)
#define FINISHINGX(v)
void Euler_angles2matrix(T alpha, T beta, T gamma, Matrix2D< T > &A, bool homogeneous)
Definition: geometry.cpp:624
void sqrt(Image< double > &op)
static double * y
T * mdata
Definition: matrix2d.h:395
#define FINISHINGZ(v)
#define STARTINGX(v)
doublereal * x
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define STARTINGY(v)
#define A3D_ELEM(V, k, i, j)
double z
#define j
#define FINISHINGY(v)
double psi(const double x)
#define STARTINGZ(v)
void initIdentity()
Definition: matrix2d.h:673

◆ show()

void ProgForwardZernikeSubtomos::show ( )

Show.

Definition at line 76 of file forward_zernike_subtomos.cpp.

77 {
78  if (!verbose)
79  return;
81  std::cout
82  << "Output directory: " << fnOutDir << std::endl
83  << "Reference volume: " << fnVolR << std::endl
84  << "Reference mask: " << fnMaskR << std::endl
85  << "Max. Shift: " << maxShift << std::endl
86  << "Max. Angular Change: " << maxAngularChange << std::endl
87  << "Max. Resolution: " << maxResol << std::endl
88  << "Sampling: " << Ts << std::endl
89  << "Max. Radius: " << Rmax << std::endl
90  << "Max. Radius Deform. " << RmaxDef << std::endl
91  << "Zernike Degree: " << L1 << std::endl
92  << "SH Degree: " << L2 << std::endl
93  << "Step: " << loop_step << std::endl
94  << "Correct CTF: " << useCTF << std::endl
95  << "Optimize alignment: " << optimizeAlignment << std::endl
96  << "Optimize deformation:" << optimizeDeformation<< std::endl
97  << "Optimize defocus: " << optimizeDefocus << std::endl
98  << "Phase flipped: " << phaseFlipped << std::endl
99  << "Regularization: " << lambda << std::endl
100  << "Blob radius: " << blob_r << std::endl
101  ;
102 }
int verbose
Verbosity level.
FileName fnOutDir
Output directory.
void show() const override

◆ splattingAtPos()

void ProgForwardZernikeSubtomos::splattingAtPos ( std::array< double, 3 >  r,
double  weight,
MultidimArray< double > &  mP,
const MultidimArray< double > &  mV 
)

Definition at line 961 of file forward_zernike_subtomos.cpp.

961  {
962  // Find the part of the volume that must be updated
963  // double x_pos = r[0];
964  // double y_pos = r[1];
965  // double z_pos = r[2];
966  // // int k0 = XMIPP_MAX(FLOOR(z_pos - blob_r), STARTINGZ(mV));
967  // // int kF = XMIPP_MIN(CEIL(z_pos + blob_r), FINISHINGZ(mV));
968  // // int i0 = XMIPP_MAX(FLOOR(y_pos - blob_r), STARTINGY(mV));
969  // // int iF = XMIPP_MIN(CEIL(y_pos + blob_r), FINISHINGY(mV));
970  // // int j0 = XMIPP_MAX(FLOOR(x_pos - blob_r), STARTINGX(mV));
971  // // int jF = XMIPP_MIN(CEIL(x_pos + blob_r), FINISHINGX(mV));
972  // int k0 = XMIPP_MAX(FLOOR(z_pos - sigma4), STARTINGZ(mV));
973  // int kF = XMIPP_MIN(CEIL(z_pos + sigma4), FINISHINGZ(mV));
974  // int i0 = XMIPP_MAX(FLOOR(y_pos - sigma4), STARTINGY(mV));
975  // int iF = XMIPP_MIN(CEIL(y_pos + sigma4), FINISHINGY(mV));
976  // int j0 = XMIPP_MAX(FLOOR(x_pos - sigma4), STARTINGX(mV));
977  // int jF = XMIPP_MIN(CEIL(x_pos + sigma4), FINISHINGX(mV));
978  // int size = gaussianProjectionTable.size();
979  // for (int k = k0; k <= kF; k++)
980  // {
981  // double k2 = (z_pos - k) * (z_pos - k);
982  // for (int i = i0; i <= iF; i++)
983  // {
984  // double y2 = (y_pos - i) * (y_pos - i);
985  // for (int j = j0; j <= jF; j++)
986  // {
987  // // double mod = sqrt((x_pos - j) * (x_pos - j) + y2 + k2);
988  // // // A3D_ELEM(Vdeformed(),k, i, j) += weight * blob_val(rdiff.module(), blob);
989  // // A3D_ELEM(mP, k, i, j) += weight * kaiser_value(mod, blob.radius, blob.alpha, blob.order);
990  // double mod = sqrt((x_pos - j) * (x_pos - j) + y2 + k2);
991  // double didx = mod * 1000;
992  // int idx = ROUND(didx);
993  // if (idx < size)
994  // {
995  // double gw = gaussianProjectionTable.vdata[idx];
996  // A3D_ELEM(mP, k, i, j) += weight * gw;
997  // }
998  // }
999  // }
1000  // }
1001 
1002  double x_pos = r[0];
1003  double y_pos = r[1];
1004  double z_pos = r[2];
1005  int i0 = XMIPP_MAX(CEIL(y_pos - loop_step), STARTINGY(mV));
1006  int iF = XMIPP_MIN(FLOOR(y_pos + loop_step), FINISHINGY(mV));
1007  int j0 = XMIPP_MAX(CEIL(x_pos - loop_step), STARTINGX(mV));
1008  int jF = XMIPP_MIN(FLOOR(x_pos + loop_step), FINISHINGX(mV));
1009  int k0 = XMIPP_MAX(CEIL(z_pos - loop_step), STARTINGZ(mV));
1010  int kF = XMIPP_MIN(FLOOR(z_pos + loop_step), FINISHINGZ(mV));
1011 
1012  double m = 1. / loop_step;
1013  for (int k = k0; k <= kF; k++)
1014  {
1015  double z_val = 1. - m * ABS(k - z_pos);
1016  for (int i = i0; i <= iF; i++)
1017  {
1018  double y_val = 1. - m * ABS(i - y_pos);
1019  for (int j = j0; j <= jF; j++)
1020  {
1021  double x_val = 1. - m * ABS(j - x_pos);
1022  A3D_ELEM(mP, k, i, j) += weight * x_val * y_val * z_val;
1023  }
1024  }
1025  }
1026 }
#define XMIPP_MAX(x, y)
Definition: xmipp_macros.h:193
#define FINISHINGX(v)
#define FINISHINGZ(v)
#define STARTINGX(v)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define STARTINGY(v)
#define A3D_ELEM(V, k, i, j)
#define FLOOR(x)
Definition: xmipp_macros.h:240
#define CEIL(x)
Definition: xmipp_macros.h:225
#define ABS(x)
Definition: xmipp_macros.h:142
#define XMIPP_MIN(x, y)
Definition: xmipp_macros.h:181
#define j
int m
#define FINISHINGY(v)
#define STARTINGZ(v)

◆ transformImageSph()

double ProgForwardZernikeSubtomos::transformImageSph ( double *  pclnm)

Definition at line 255 of file forward_zernike_subtomos.cpp.

256 {
257  const MultidimArray<double> &mV=V();
258  idx_z_clnm.clear();
259  z_clnm_diff.clear();
261  {
262  VEC_ELEM(clnm,i)=pclnm[i+1];
263  if (VEC_ELEM(clnm,i) != VEC_ELEM(prev_clnm,i))
264  {
265  idx_z_clnm.push_back(i);
266  z_clnm_diff.push_back(VEC_ELEM(clnm, i) - VEC_ELEM(prev_clnm, i));
267  // std::cout << i << std::endl;
268  }
269  }
270  double deformation=0.0;
271  totalDeformation=0.0;
272 
273  P().initZeros(Xdim,Xdim,Xdim);
274  P().setXmippOrigin();
275  double currentRot=old_rot + deltaRot;
276  double currentTilt=old_tilt + deltaTilt;
277  double currentPsi=old_psi + deltaPsi;
278  deformVol(P(), mV, deformation, currentRot, currentTilt, currentPsi);
279 
280  double cost=0.0;
281  const MultidimArray<int> &mMask3D=mask3D;
282 
283  if (old_flip)
284  {
285  MAT_ELEM(A, 0, 0) *= -1;
286  MAT_ELEM(A, 0, 1) *= -1;
287  MAT_ELEM(A, 0, 2) *= -1;
288  }
289 
290  // Image<double> save;
291  // save()=Ifiltered();
292  // save.write("PPPbefore.mrc");
293 
295  xmipp_transformation::IS_NOT_INV,xmipp_transformation::DONT_WRAP,0.);
296 
297  // Image<double> save;
298  // save()=P();
299  // save.write("PPPtheo.mrc");
300 
301  // save()=Ifilteredp();
302  // save.write("PPPexp.mrc");
303 
304  // std::cout << "Press any key" << std::endl;
305  // char c; std::cin >> c;
306 
309 
310  if (hasCTF)
311  {
312  double defocusU=old_defocusU+deltaDefocusU;
313  double defocusV=old_defocusV+deltaDefocusV;
314  double angle=old_defocusAngle+deltaDefocusAngle;
315  if (defocusU!=currentDefocusU || defocusV!=currentDefocusV || angle!=currentAngle) {
316  updateCTFImage(defocusU,defocusV,angle);
317  }
318  // FilterCTF1.ctf = ctf;
320  if (phaseFlipped)
323  }
324  // filter.applyMaskSpace(P());
325 
326 
327  const MultidimArray<double> &mP=P();
328  MultidimArray<double> &mIfilteredp=Ifilteredp();
329  double corr1=correlationIndex(mIfilteredp,mP,&mMask3D);
330 
331  cost=-corr1;
332 
333 #ifdef DEBUG
334  std::cout << "A=" << A << std::endl;
335  Image<double> save;
336  save()=P();
337  save.write("PPPtheo.xmp");
338  save()=Ifilteredp();
339  save.write("PPPfilteredp.xmp");
340  save()=Ifiltered();
341  save.write("PPPfiltered.xmp");
342  // Vdeformed.write("PPPVdeformed.vol");
343  std::cout << "Cost=" << cost << " deformation=" << deformation << std::endl;
344  std::cout << "Press any key" << std::endl;
345  char c; std::cin >> c;
346 #endif
347 
348  if (showOptimization)
349  {
350  std::cout << "A=" << A << std::endl;
351  Image<double> save;
352  save()=P();
353  save.write("PPPtheo.mrc");
354  save()=Ifilteredp();
355  save.write("PPPfilteredp.mrc");
356  save()=Ifiltered();
357  save.write("PPPfiltered.mrc");
358  Vdeformed.write("PPPVdeformed.vol");
359  std::cout << "Deformation=" << totalDeformation << std::endl;
360  std::cout << "Press any key" << std::endl;
361  char c; std::cin >> c;
362  }
363 
364  // double massDiff=std::abs(sumV-sumVd)/sumV;
365  prev_clnm = clnm;
366  double retval=cost+lambda*abs(deformation - prior_deformation);
367  if (showOptimization)
368  std::cout << cost << " " << deformation << " " << lambda*deformation << " " << sumV << " " << retval << std::endl;
369  return retval;
370 }
#define VEC_ELEM(v, i)
Definition: matrix1d.h:245
doublereal * c
void updateCTFImage(double defocusU, double defocusV, double angle)
void applyGeometry(int SplineDegree, MultidimArray< std::complex< double > > &V2, const MultidimArray< std::complex< double > > &V1, const Matrix2D< double > &A, bool inv, bool wrap, std::complex< double > outside, MultidimArray< double > *BcoeffsPtr)
void write(const FileName &name="", size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST, int _swapWrite=0)
double correlationIndex(const MultidimArray< T > &x, const MultidimArray< T > &y, const MultidimArray< int > *mask=NULL, MultidimArray< double > *Contributions=NULL)
void abs(Image< double > &op)
#define i
#define MAT_ELEM(m, i, j)
Definition: matrix2d.h:116
#define FOR_ALL_ELEMENTS_IN_MATRIX1D(v)
Definition: matrix1d.h:72
void deformVol(MultidimArray< double > &mVD, const MultidimArray< double > &mV, double &def, double rot, double tilt, double psi)
Deform a volumen using Zernike-Spherical harmonic basis.
void generateMask(MultidimArray< double > &v)
void applyMaskSpace(MultidimArray< double > &v)

◆ updateCTFImage()

void ProgForwardZernikeSubtomos::updateCTFImage ( double  defocusU,
double  defocusV,
double  angle 
)

Definition at line 696 of file forward_zernike_subtomos.cpp.

697 {
698  FilterCTF.ctf.K=1; // get pure CTF with no envelope
703 }
CTFDescription ctf
double DeltafV
Defocus in V (in Angstroms). Negative values are underfocused.
Definition: ctf.h:830
double DeltafU
Global gain. By default, 1.
Definition: ctf.h:828
double azimuthal_angle
Azimuthal angle (between X and U) in degrees.
Definition: ctf.h:832
double K
Global gain. By default, 1.
Definition: ctf.h:238
void produceSideInfo()
Produce Side information.
Definition: ctf.cpp:1392

◆ weightsInterpolation3D()

Matrix1D< double > ProgForwardZernikeSubtomos::weightsInterpolation3D ( double  x,
double  y,
double  z 
)

Definition at line 930 of file forward_zernike_subtomos.cpp.

930  {
932  w.initZeros(8);
933 
934  int x0 = FLOOR(x);
935  double fx0 = x - x0;
936  int x1 = x0 + 1;
937  double fx1 = x1 - x;
938 
939  int y0 = FLOOR(y);
940  double fy0 = y - y0;
941  int y1 = y0 + 1;
942  double fy1 = y1 - y;
943 
944  int z0 = FLOOR(z);
945  double fz0 = z - z0;
946  int z1 = z0 + 1;
947  double fz1 = z1 - z;
948 
949  VEC_ELEM(w,0) = fx1 * fy1 * fz1; // w000 (x0,y0,z0)
950  VEC_ELEM(w,1) = fx1 * fy1 * fz0; // w001 (x0,y0,z1)
951  VEC_ELEM(w,2) = fx1 * fy0 * fz1; // w010 (x0,y1,z0)
952  VEC_ELEM(w,3) = fx1 * fy0 * fz0; // w011 (x0,y1,z1)
953  VEC_ELEM(w,4) = fx0 * fy1 * fz1; // w100 (x1,y0,z0)
954  VEC_ELEM(w,5) = fx0 * fy1 * fz0; // w101 (x1,y0,z1)
955  VEC_ELEM(w,6) = fx0 * fy0 * fz1; // w110 (x1,y1,z0)
956  VEC_ELEM(w,7) = fx0 * fy0 * fz0; // w111 (x1,y1,z1)
957 
958  return w;
959 }
#define VEC_ELEM(v, i)
Definition: matrix1d.h:245
static double * y
doublereal * w
#define z0
doublereal * x
#define FLOOR(x)
Definition: xmipp_macros.h:240
#define y0
#define x0
double z
void initZeros()
Definition: matrix1d.h:592

◆ writeImageParameters()

void ProgForwardZernikeSubtomos::writeImageParameters ( MDRow row)
virtual

Write the parameters found for one image

Definition at line 596 of file forward_zernike_subtomos.cpp.

596  {
597  int pos = 3*vecSize;
598  if (flagEnabled==1) {
599  row.setValue(MDL_ENABLED, 1);
600  }
601  else {
602  row.setValue(MDL_ENABLED, -1);
603  }
604 
605  row.setValue(MDL_ANGLE_ROT, old_rot+p(pos+3));
606  row.setValue(MDL_ANGLE_TILT, old_tilt+p(pos+4));
607  row.setValue(MDL_ANGLE_PSI, old_psi+p(pos+5));
608  row.setValue(MDL_SHIFT_X, old_shiftX+p(pos));
609  row.setValue(MDL_SHIFT_Y, old_shiftY+p(pos+1));
610  row.setValue(MDL_SHIFT_Z, old_shiftZ+p(pos+2));
611 
613  std::vector<double> vectortemp;
614  size_t end_clnm = VEC_XSIZE(clnm)-9;
615  for (int j = 0; j < end_clnm; j++) {
616  vectortemp.push_back(clnm(j));
617  }
618  row.setValue(MDL_SPH_COEFFICIENTS, vectortemp);
619  // row.setValue(MDL_COST, correlation);
620 }
Rotation angle of an image (double,degrees)
#define VEC_XSIZE(m)
Definition: matrix1d.h:77
Tilting angle of an image (double,degrees)
Shift for the image in the X axis (double)
Special label to be used when gathering MDs in MpiMetadataPrograms.
Is this image enabled? (int [-1 or 1])
Deformation in voxels.
#define j
void setValue(MDLabel label, const T &d, bool addLabel=true)
Deformation coefficients.
Shift for the image in the Z axis (double)
Shift for the image in the Y axis (double)

Member Data Documentation

◆ A

Matrix2D<double> ProgForwardZernikeSubtomos::A

Definition at line 114 of file forward_zernike_subtomos.h.

◆ algn_params

int ProgForwardZernikeSubtomos::algn_params

Definition at line 85 of file forward_zernike_subtomos.h.

◆ blob

struct blobtype ProgForwardZernikeSubtomos::blob

Definition at line 145 of file forward_zernike_subtomos.h.

◆ blob_r

double ProgForwardZernikeSubtomos::blob_r

Definition at line 146 of file forward_zernike_subtomos.h.

◆ clnm

Matrix1D<double> ProgForwardZernikeSubtomos::clnm

Definition at line 132 of file forward_zernike_subtomos.h.

◆ correlation

double ProgForwardZernikeSubtomos::correlation

Definition at line 141 of file forward_zernike_subtomos.h.

◆ ctf_params

int ProgForwardZernikeSubtomos::ctf_params

Definition at line 87 of file forward_zernike_subtomos.h.

◆ currentAngle

double ProgForwardZernikeSubtomos::currentAngle

Definition at line 126 of file forward_zernike_subtomos.h.

◆ currentDefocusU

double ProgForwardZernikeSubtomos::currentDefocusU

Definition at line 126 of file forward_zernike_subtomos.h.

◆ currentDefocusV

double ProgForwardZernikeSubtomos::currentDefocusV

Definition at line 126 of file forward_zernike_subtomos.h.

◆ deltaDefocusAngle

double ProgForwardZernikeSubtomos::deltaDefocusAngle

Definition at line 124 of file forward_zernike_subtomos.h.

◆ deltaDefocusU

double ProgForwardZernikeSubtomos::deltaDefocusU

Definition at line 124 of file forward_zernike_subtomos.h.

◆ deltaDefocusV

double ProgForwardZernikeSubtomos::deltaDefocusV

Definition at line 124 of file forward_zernike_subtomos.h.

◆ deltaPsi

double ProgForwardZernikeSubtomos::deltaPsi

Definition at line 116 of file forward_zernike_subtomos.h.

◆ deltaRot

double ProgForwardZernikeSubtomos::deltaRot

Definition at line 116 of file forward_zernike_subtomos.h.

◆ deltaTilt

double ProgForwardZernikeSubtomos::deltaTilt

Definition at line 116 of file forward_zernike_subtomos.h.

◆ deltaX

double ProgForwardZernikeSubtomos::deltaX

Definition at line 118 of file forward_zernike_subtomos.h.

◆ deltaY

double ProgForwardZernikeSubtomos::deltaY

Definition at line 118 of file forward_zernike_subtomos.h.

◆ deltaZ

double ProgForwardZernikeSubtomos::deltaZ

Definition at line 118 of file forward_zernike_subtomos.h.

◆ df

MultidimArray<double> ProgForwardZernikeSubtomos::df

Definition at line 156 of file forward_zernike_subtomos.h.

◆ filter

FourierFilter ProgForwardZernikeSubtomos::filter

Definition at line 111 of file forward_zernike_subtomos.h.

◆ FilterCTF

FourierFilter ProgForwardZernikeSubtomos::FilterCTF

Definition at line 128 of file forward_zernike_subtomos.h.

◆ filterMW

FourierFilter ProgForwardZernikeSubtomos::filterMW

Definition at line 112 of file forward_zernike_subtomos.h.

◆ flagEnabled

int ProgForwardZernikeSubtomos::flagEnabled

Definition at line 89 of file forward_zernike_subtomos.h.

◆ fnImage

FileName ProgForwardZernikeSubtomos::fnImage

Definition at line 102 of file forward_zernike_subtomos.h.

◆ fnMaskR

FileName ProgForwardZernikeSubtomos::fnMaskR

Filename of the reference volume mask

Definition at line 49 of file forward_zernike_subtomos.h.

◆ fnOutDir

FileName ProgForwardZernikeSubtomos::fnOutDir

Output directory.

Definition at line 51 of file forward_zernike_subtomos.h.

◆ fnVolR

FileName ProgForwardZernikeSubtomos::fnVolR

Filename of the reference volume

Definition at line 47 of file forward_zernike_subtomos.h.

◆ gaussianProjectionTable

Matrix1D<double> ProgForwardZernikeSubtomos::gaussianProjectionTable

Definition at line 150 of file forward_zernike_subtomos.h.

◆ gaussianProjectionTable2

Matrix1D<double> ProgForwardZernikeSubtomos::gaussianProjectionTable2

Definition at line 153 of file forward_zernike_subtomos.h.

◆ hasCTF

bool ProgForwardZernikeSubtomos::hasCTF

Definition at line 122 of file forward_zernike_subtomos.h.

◆ I

Image<double> ProgForwardZernikeSubtomos::I

Definition at line 105 of file forward_zernike_subtomos.h.

◆ idx_z_clnm

std::vector<size_t> ProgForwardZernikeSubtomos::idx_z_clnm

Definition at line 157 of file forward_zernike_subtomos.h.

◆ Ifiltered

Image<double> ProgForwardZernikeSubtomos::Ifiltered

Definition at line 106 of file forward_zernike_subtomos.h.

◆ Ifilteredp

Image<double> ProgForwardZernikeSubtomos::Ifilteredp

Definition at line 107 of file forward_zernike_subtomos.h.

◆ ignoreCTF

bool ProgForwardZernikeSubtomos::ignoreCTF

Definition at line 73 of file forward_zernike_subtomos.h.

◆ L1

int ProgForwardZernikeSubtomos::L1

Degrees of Zernike polynomials and spherical harmonics

Definition at line 53 of file forward_zernike_subtomos.h.

◆ L2

int ProgForwardZernikeSubtomos::L2

Definition at line 53 of file forward_zernike_subtomos.h.

◆ lambda

double ProgForwardZernikeSubtomos::lambda

Definition at line 79 of file forward_zernike_subtomos.h.

◆ loop_step

int ProgForwardZernikeSubtomos::loop_step

Definition at line 143 of file forward_zernike_subtomos.h.

◆ mask3D

MultidimArray<int> ProgForwardZernikeSubtomos::mask3D

Definition at line 98 of file forward_zernike_subtomos.h.

◆ maxAngularChange

double ProgForwardZernikeSubtomos::maxAngularChange

Maximum angular change allowed

Definition at line 59 of file forward_zernike_subtomos.h.

◆ maxResol

double ProgForwardZernikeSubtomos::maxResol

Maximum frequency (A)

Definition at line 61 of file forward_zernike_subtomos.h.

◆ maxShift

double ProgForwardZernikeSubtomos::maxShift

Maximum shift allowed

Definition at line 57 of file forward_zernike_subtomos.h.

◆ num_images

int ProgForwardZernikeSubtomos::num_images

Definition at line 83 of file forward_zernike_subtomos.h.

◆ old_defocusAngle

double ProgForwardZernikeSubtomos::old_defocusAngle

Definition at line 124 of file forward_zernike_subtomos.h.

◆ old_defocusU

double ProgForwardZernikeSubtomos::old_defocusU

Definition at line 124 of file forward_zernike_subtomos.h.

◆ old_defocusV

double ProgForwardZernikeSubtomos::old_defocusV

Definition at line 124 of file forward_zernike_subtomos.h.

◆ old_flip

bool ProgForwardZernikeSubtomos::old_flip

Definition at line 120 of file forward_zernike_subtomos.h.

◆ old_psi

double ProgForwardZernikeSubtomos::old_psi

Definition at line 116 of file forward_zernike_subtomos.h.

◆ old_rot

double ProgForwardZernikeSubtomos::old_rot

Definition at line 116 of file forward_zernike_subtomos.h.

◆ old_shiftX

double ProgForwardZernikeSubtomos::old_shiftX

Definition at line 118 of file forward_zernike_subtomos.h.

◆ old_shiftY

double ProgForwardZernikeSubtomos::old_shiftY

Definition at line 118 of file forward_zernike_subtomos.h.

◆ old_shiftZ

double ProgForwardZernikeSubtomos::old_shiftZ

Definition at line 118 of file forward_zernike_subtomos.h.

◆ old_tilt

double ProgForwardZernikeSubtomos::old_tilt

Definition at line 116 of file forward_zernike_subtomos.h.

◆ optimizeAlignment

bool ProgForwardZernikeSubtomos::optimizeAlignment

Definition at line 67 of file forward_zernike_subtomos.h.

◆ optimizeDefocus

bool ProgForwardZernikeSubtomos::optimizeDefocus

Definition at line 71 of file forward_zernike_subtomos.h.

◆ optimizeDeformation

bool ProgForwardZernikeSubtomos::optimizeDeformation

Definition at line 69 of file forward_zernike_subtomos.h.

◆ optimizeRadius

bool ProgForwardZernikeSubtomos::optimizeRadius

Definition at line 75 of file forward_zernike_subtomos.h.

◆ p

Matrix1D<double> ProgForwardZernikeSubtomos::p

Definition at line 88 of file forward_zernike_subtomos.h.

◆ P

Image<double> ProgForwardZernikeSubtomos::P

Definition at line 109 of file forward_zernike_subtomos.h.

◆ phaseFlipped

bool ProgForwardZernikeSubtomos::phaseFlipped

Definition at line 77 of file forward_zernike_subtomos.h.

◆ prev_clnm

Matrix1D<double> ProgForwardZernikeSubtomos::prev_clnm

Definition at line 132 of file forward_zernike_subtomos.h.

◆ prior_deformation

double ProgForwardZernikeSubtomos::prior_deformation

Definition at line 136 of file forward_zernike_subtomos.h.

◆ R

Matrix2D<double> ProgForwardZernikeSubtomos::R

Definition at line 159 of file forward_zernike_subtomos.h.

◆ resume

bool ProgForwardZernikeSubtomos::resume

Resume computations

Definition at line 96 of file forward_zernike_subtomos.h.

◆ Rmax

int ProgForwardZernikeSubtomos::Rmax

Maximum radius

Definition at line 65 of file forward_zernike_subtomos.h.

◆ RmaxDef

int ProgForwardZernikeSubtomos::RmaxDef

Definition at line 81 of file forward_zernike_subtomos.h.

◆ showOptimization

bool ProgForwardZernikeSubtomos::showOptimization

Definition at line 139 of file forward_zernike_subtomos.h.

◆ sigma4

double ProgForwardZernikeSubtomos::sigma4

Definition at line 148 of file forward_zernike_subtomos.h.

◆ steps_cp

Matrix1D<double> ProgForwardZernikeSubtomos::steps_cp

Definition at line 134 of file forward_zernike_subtomos.h.

◆ sumV

int ProgForwardZernikeSubtomos::sumV

Definition at line 137 of file forward_zernike_subtomos.h.

◆ t1

double ProgForwardZernikeSubtomos::t1

Definition at line 92 of file forward_zernike_subtomos.h.

◆ t2

double ProgForwardZernikeSubtomos::t2

Definition at line 92 of file forward_zernike_subtomos.h.

◆ totalDeformation

double ProgForwardZernikeSubtomos::totalDeformation

Definition at line 136 of file forward_zernike_subtomos.h.

◆ Ts

double ProgForwardZernikeSubtomos::Ts

Sampling rate

Definition at line 63 of file forward_zernike_subtomos.h.

◆ useCTF

bool ProgForwardZernikeSubtomos::useCTF

Definition at line 90 of file forward_zernike_subtomos.h.

◆ V

Image<double> ProgForwardZernikeSubtomos::V

Definition at line 104 of file forward_zernike_subtomos.h.

◆ V_mask

MultidimArray<int> ProgForwardZernikeSubtomos::V_mask

Definition at line 98 of file forward_zernike_subtomos.h.

◆ Vdeformed

Image<double> ProgForwardZernikeSubtomos::Vdeformed

Definition at line 104 of file forward_zernike_subtomos.h.

◆ vecSize

int ProgForwardZernikeSubtomos::vecSize

Definition at line 130 of file forward_zernike_subtomos.h.

◆ vL1

Matrix1D<int> ProgForwardZernikeSubtomos::vL1

Zernike and SPH coefficients vectors

Definition at line 55 of file forward_zernike_subtomos.h.

◆ vL2

Matrix1D<int> ProgForwardZernikeSubtomos::vL2

Definition at line 55 of file forward_zernike_subtomos.h.

◆ vM

Matrix1D<int> ProgForwardZernikeSubtomos::vM

Definition at line 55 of file forward_zernike_subtomos.h.

◆ vN

Matrix1D<int> ProgForwardZernikeSubtomos::vN

Definition at line 55 of file forward_zernike_subtomos.h.

◆ vpos

MultidimArray<double> ProgForwardZernikeSubtomos::vpos

Definition at line 156 of file forward_zernike_subtomos.h.

◆ Xdim

size_t ProgForwardZernikeSubtomos::Xdim

Definition at line 100 of file forward_zernike_subtomos.h.

◆ z_clnm_diff

std::vector<double> ProgForwardZernikeSubtomos::z_clnm_diff

Definition at line 158 of file forward_zernike_subtomos.h.


The documentation for this class was generated from the following files: