Xmipp  v3.23.11-Nereus
Protected Member Functions | Protected Attributes | List of all members
ProgVolumeStructureFactor Class Reference
Inheritance diagram for ProgVolumeStructureFactor:
Inheritance graph
[legend]
Collaboration diagram for ProgVolumeStructureFactor:
Collaboration graph
[legend]

Protected Member Functions

void defineParams ()
 
void readParams ()
 
void show ()
 
void run ()
 
- Protected Member Functions inherited from XmippProgram
void defineCommons ()
 

Protected Attributes

FileName fnVol
 
FileName fnStructure
 
double sampling
 
- 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
 

Additional Inherited Members

- 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)
 
virtual void initComments ()
 
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 show () 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 inherited from XmippProgram
bool doRun
 
bool runWithoutArgs
 
int verbose
 Verbosity level. More...
 
int debug
 

Detailed Description

Definition at line 31 of file volume_structure_factor.cpp.

Member Function Documentation

◆ defineParams()

void ProgVolumeStructureFactor::defineParams ( )
inlineprotectedvirtual

Function in which the param of each Program are defined.

Reimplemented from XmippProgram.

Definition at line 37 of file volume_structure_factor.cpp.

38  {
39  //Usage
40  addUsageLine("Calculate the structure factor and the Guinier plot of a volume");
41  //Parameters
42  addParamsLine("-i <volume> : Volume to analyze");
43  addParamsLine("[-o <structure=\"\">] : Metadata with the structure factor and the Guinier plot");
44  addParamsLine(" : If no name is given, then volume_structure.xmd");
45  addParamsLine("[--sampling <T=1>] : Sampling rate in Angstroms/pixel");
46  }
void addUsageLine(const char *line, bool verbatim=false)
void addParamsLine(const String &line)

◆ readParams()

void ProgVolumeStructureFactor::readParams ( )
inlineprotectedvirtual

Function in which each program will read parameters that it need. If some error occurs the usage will be printed out.

Reimplemented from XmippProgram.

Definition at line 48 of file volume_structure_factor.cpp.

49  {
50  fnVol=getParam("-i");
51  fnStructure=getParam("-o");
52  if (fnStructure=="")
53  fnStructure=fnVol.removeAllExtensions()+"_structure.xmd";
54  sampling=getDoubleParam("--sampling");
55  }
double getDoubleParam(const char *param, int arg=0)
FileName removeAllExtensions() const
const char * getParam(const char *param, int arg=0)

◆ run()

void ProgVolumeStructureFactor::run ( )
inlineprotectedvirtual

This function will be start running the program. it also should be implemented by derived classes.

Reimplemented from XmippProgram.

Definition at line 66 of file volume_structure_factor.cpp.

67  {
68  show();
69 
70  Image<double> V;
71  FourierTransformer transformer;
73  MultidimArray<double> VFourierMag, spectrum;
74 
75  V.read(fnVol);
76  transformer.FourierTransform(V(),VFourier,false);
77  FFT_magnitude(VFourier,VFourierMag);
78  getSpectrum(VFourierMag,spectrum,POWER_SPECTRUM);
79 
80  MetaDataVec MDout;
82  {
83  if (i==0 || A1D_ELEM(spectrum,i)==0)
84  continue;
85  size_t id=MDout.addObject();
86  double f;
87  FFT_IDX2DIGFREQ(i,XSIZE(V()),f);
88  if (f>0.5)
89  continue;
90  f/=sampling;
91  double fA=1/f;
92  double f2=f*f;
93 
94  MDout.setValue(MDL_RESOLUTION_FREQ,f,id);
95  MDout.setValue(MDL_RESOLUTION_FREQREAL,fA,id);
96  MDout.setValue(MDL_RESOLUTION_FREQ2,f2,id);
98  double aux=0;
99  if (A1D_ELEM(spectrum,i)>0)
100  aux=log(A1D_ELEM(spectrum,i));
102  }
103  MDout.write(fnStructure);
104  }
Logarithm of the structure factor.
#define A1D_ELEM(v, i)
void write(const FileName &outFile, WriteModeMetaData mode=MD_OVERWRITE) const
#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY1D(v)
#define i
void getSpectrum(MultidimArray< double > &Min, MultidimArray< double > &spectrum, int spectrum_type)
Definition: xmipp_fftw.cpp:752
void log(Image< double > &op)
Frequency in 1/A squared (double)
bool setValue(const MDObject &mdValueIn, size_t id)
size_t addObject() override
Frequency in A (double)
double * f
#define XSIZE(v)
void FourierTransform(T &v, T1 &V, bool getCopy=true)
Definition: xmipp_fftw.h:166
__device__ float FFT_IDX2DIGFREQ(int idx, int size)
Frequency in 1/A (double)
#define POWER_SPECTRUM
Definition: xmipp_fftw.h:668
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
void FFT_magnitude(const MultidimArray< std::complex< double > > &v, MultidimArray< double > &mag)
Definition: xmipp_fftw.cpp:393

◆ show()

void ProgVolumeStructureFactor::show ( )
inlineprotected

Definition at line 57 of file volume_structure_factor.cpp.

58  {
59  std::cout
60  << "Input volume: " << fnVol << std::endl
61  << "Output structure: " << fnStructure << std::endl
62  << "Sampling: " << sampling << std::endl
63  ;
64  }

Member Data Documentation

◆ fnStructure

FileName ProgVolumeStructureFactor::fnStructure
protected

Definition at line 34 of file volume_structure_factor.cpp.

◆ fnVol

FileName ProgVolumeStructureFactor::fnVol
protected

Definition at line 34 of file volume_structure_factor.cpp.

◆ sampling

double ProgVolumeStructureFactor::sampling
protected

Definition at line 35 of file volume_structure_factor.cpp.


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