39 addUsageLine(
"Compute the deformation that properly fits two volumes using spherical harmonics");
42 addParamsLine(
" [-o <image=\"\">] : Output correlation image");
43 addParamsLine(
" [--degstep <d=5.0>] : Degrees step size for rot and tilt angles");
44 addParamsLine(
" [--thr <N=-1>] : Maximal number of the processing CPU threads");
45 addExampleLine(
"xmipp_compare_density -v1 vol1.vol -v2 vol2.vol -o corr_img.xmp");
60 V1().setXmippOrigin();
62 V2().setXmippOrigin();
69 tilt_v.resize(size_tlt + 1);
70 rot_v.resize(size_rot + 1);
71 CorrImg().initZeros(size_rot + 1, size_tlt + 1);
81 m_threadPool.
resize(threads);
89 <<
"First volume: " <<
fnVol1 << std::endl
90 <<
"Second volume: " <<
fnVol2 << std::endl
91 <<
"Output image: " <<
fnImgOut << std::endl
92 <<
"Degree step: " <<
degstep << std::endl
105 int size_x =
XSIZE(mV1);
106 int size_y =
YSIZE(mV1);
132 double sum_cmp = mP1.sum();
135 else if (sum_cmp < 0.0)
152 auto futures = std::vector<std::future<void>>();
153 futures.reserve(
V1().zdim);
155 auto routine = [
this](
int thrId,
int i) {
161 futures.emplace_back(m_threadPool.
push(routine,
i));
164 for (
auto &
f : futures) {
void defineParams()
Define params.
double getDoubleParam(const char *param, int arg=0)
std::vector< double > tilt_v
Rot and tilt vectors.
double OtsuSegmentation(MultidimArray< double > &V)
auto push(F &&f, Rest &&... rest) -> std::future< decltype(f(0, rest...))>
#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)
static unsigned findCores()
void resize(int nThreads)
FileName fnImgOut
Output corelation image.
void readParams()
Read arguments from command line.
double degstep
Degree step.
const char * getParam(const char *param, int arg=0)
void compare(Image< double > &op1, const Image< double > &op2)
Compare binary images.
Image< double > V1
Images.
#define FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY(v)
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)
int verbose
Verbosity level.
void keepBiggestComponent(MultidimArray< double > &I, double percentage, int neighbourhood)
std::vector< double > rot_v
void computeCorrImage(int i)
Compute corr image.
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
void addUsageLine(const char *line, bool verbatim=false)
int getIntParam(const char *param, int arg=0)
FileName fnVol1
Volumes to compare.
void addParamsLine(const String &line)
void applyMaskSpace(MultidimArray< double > &v)