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

Symmetrize Parameters. More...

#include <symmetrize.h>

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

Public Member Functions

void readParams ()
 
void defineParams ()
 
void show ()
 
void preProcess ()
 
void processImage (const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
 Process image or volume. More...
 
- 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 checkPoint ()
 For very long programs, it may be needed to write checkpoints. 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 fn_sym
 symmetry file More...
 
FileName fn_sym2
 
FileName fn_Maskin
 mask file (mask what is inside) More...
 
FileName fn_Maskout
 mask file (mask what is outside) More...
 
bool doMask
 set to true is we should mask More...
 
double rotHelical
 Helical rotation. More...
 
double rotPhaseHelical
 Helical phase. More...
 
double zHelical
 Helical shift. More...
 
double heightFraction
 Helical height fraction. More...
 
double Ts
 Sampling rate (used for helical) More...
 
bool do_not_generate_subgroup
 Do not generate subgroup. More...
 
bool wrap
 wrap or don't wrap input file during symmetrisation More...
 
bool sum
 Sum or average the result. More...
 
int splineOrder
 Spline order. More...
 
int Cn
 Cn for helical or helicalDihedral. More...
 
SymList SL
 
int symorder
 
bool helical
 
bool dihedral
 
bool helicalDihedral
 
- 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
 

Additional Inherited Members

- 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 finishProcessing ()
 
virtual void writeOutput ()
 
virtual void showProgress ()
 
virtual void defineLabelParam ()
 
- Protected Member Functions inherited from XmippProgram
void defineCommons ()
 
- 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

Symmetrize Parameters.

Definition at line 39 of file symmetrize.h.

Member Function Documentation

◆ defineParams()

void ProgSymmetrize::defineParams ( )
virtual

Define Parameters

Reimplemented from XmippMetadataProgram.

Reimplemented in BasicMpiMetadataProgram< ProgSymmetrize >.

Definition at line 63 of file symmetrize.cpp.

64 {
65  addUsageLine("Symmetrize volumes and images ");
68  addParamsLine(" --sym <symmetry> : For 2D images: a number");
69  addParamsLine(" : For 3D volumes: a symmetry file or point-group description");
70  addParamsLine(" : Valid point-group descriptions are:");
71  addParamsLine(" : C1, Ci, Cs, Cn (from here on n must be an integer number with no more than 2 digits)");
72  addParamsLine(" : Cnv, Cnh, Sn, Dn, Dnv, Dnh, T, Td, Th, O, Oh");
73  addParamsLine(" : I, I1, I2, I3, I4, I5, Ih, helical, dihedral, helicalDihedral");
74  addParamsLine(" :+ For a full description of symmetries look at");
75  addParamsLine(" :+ http://xmipp.cnb.csic.es/twiki/bin/view/Xmipp/Symmetry");
76  addParamsLine(" [--sym2 <sym2=C1>] : Only for helical, or helicalDihedral");
77  addParamsLine(" : You may use any other Cn symmetry");
78  addParamsLine(" [--helixParams <z> <rot> <rotPhase=0>]: Helical parameters z(Angstroms), rot(degrees), rotPhase(degrees)");
79  addParamsLine(" :+ V(r,theta,z)=V(r,theta+rotHelix+rotPhase,z+zHelix)");
80  addParamsLine(" [--heightFraction <f=0.95>]: Height fraction used for symmetrizing a helix");
81  addParamsLine(" [--sampling <T=1>] : Sampling rate (A/pixel). Used only for helical parameters");
82  addParamsLine(" [--no_group] : For 3D volumes: do not generate symmetry subgroup");
83  addParamsLine(" [--dont_wrap] : by default, the image/volume is wrapped");
84  addParamsLine(" [--sum] : compute the sum of the images/volumes instead of the average. This is useful for symmetrizing pieces");
85  addParamsLine(" [--mask_in <fileName>]: symmetrize only in the masked area");
86  addParamsLine(" [--spline <order=3>] : Spline order for the interpolation (valid values are 1 and 3)");
87  addExampleLine("Symmetrize a list of images with 6 fold symmetry",false);
88  addExampleLine(" xmipp_transform_symmetrize -i input.sel --sym 6");
89  addExampleLine("Symmetrize with i3 symmetry and the volume is not wrapped",false);
90  addExampleLine(" xmipp_transform_symmetrize -i input.vol --sym i3 --dont_wrap");
91 }
void addExampleLine(const char *example, bool verbatim=true)
bool each_image_produces_an_output
Indicate that an output is produced for each image in the input.
void addUsageLine(const char *line, bool verbatim=false)
void addParamsLine(const String &line)

◆ preProcess()

void ProgSymmetrize::preProcess ( )
virtual

Run

Reimplemented from XmippMetadataProgram.

Reimplemented in BasicMpiMetadataProgram< ProgSymmetrize >.

Definition at line 217 of file symmetrize.cpp.

218 {
219  if (!helical && !dihedral & !helicalDihedral)
220  {
221  if (!fn_sym.exists() && isdigit(fn_sym[0]))
223  else
224  {
225  double accuracy = do_not_generate_subgroup ? -1 : 1e-6;
226  SL.readSymmetryFile(fn_sym, accuracy);
227  symorder=-1;
228  }
229  }
230 }
SymList SL
Definition: symmetrize.h:87
int readSymmetryFile(FileName fn_sym, double accuracy=SYM_ACCURACY)
Definition: symmetries.cpp:33
bool helicalDihedral
Definition: symmetrize.h:95
FileName fn_sym
symmetry file
Definition: symmetrize.h:43
bool exists() const
int textToInteger(const char *str)
bool do_not_generate_subgroup
Do not generate subgroup.
Definition: symmetrize.h:61

◆ processImage()

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

Process image or volume.

Implements XmippMetadataProgram.

Definition at line 233 of file symmetrize.cpp.

234 {
235  Image<double> Iin;
236  Image<double> Iout;
237  Image<double> mask;
238  MultidimArray<double> *mmask=nullptr;
239 
240  Iin.readApplyGeo(fnImg, rowIn);
241  Iin().setXmippOrigin();
242  Iout().resize(Iin());
243 
244  if (doMask)
245  {
246  mask.read(fn_Maskin);
247  mmask=&(mask());
248  }
249 
250  if (ZSIZE(Iin())==1)
251  {
252  if (helical)
253  REPORT_ERROR(ERR_ARG_INCORRECT,"Helical symmetrization is not meant for images");
254  if (symorder!=-1)
255  symmetrizeImage(symorder,Iin(),Iout(),splineOrder,wrap,!wrap,sum,mmask);
256  else
257  REPORT_ERROR(ERR_ARG_MISSING,"The symmetry order is not valid for images");
258  }
259  else
260  {
261  if (SL.symsNo()>0 || helical || dihedral || helicalDihedral)
262  {
263  symmetrizeVolume(SL,Iin(),Iout(),splineOrder,wrap,!wrap,
265  }
266  else
267  REPORT_ERROR(ERR_ARG_MISSING,"The symmetry description is not valid for volumes");
268  }
269  Iout.write(fnImgOut);
270 }
SymList SL
Definition: symmetrize.h:87
Argument missing.
Definition: xmipp_error.h:114
bool wrap
wrap or don&#39;t wrap input file during symmetrisation
Definition: symmetrize.h:63
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
void symmetrizeVolume(const SymList &SL, const MultidimArray< double > &V_in, MultidimArray< double > &V_out, int spline, bool wrap, bool do_outside_avg, bool sum, bool helical, bool dihedral, bool helicalDihedral, double rotHelical, double rotPhaseHelical, double zHelical, double heightFraction, const MultidimArray< double > *mask, int Cn)
Definition: symmetrize.cpp:117
double zHelical
Helical shift.
Definition: symmetrize.h:55
double rotHelical
Helical rotation.
Definition: symmetrize.h:51
int splineOrder
Spline order.
Definition: symmetrize.h:67
double rotPhaseHelical
Helical phase.
Definition: symmetrize.h:53
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)
int symsNo() const
Definition: symmetries.h:268
int readApplyGeo(const FileName &name, const MDRow &row, const ApplyGeoParams &params=DefaultApplyGeoParams)
bool helicalDihedral
Definition: symmetrize.h:95
void symmetrizeImage(int symorder, const MultidimArray< double > &I_in, MultidimArray< double > &I_out, int spline, bool wrap, bool do_outside_avg, bool sum, const MultidimArray< double > *mask)
Definition: symmetrize.cpp:187
Incorrect argument received.
Definition: xmipp_error.h:113
bool sum
Sum or average the result.
Definition: symmetrize.h:65
double heightFraction
Helical height fraction.
Definition: symmetrize.h:57
#define ZSIZE(v)
int Cn
Cn for helical or helicalDihedral.
Definition: symmetrize.h:69
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
FileName fn_Maskin
mask file (mask what is inside)
Definition: symmetrize.h:45
bool doMask
set to true is we should mask
Definition: symmetrize.h:49

◆ readParams()

void ProgSymmetrize::readParams ( )
virtual

Read parameters from command line.

Reimplemented from XmippMetadataProgram.

Reimplemented in BasicMpiMetadataProgram< ProgSymmetrize >.

Definition at line 32 of file symmetrize.cpp.

33 {
35  fn_sym = getParam("--sym");
36  fn_sym2 = getParam("--sym2");
37  doMask = false;
38  if (checkParam("--mask_in"))
39  {
40  fn_Maskin = getParam("--mask_in");
41  doMask = true;
42  }
43  helical=(fn_sym=="helical");
44  dihedral=(fn_sym=="dihedral");
45  helicalDihedral=(fn_sym=="helicalDihedral");
46  if (helical || helicalDihedral)
47  {
48  Ts=getDoubleParam("--sampling");
49  zHelical=getDoubleParam("--helixParams",0)/Ts;
50  rotHelical=DEG2RAD(getDoubleParam("--helixParams",1));
51  rotPhaseHelical=DEG2RAD(getDoubleParam("--helixParams",2));
52 
53  Cn=std::stoi(fn_sym2.substr(1));
54  }
55  do_not_generate_subgroup = checkParam("--no_group");
56  wrap = !checkParam("--dont_wrap");
57  sum = checkParam("--sum");
58  heightFraction = getDoubleParam("--heightFraction");
59  splineOrder = getIntParam("--spline");
60 }
double getDoubleParam(const char *param, int arg=0)
bool wrap
wrap or don&#39;t wrap input file during symmetrisation
Definition: symmetrize.h:63
double Ts
Sampling rate (used for helical)
Definition: symmetrize.h:59
#define DEG2RAD(d)
Definition: xmipp_macros.h:312
double zHelical
Helical shift.
Definition: symmetrize.h:55
double rotHelical
Helical rotation.
Definition: symmetrize.h:51
int splineOrder
Spline order.
Definition: symmetrize.h:67
double rotPhaseHelical
Helical phase.
Definition: symmetrize.h:53
bool helicalDihedral
Definition: symmetrize.h:95
FileName fn_sym2
Definition: symmetrize.h:43
const char * getParam(const char *param, int arg=0)
bool sum
Sum or average the result.
Definition: symmetrize.h:65
double heightFraction
Helical height fraction.
Definition: symmetrize.h:57
FileName fn_sym
symmetry file
Definition: symmetrize.h:43
int Cn
Cn for helical or helicalDihedral.
Definition: symmetrize.h:69
bool checkParam(const char *param)
bool do_not_generate_subgroup
Do not generate subgroup.
Definition: symmetrize.h:61
FileName fn_Maskin
mask file (mask what is inside)
Definition: symmetrize.h:45
int getIntParam(const char *param, int arg=0)
bool doMask
set to true is we should mask
Definition: symmetrize.h:49

◆ show()

void ProgSymmetrize::show ( )

Show parameters

Definition at line 94 of file symmetrize.cpp.

95 {
96  if (verbose==0)
97  return;
99  std::cout
100  << "Symmetry: " << fn_sym << std::endl
101  << "No group: " << do_not_generate_subgroup << std::endl
102  << "Wrap: " << wrap << std::endl
103  << "Sum: " << sum << std::endl
104  << "Spline: " << splineOrder << std::endl;
105  if (doMask)
106  std::cout << "mask_in " << fn_Maskin << std::endl;
107  if (helical)
108  std::cout << "RotHelical: " << RAD2DEG(rotHelical) << std::endl
109  << "RotPhaseHelical: " << RAD2DEG(rotPhaseHelical) << std::endl
110  << "ZHelical: " << zHelical*Ts
111  << "Height fraction: " << heightFraction << std::endl;
112  if (helical || helicalDihedral)
113  std::cout << "Symmetry2: " << fn_sym2 << std::endl;
114 }
bool wrap
wrap or don&#39;t wrap input file during symmetrisation
Definition: symmetrize.h:63
double Ts
Sampling rate (used for helical)
Definition: symmetrize.h:59
double zHelical
Helical shift.
Definition: symmetrize.h:55
double rotHelical
Helical rotation.
Definition: symmetrize.h:51
int splineOrder
Spline order.
Definition: symmetrize.h:67
double rotPhaseHelical
Helical phase.
Definition: symmetrize.h:53
bool helicalDihedral
Definition: symmetrize.h:95
FileName fn_sym2
Definition: symmetrize.h:43
bool sum
Sum or average the result.
Definition: symmetrize.h:65
double heightFraction
Helical height fraction.
Definition: symmetrize.h:57
int verbose
Verbosity level.
FileName fn_sym
symmetry file
Definition: symmetrize.h:43
void show() const override
#define RAD2DEG(r)
Definition: xmipp_macros.h:320
bool do_not_generate_subgroup
Do not generate subgroup.
Definition: symmetrize.h:61
FileName fn_Maskin
mask file (mask what is inside)
Definition: symmetrize.h:45
bool doMask
set to true is we should mask
Definition: symmetrize.h:49

Member Data Documentation

◆ Cn

int ProgSymmetrize::Cn

Cn for helical or helicalDihedral.

Definition at line 69 of file symmetrize.h.

◆ dihedral

bool ProgSymmetrize::dihedral

Definition at line 93 of file symmetrize.h.

◆ do_not_generate_subgroup

bool ProgSymmetrize::do_not_generate_subgroup

Do not generate subgroup.

Definition at line 61 of file symmetrize.h.

◆ doMask

bool ProgSymmetrize::doMask

set to true is we should mask

Definition at line 49 of file symmetrize.h.

◆ fn_Maskin

FileName ProgSymmetrize::fn_Maskin

mask file (mask what is inside)

Definition at line 45 of file symmetrize.h.

◆ fn_Maskout

FileName ProgSymmetrize::fn_Maskout

mask file (mask what is outside)

Definition at line 47 of file symmetrize.h.

◆ fn_sym

FileName ProgSymmetrize::fn_sym

symmetry file

Definition at line 43 of file symmetrize.h.

◆ fn_sym2

FileName ProgSymmetrize::fn_sym2

Definition at line 43 of file symmetrize.h.

◆ heightFraction

double ProgSymmetrize::heightFraction

Helical height fraction.

Definition at line 57 of file symmetrize.h.

◆ helical

bool ProgSymmetrize::helical

Definition at line 91 of file symmetrize.h.

◆ helicalDihedral

bool ProgSymmetrize::helicalDihedral

Definition at line 95 of file symmetrize.h.

◆ rotHelical

double ProgSymmetrize::rotHelical

Helical rotation.

Definition at line 51 of file symmetrize.h.

◆ rotPhaseHelical

double ProgSymmetrize::rotPhaseHelical

Helical phase.

Definition at line 53 of file symmetrize.h.

◆ SL

SymList ProgSymmetrize::SL

Definition at line 87 of file symmetrize.h.

◆ splineOrder

int ProgSymmetrize::splineOrder

Spline order.

Definition at line 67 of file symmetrize.h.

◆ sum

bool ProgSymmetrize::sum

Sum or average the result.

Definition at line 65 of file symmetrize.h.

◆ symorder

int ProgSymmetrize::symorder

Definition at line 89 of file symmetrize.h.

◆ Ts

double ProgSymmetrize::Ts

Sampling rate (used for helical)

Definition at line 59 of file symmetrize.h.

◆ wrap

bool ProgSymmetrize::wrap

wrap or don't wrap input file during symmetrisation

Definition at line 63 of file symmetrize.h.

◆ zHelical

double ProgSymmetrize::zHelical

Helical shift.

Definition at line 55 of file symmetrize.h.


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