/** * \file masking.cpp * \brief masking tools * * Copyright 2007-2013 IMP Inventors. All rights reserved. * */ #include #include #include IMPEM_BEGIN_NAMESPACE RadiusDependentDistanceMask::RadiusDependentDistanceMask( float sampling_radius, const DensityHeader &header) { KernelParameters kernel_params(header.get_resolution()); const RadiusDependentKernelParameters &rad_params = kernel_params.set_params(sampling_radius); int delta=static_cast( std::floor(sampling_radius/header.get_spacing())); for (int x = -delta; x <= delta; x++) { for (int y = -delta; y <= delta; y++) { for (int z = -delta; z <= delta; z++) { if (x == 0 && y == 0 && z == 0) continue; neighbor_shift_.push_back( z * header.get_nx() * header.get_ny() + y * header.get_nx() + x); double rsq=header.get_spacing()*header.get_spacing()*(x*x+y*y+z*z); neighbor_dist_.push_back(rsq); neighbor_dist_exp_.push_back(EXP(-rsq * rad_params.get_inv_sigsq())); } } } } const RadiusDependentDistanceMask* DistanceMask::set_mask( float sampling_radius){ IMP_USAGE_CHECK(initialized_, "distance mask is not initialized\n"); const RadiusDependentDistanceMask *mask=get_mask(sampling_radius); IMP_USAGE_CHECK(mask==nullptr,"mask for radius "<first,eps)) { closest = upper_closest->second; IMP_LOG_VERBOSE("for radius:"<first<first,eps)) { closest = lower_closest->second; } } } if (closest == nullptr) { IMP_WARN("could not find parameters for radius:"<