Xmipp  v3.23.11-Nereus
Public Member Functions | List of all members
MpiProgSubtractProjection Class Reference

#include <mpi_subtract_projection.h>

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

Public Member Functions

void defineParams () override
 
void readParams () override
 
void read (int argc, char **argv, bool reportErrors=true) override
 
void preProcess () override
 
void startProcessing () override
 
void showProgress () override
 
bool getImageToProcess (size_t &objId, size_t &objIndex) override
 
void finishProcessing () override
 
void wait () override
 Wait for the distributor to finish. More...
 
- Public Member Functions inherited from ProgSubtractProjection
void readParticle (const MDRow &rowIn)
 Read and write methods. More...
 
void writeParticle (MDRow &rowOut, FileName, Image< double > &, double, double, double)
 
void createMask (const FileName &, Image< double > &, Image< double > &)
 Processing methods. More...
 
Image< double > binarizeMask (Projection &) const
 
Image< double > invertMask (const Image< double > &)
 
Image< double > applyCTF (const MDRow &, Projection &)
 
void processParticle (const MDRow &rowIn, int, FourierTransformer &, FourierTransformer &)
 
MultidimArray< std::complex< double > > computeEstimationImage (const MultidimArray< double > &, const MultidimArray< double > &, FourierTransformer &)
 
double evaluateFitting (const MultidimArray< std::complex< double > > &, const MultidimArray< std::complex< double > > &) const
 
Matrix1D< double > checkBestModel (MultidimArray< std::complex< double > > &, const MultidimArray< std::complex< double > > &, const MultidimArray< std::complex< double > > &, const MultidimArray< std::complex< double > > &) const
 
 ProgSubtractProjection ()
 Empty constructor. More...
 
 ~ProgSubtractProjection ()
 Destructor. More...
 
void readParams () override
 Read argument from command line. More...
 
void show () const override
 Show. More...
 
void defineParams () override
 Define parameters. More...
 
void preProcess () override
 
void processImage (const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut) override
 
void postProcess () override
 
- 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 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
 
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)
 
void read (const String &argumentsLine)
 
 XmippProgram ()
 
 XmippProgram (int argc, const char **argv)
 
virtual ~XmippProgram ()
 
- Public Member Functions inherited from MpiMetadataProgram
 MpiMetadataProgram ()
 
 MpiMetadataProgram (const MpiMetadataProgram &)=delete
 
 MpiMetadataProgram (const MpiMetadataProgram &&)=delete
 
 ~MpiMetadataProgram ()
 
MpiMetadataProgramoperator= (const MpiMetadataProgram &)=delete
 
MpiMetadataProgramoperator= (const MpiMetadataProgram &&)=delete
 
void read (int argc, char **argv)
 
void defineParams ()
 
void readParams ()
 
void createTaskDistributor (MetaData &mdIn, size_t blockSize=0)
 
bool getTaskToProcess (size_t &objId, size_t &objIndex)
 
- Public Member Functions inherited from XmippMpiProgram
void read (int argc, char **argv)
 
virtual int tryRun ()
 

Additional Inherited Members

- Public Attributes inherited from ProgSubtractProjection
FileName fnVolR
 
FileName fnParticles
 
FileName fnImgI
 
FileName fnOut
 
FileName fnMaskVol
 
FileName fnMask
 
FileName fnProj
 
double sampling
 
double padFourier
 
double maxResol
 
double cirmaskrad
 
int sigma
 
int limitfreq
 
int maxwiIdx
 
bool nonNegative
 
bool boost
 
bool subtract
 
MultidimArray< int > wi
 
Image< double > V
 
Image< double > vM
 
Image< double > ivM
 
Image< double > M
 
Image< double > I
 
Image< double > Pctf
 
Image< double > iM
 
Image< double > Mfinal
 
Image< double > Idiff
 
Image< double > cirmask
 
Projection P
 
Projection Pmask
 
Projection PmaskVol
 
FourierFilter FilterG
 
const MultidimArray< double > * ctfImage = nullptr
 
FourierTransformer transformerP
 
FourierTransformer transformerI
 
MultidimArray< std::complex< double > > IFourier
 
MultidimArray< std::complex< double > > PFourier
 
MultidimArray< std::complex< double > > PFourier0
 
MultidimArray< std::complex< double > > PFourier1
 
MultidimArray< std::complex< double > > IiMFourier
 
MultidimArray< std::complex< double > > PiMFourier
 
FourierTransformer transformerIiM
 
FourierTransformer transformerPiM
 
CTFDescription ctf
 
FourierFilter FilterCTF
 
Image< double > padp
 
Image< double > PmaskI
 
Image< double > ImgiM
 
MultidimArray< std::complex< double > > ImgiMFourier
 
MetaDataVec mdParticles
 
MDRowVec row
 
Matrix1D< double > roffset
 
struct Angles part_angles
 
bool disable
 
int rank
 
FourierProjectorprojector
 
FourierProjectorprojectorMask
 
- 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 inherited from XmippMetadataProgram
virtual void initComments ()
 
void show () const override
 
virtual void writeOutput ()
 
virtual void defineLabelParam ()
 
- Protected Member Functions inherited from XmippProgram
void defineCommons ()
 
- Protected Member Functions inherited from XmippMpiProgram
void setNode (const std::shared_ptr< MpiNode > &node)
 
- 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
 
- Protected Attributes inherited from MpiMetadataProgram
int blockSize
 
std::vector< size_t > imgsId
 
MpiTaskDistributordistributor =nullptr
 
size_t first
 
size_t last
 
- Protected Attributes inherited from XmippMpiProgram
std::shared_ptr< MpiNodenode
 
size_t nProcs
 
size_t numberOfJobs
 
MPI_Status status
 

Detailed Description

Definition at line 31 of file mpi_subtract_projection.h.

Member Function Documentation

◆ defineParams()

void MpiProgSubtractProjection::defineParams ( )
overridevirtual

Function in which the param of each Program are defined.

Reimplemented from XmippMetadataProgram.

Definition at line 28 of file mpi_subtract_projection.cpp.

29 {
32 }
void defineParams() override
Define parameters.

◆ finishProcessing()

void MpiProgSubtractProjection::finishProcessing ( )
overridevirtual

finishProcessing

Reimplemented from MpiMetadataProgram.

Definition at line 116 of file mpi_subtract_projection.cpp.

117 {
118  node->gatherMetadatas(getOutputMd(), fn_out);
119  MetaDataVec MDaux;
120  MDaux.sort(getOutputMd(), MDL_GATHER_ID);
121  MDaux.removeLabel(MDL_GATHER_ID);
122  getOutputMd() = MDaux;
123  if (node->isMaster())
125 }
void sort(const MetaDataVec &MDin, const MDLabel sortLabel, bool asc=true, int limit=-1, int offset=0)
bool removeLabel(const MDLabel label) override
std::shared_ptr< MpiNode > node
Definition: xmipp_mpi.h:164

◆ getImageToProcess()

bool MpiProgSubtractProjection::getImageToProcess ( size_t &  objId,
size_t &  objIndex 
)
inlineoverridevirtual

Reimplemented from XmippMetadataProgram.

Definition at line 41 of file mpi_subtract_projection.h.

42  {
43  return getTaskToProcess(objId, objIndex);
44  }
bool getTaskToProcess(size_t &objId, size_t &objIndex)
Definition: xmipp_mpi.cpp:316

◆ preProcess()

void MpiProgSubtractProjection::preProcess ( )
overridevirtual

Preprocess

Reimplemented from MpiMetadataProgram.

Definition at line 42 of file mpi_subtract_projection.cpp.

43 {
44  rank = (int)node->rank;
46  // Get the volume padded size from rank 0
47  int realSize;
48  int origin;
49  int realSizeMask;
50  int originMask;
51  if (node->rank == 0)
52  {
53  realSize = (int)XSIZE(projector->VfourierRealCoefs);
55  realSizeMask = (int)XSIZE(projectorMask->VfourierRealCoefs);
57  }
58 
59  MPI_Bcast(&realSize, 1, MPI_INT, 0, MPI_COMM_WORLD);
60  MPI_Bcast(&origin, 1, MPI_INT, 0, MPI_COMM_WORLD);
61  MPI_Bcast(&(projector->volumePaddedSize), 1, MPI_INT, 0, MPI_COMM_WORLD);
62  MPI_Bcast(&projector->volumeSize, 1, MPI_INT, 0, MPI_COMM_WORLD);
63 
64  MPI_Bcast(&realSizeMask, 1, MPI_INT, 0, MPI_COMM_WORLD);
65  MPI_Bcast(&originMask, 1, MPI_INT, 0, MPI_COMM_WORLD);
66  MPI_Bcast(&(projectorMask->volumePaddedSize), 1, MPI_INT, 0, MPI_COMM_WORLD);
67  MPI_Bcast(&projectorMask->volumeSize, 1, MPI_INT, 0, MPI_COMM_WORLD);
68 
69  if (rank != 0)
70  {
71  projector->VfourierRealCoefs.resizeNoCopy(realSize,realSize,realSize);
72  projector->VfourierImagCoefs.resizeNoCopy(realSize,realSize,realSize);
75 
76  projectorMask->VfourierRealCoefs.resizeNoCopy(realSizeMask,realSizeMask,realSizeMask);
77  projectorMask->VfourierImagCoefs.resizeNoCopy(realSizeMask,realSizeMask,realSizeMask);
80  }
81 
82  MPI_Bcast(MULTIDIM_ARRAY(projector->VfourierRealCoefs), (int)MULTIDIM_SIZE(projector->VfourierRealCoefs), MPI_DOUBLE, 0, MPI_COMM_WORLD);
83  MPI_Bcast(MULTIDIM_ARRAY(projector->VfourierImagCoefs), (int)MULTIDIM_SIZE(projector->VfourierImagCoefs), MPI_DOUBLE, 0, MPI_COMM_WORLD);
84  MPI_Bcast(MULTIDIM_ARRAY(projectorMask->VfourierRealCoefs), (int)MULTIDIM_SIZE(projectorMask->VfourierRealCoefs), MPI_DOUBLE, 0, MPI_COMM_WORLD);
85  MPI_Bcast(MULTIDIM_ARRAY(projectorMask->VfourierImagCoefs), (int)MULTIDIM_SIZE(projectorMask->VfourierImagCoefs), MPI_DOUBLE, 0, MPI_COMM_WORLD);
86 
87  if (rank != 0)
88  {
91  }
92 
93  MetaData &mdIn = *getInputMd();
94  mdIn.addLabel(MDL_GATHER_ID);
95  mdIn.fillLinear(MDL_GATHER_ID, 1, 1);
97 }
FourierProjector * projectorMask
#define MULTIDIM_SIZE(v)
void resizeNoCopy(const MultidimArray< T1 > &v)
#define MULTIDIM_ARRAY(v)
FourierProjector * projector
#define STARTINGX(v)
void produceSideInfoProjection()
Prepare projection space.
#define STARTINGY(v)
MultidimArray< double > VfourierRealCoefs
void createTaskDistributor(MetaData &mdIn, size_t blockSize=0)
Definition: xmipp_mpi.cpp:302
MultidimArray< double > VfourierImagCoefs
#define XSIZE(v)
std::shared_ptr< MpiNode > node
Definition: xmipp_mpi.h:164
virtual bool addLabel(const MDLabel label, int pos=-1)=0
virtual void fillLinear(MDLabel label, double initial, double step)=0
#define STARTINGZ(v)

◆ read()

void MpiProgSubtractProjection::read ( int  argc,
char **  argv,
bool  reportErrors = true 
)
overridevirtual

Read the command line arguments A convenience wrapper

Reimplemented from XmippProgram.

Definition at line 38 of file mpi_subtract_projection.cpp.

39 {
41 }
int argc
Original command line arguments.
Definition: xmipp_program.h:86
void read(int argc, char **argv)
Definition: xmipp_mpi.cpp:284
const char ** argv
Definition: xmipp_program.h:87

◆ readParams()

void MpiProgSubtractProjection::readParams ( )
overridevirtual

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

Reimplemented from XmippMetadataProgram.

Definition at line 33 of file mpi_subtract_projection.cpp.

34 {
37 }
void readParams() override
Read argument from command line.

◆ showProgress()

void MpiProgSubtractProjection::showProgress ( )
overridevirtual

Reimplemented from XmippMetadataProgram.

Definition at line 107 of file mpi_subtract_projection.cpp.

108 {
109  if (node->rank == 1)
110  {
111  time_bar_done = first + 1;
113  }
114 }
std::shared_ptr< MpiNode > node
Definition: xmipp_mpi.h:164

◆ startProcessing()

void MpiProgSubtractProjection::startProcessing ( )
overridevirtual

Do some stuff before starting processing in a parallel environment usually this only be executed by master.

Reimplemented from XmippMetadataProgram.

Definition at line 98 of file mpi_subtract_projection.cpp.

99 {
100  if (node->rank == 1)
101  {
102  verbose = 1;
104  }
105  node->barrierWait();
106 }
std::shared_ptr< MpiNode > node
Definition: xmipp_mpi.h:164
int verbose
Verbosity level.

◆ wait()

void MpiProgSubtractProjection::wait ( )
overridevirtual

Wait for the distributor to finish.

Reimplemented from XmippMetadataProgram.

Definition at line 126 of file mpi_subtract_projection.cpp.

127 {
128  distributor->wait();
129 }
MpiTaskDistributor * distributor
Definition: xmipp_mpi.h:190

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