00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPEM_VOXEL_H
00009 #define IMPEM_VOXEL_H
00010
00011 #include "em_config.h"
00012 #include <IMP/Decorator.h>
00013 #include <IMP/core/XYZ.h>
00014 #include <IMP/core/XYZR.h>
00015 #include <IMP/algebra/Vector3D.h>
00016 #include <IMP/algebra/Sphere3D.h>
00017
00018 IMPEM_BEGIN_NAMESPACE
00019
00020
00021
00022
00023
00024
00025 class IMPEMEXPORT Voxel: public Decorator
00026 {
00027 public:
00028
00029 static const FloatKey get_density_key();
00030 static const FloatKeys get_keys();
00031
00032 IMP_DECORATOR(Voxel, Decorator);
00033
00034
00035 static Voxel setup_particle(Particle *p,
00036 const algebra::VectorD<3> &position,
00037 Float radius,
00038 Float density) {
00039 core::XYZR::setup_particle(p,algebra::SphereD<3>(position,radius));
00040 p->add_attribute(get_density_key(),density,false);
00041 return Voxel(p);
00042 }
00043
00044 IMP_DECORATOR_GET_SET(density, get_density_key(), Float, Float);
00045
00046 static bool particle_is_instance(Particle *p) {
00047 core::XYZ::particle_is_instance(p);
00048 IMP_USAGE_CHECK( p->has_attribute(get_density_key()),
00049 "Particle is expected to have density attribute.");
00050 return true;
00051 }
00052 };
00053
00054 IMP_OUTPUT_OPERATOR(Voxel);
00055
00056 typedef Decorators<Voxel, Particles> Voxels;
00057
00058 IMPEM_END_NAMESPACE
00059
00060 #endif