IMP  2.0.1
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-2013 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>
15 #include <IMP/algebra/Vector3D.h>
16 #include <IMP/algebra/Sphere3D.h>
17 
18 IMPEM_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  */
25 class IMPEMEXPORT Voxel: public Decorator
26 {
27  public:
28 
29  static const FloatKey get_density_key();
30  static const FloatKeys get_keys();
31 
33 
34  /** Create a decorator with the passed coordinates. */
35  static Voxel setup_particle(Particle *p,
36  const algebra::Vector3D &position,
37  Float radius,
38  Float density) {
40  p->add_attribute(get_density_key(),density,false);
41  return Voxel(p);
42  }
43 
44  IMP_DECORATOR_GET_SET(density, get_density_key(), Float, Float);
45 
46  static bool particle_is_instance(Particle *p) {
47  core::XYZ::particle_is_instance(p);
48  IMP_USAGE_CHECK( p->has_attribute(get_density_key()),
49  "Particle is expected to have density attribute.");
50  return true;
51  }
52 };
53 
54 IMP_DECORATORS(Voxel, Voxels, Particles);
55 
56 IMPEM_END_NAMESPACE
57 
58 #endif /* IMPEM_VOXEL_H */