93 <<
"Reference volume:\t" <<
fnVolR << std::endl
94 <<
"Mask of the region to keep:\t" <<
fnMask << std::endl
95 <<
"Sigma of low pass filter:\t" <<
sigma << std::endl
96 <<
"Sampling rate:\t" <<
sampling << std::endl
97 <<
"Padding factor:\t" <<
padFourier << std::endl
98 <<
"Max. Resolution:\t" <<
maxResol << std::endl
99 <<
"Limit frequency:\t" <<
limitfreq << std::endl
100 <<
"Output particles:\t" <<
fnOut << std::endl;
107 addUsageLine(
"This program computes the subtraction between particles and a reference");
108 addUsageLine(
" volume, by computing its projections with the same angles that input particles have.");
109 addUsageLine(
" Then, each particle and the correspondent projection of the reference volume are numerically");
110 addUsageLine(
" adjusted and subtracted using a mask which denotes the region to keep or subtract.");
113 addParamsLine(
"--ref <volume>\t: Reference volume to subtract");
114 addParamsLine(
"[--mask <mask=\"\">]\t: 3D mask for region to keep, no mask implies subtraction of whole images");
115 addParamsLine(
"[--sampling <sampling=1>]\t: Sampling rate (A/pixel)");
116 addParamsLine(
"[--max_resolution <f=4>]\t: Maximum resolution (A)");
117 addParamsLine(
"[--fmask_width <w=40>]\t: Extra width of final mask (A). -1 means no masking.");
118 addParamsLine(
"[--padding <p=2>]\t: Padding factor for Fourier projector");
119 addParamsLine(
"[--sigma <s=2>]\t: Decay of the filter (sigma) to smooth the mask transition");
120 addParamsLine(
"[--limit_freq <l=0>]\t: Limit frequency (= 1) or not (= 0) in adjustment process");
121 addParamsLine(
"[--nonNegative]\t: Ignore particles with negative beta0 or R2");
122 addParamsLine(
"[--boost]\t: Perform a boosting of original particles");
123 addParamsLine(
"[--cirmaskrad <c=-1.0>]\t: Radius of the circular mask");
124 addParamsLine(
"[--save <structure=\"\">]\t: Path for saving intermediate files");
125 addParamsLine(
"[--subtract]\t: The mask contains the region to SUBTRACT");
127 addExampleLine(
"xmipp_subtract_projection -i input_particles.xmd --ref input_map.mrc --mask mask_vol.mrc " 128 "-o output_particles --sampling 1 --fmask_width 40 --max_resolution 4");
134 I().setXmippOrigin();
160 m().setXmippOrigin();
231 ImgiM().initZeros(Img);
232 ImgiM().setXmippOrigin();
249 sumE2 += ereal*ereal + eimag*eimag;
250 sumY += realyn + imagyn;
251 sumY2 += realyn*realyn + imagyn*imagyn;
265 double R21adj = 1.0 - (1.0 - R21) * (N - 1.0) / (N - 2.0);
268 if (R21adj > R20adj) {
269 PFourierf = PFourierf1;
274 PFourierf = PFourierf0;
285 V().setXmippOrigin();
293 cirmask().initZeros((
int)Ydim, (
int)Xdim);
301 I().initZeros((
int)Ydim, (
int)Xdim);
333 std::cout <<
"-------Initializing projectors-------" << std::endl;
336 std::cout <<
"-------Projectors initialized-------" << std::endl;
350 const auto sizeI = (int)
XSIZE(
I());
391 DIRECT_MULTIDIM_ELEM(den0,win) += realPiMFourier*realPiMFourier + imagPiMFourier*imagPiMFourier;
392 A1(0,0) += realPiMFourier*realPiMFourier + imagPiMFourier*imagPiMFourier;
393 A1(0,1) += win*(realPiMFourier + imagPiMFourier);
402 double beta00 = num0.
sum()/den0.
sum();
419 double beta01 = betas1(0);
420 double beta1 = betas1(1);
455 else if (R2adj(1) == 1)
void readParams() override
Read argument from command line.
FourierProjector * projectorMask
MultidimArray< std::complex< double > > PiMFourier
MultidimArray< std::complex< double > > IiMFourier
Image< double > binarizeMask(Projection &) const
double getDoubleParam(const char *param, int arg=0)
MultidimArray< std::complex< double > > PFourier1
FourierTransformer transformerI
FourierTransformer transformerP
void show() const override
Show.
void writeParticle(MDRow &rowOut, FileName, Image< double > &, double, double, double)
Matrix1D< double > checkBestModel(MultidimArray< std::complex< double > > &, const MultidimArray< std::complex< double > > &, const MultidimArray< std::complex< double > > &, const MultidimArray< std::complex< double > > &) const
void sqrt(Image< double > &op)
double evaluateFitting(const MultidimArray< std::complex< double > > &, const MultidimArray< std::complex< double > > &) const
#define DIRECT_A2D_ELEM(v, i, j)
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)
Matrix1D< double > roffset
MultidimArray< std::complex< double > > ImgiMFourier
#define DIGFREQ2FFT_IDX(freq, size, idx)
FourierProjector * projector
MultidimArray< std::complex< double > > computeEstimationImage(const MultidimArray< double > &, const MultidimArray< double > &, FourierTransformer &)
FourierTransformer transformerIiM
void window(MultidimArray< T1 > &result, int n0, int z0, int y0, int x0, int nF, int zF, int yF, int xF, T1 init_value=0) const
const char * getParam(const char *param, int arg=0)
struct Angles part_angles
void computeDoubleMinMax(double &minval, double &maxval) const
#define FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY(v)
double Tm
Sampling rate (A/pixel)
void preProcess() override
Image< double > applyCTF(const MDRow &, Projection &)
#define DIRECT_MULTIDIM_ELEM(v, n)
void addExampleLine(const char *example, bool verbatim=true)
void projectVolume(FourierProjector &projector, Projection &P, int Ydim, int Xdim, double rot, double tilt, double psi, const MultidimArray< double > *ctf)
void readFromMdRow(const MDRow &row, bool disable_if_not_K=true)
int verbose
Verbosity level.
void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut) override
~ProgSubtractProjection()
Destructor.
void solveLinearSystem(PseudoInverseHelper &h, Matrix1D< double > &result)
__device__ float FFT_IDX2DIGFREQ(int idx, int size)
void createMask(const FileName &, Image< double > &, Image< double > &)
Processing methods.
const T & getValueOrDefault(MDLabel label, const T &def) const
void setValue(MDLabel label, const T &d, bool addLabel=true)
const MultidimArray< double > * ctfImage
void readParticle(const MDRow &rowIn)
Read and write methods.
virtual bool containsLabel(MDLabel label) const =0
void postProcess() override
ProgSubtractProjection()
Empty constructor.
void produceSideInfo()
Produce Side information.
void processParticle(const MDRow &rowIn, int, FourierTransformer &, FourierTransformer &)
MultidimArray< std::complex< double > > PFourier
String formatString(const char *format,...)
bool checkParam(const char *param)
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
void defineParams() override
Define parameters.
void addUsageLine(const char *line, bool verbatim=false)
void initZeros(const MultidimArray< T1 > &op)
FourierTransformer transformerPiM
bool enable_CTFnoise
Enable CTFnoise part.
void RaisedCosineMask(MultidimArray< double > &mask, double r1, double r2, int mode, double x0, double y0, double z0)
int getIntParam(const char *param, int arg=0)
void generateMask(MultidimArray< double > &v)
Image< double > invertMask(const Image< double > &)
MultidimArray< std::complex< double > > IFourier
void addParamsLine(const String &line)
MultidimArray< std::complex< double > > PFourier0
void applyMaskSpace(MultidimArray< double > &v)
void getDimensions(size_t &Xdim, size_t &Ydim, size_t &Zdim, size_t &Ndim) const