/** * \file envelope_penetration.cpp * \brief functions for calculation envelope penetration * * Copyright 2007-2013 IMP Inventors. All rights reserved. * */ #include #include IMPEM_BEGIN_NAMESPACE long get_number_of_particles_outside_of_the_density(DensityMap *dmap, const Particles &ps,const IMP::algebra::Transformation3D &t,float thr) { IMP_LOG_VERBOSE("start calculating the how many particles out of " <is_part_of_volume(vec)) { IMP_LOG_VERBOSE("position: "<get_value(vec)get_value(vec)<< " with is lower than required"<get_header()))); dmap_ind->reset_data(); emreal* data = dmap->get_data(); emreal* new_data = dmap_ind->get_data(); IMP_LOG_VERBOSE("START get_percentage_of_voxels_covered_by_particles" << std::endl); int iminx, iminy, iminz, imaxx, imaxy, imaxz,ivoxz,ivoxy,ivoxx,znxny,ivox; int nxny=dmap->get_header()->get_nx()*dmap->get_header()->get_ny(); int nx=dmap->get_header()->get_nx(); core::XYZs xyz = core::XYZs(ps); for (unsigned int i = 0; i < ps.size(); ++i) { IMP::algebra::Vector3D vec = t.get_transformed(xyz[i].get_coordinates()); calc_local_bounding_box( dmap, vec[0],vec[1],vec[2], smoothing_radius*2, iminx, iminy, iminz, imaxx, imaxy, imaxz); for (ivoxz=iminz;ivoxz<=imaxz;ivoxz++) { znxny=ivoxz * nxny; for (ivoxy=iminy;ivoxy<=imaxy;ivoxy++) { // we increment ivox this way to avoid unneceessary multiplication // operations. ivox = znxny + ivoxy * nx + iminx; for (ivoxx=iminx;ivoxx<=imaxx;ivoxx++) { if (data[ivox]get_number_of_voxels();ii++) { if (data[ii]>=thr) ++voxs_t; } return get_sum(dmap_ind)/voxs_t; } IMPEM_END_NAMESPACE