IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
Voxel.h
Go to the documentation of this file.
1/**
2 * \file IMP/em/Voxel.h \brief voxel decorator.
3 *
4 * Copyright 2007-2022 IMP Inventors. All rights reserved.
5 *
6 */
7
8#ifndef IMPEM_VOXEL_H
9#define IMPEM_VOXEL_H
10
11#include <IMP/em/em_config.h>
12#include <IMP/Decorator.h>
13#include <IMP/core/XYZ.h>
14#include <IMP/core/XYZR.h>
17
18IMPEM_BEGIN_NAMESPACE
19
20//! A a decorator for a particle that stores data on a density voxel , such as:
21//! position (x,y,z) attributes and density attributes
22/**
23 \ingroup decorators
24 */
25class IMPEMEXPORT Voxel : public Decorator {
26 static void do_setup_particle(Model *m, ParticleIndex pi,
27 const algebra::Vector3D &position, Float radius,
28 Float density) {
29 core::XYZR::setup_particle(m, pi, algebra::Sphere3D(position, radius));
30 m->add_attribute(get_density_key(), pi, density, false);
31 }
32
33 public:
34 static const FloatKey get_density_key();
35 static const FloatKeys get_keys();
36
37 IMP_DECORATOR_METHODS(Voxel, Decorator);
38 IMP_DECORATOR_SETUP_3(Voxel, algebra::Vector3D, position, Float, radius,
39 Float, density);
40
41 IMP_DECORATOR_GET_SET(density, get_density_key(), Float, Float);
42
43 static bool get_is_setup(Model *m, ParticleIndex pi) {
44 if (!core::XYZ::get_is_setup(m, pi)) return false;
45 return m->get_has_attribute(get_density_key(), pi);
46 }
47};
48
49IMP_DECORATORS(Voxel, Voxels, Particles);
50
51IMPEM_END_NAMESPACE
52
53#endif /* IMPEM_VOXEL_H */
The base class for decorators.
Simple 3D sphere class.
Decorator for a sphere-like particle.
Simple XYZ decorator.
Simple 3D vector class.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition XYZR.h:48
#define IMP_DECORATOR_GET_SET(name, AttributeKey, Type, ReturnType)
Define methods for getting and setting a particular simple field.
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
#define IMP_DECORATOR_METHODS(Name, Parent)
#define IMP_DECORATOR_SETUP_3(Name, FirstArgumentType, first_argument_name, SecondArgumentType, second_argument_name, ThirdArgumentType, third_argument_name)
SphereD< 3 > Sphere3D
Typedef for Python.
Definition SphereD.h:103
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
Vector< Pointer< Particle > > Particles
A list of reference-counted Particle objects.
Definition base_types.h:138
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
VectorD< 3 > Vector3D
Definition VectorD.h:407
Key< 0 > FloatKey
The type used to identify float attributes in the Particles.
Definition base_types.h:32
IMP::Vector< FloatKey > FloatKeys
Definition base_types.h:33