Line data Source code
1 : #pragma once 2 : #include "PhantomDefines.h" 3 : 4 : namespace elsa::phantoms 5 : { 6 : 7 : template <typename data_t = double> 8 : class Box 9 : { 10 : 11 : private: 12 : data_t _amplit; 13 : Vec3i _center; 14 : Vec3X<data_t> _edgeLength; 15 : 16 : public: 17 : /** 18 : * @param amlpit amplitude wich is added to the voxel on rasterization 19 : * @param center center of the object 20 : * @param edgeLength length of the box edges X,Y,Z 21 : * 22 : */ 23 : Box(data_t amplit, Vec3i center, Vec3X<data_t> edgeLength); 24 : 25 : /** 26 : * @brief returns the amplitude to color the voxel 27 : */ 28 82 : const data_t getAmplitude() const { return _amplit; }; 29 : /** 30 : * @brief returns the center of the box 31 : */ 32 82 : const Vec3i& getCenter() const { return _center; }; 33 : /** 34 : * @brief returns the length of the edges x,y,z 35 : */ 36 166 : const Vec3X<data_t>& getEdgeLength() const { return _edgeLength; }; 37 : }; 38 : 39 : /** 40 : * @brief Rasterizes the given box in the given data container. 41 : */ 42 : template <Blending b, typename data_t> 43 : void rasterize(Box<data_t>& el, VolumeDescriptor& dd, DataContainer<data_t>& dc); 44 : 45 : } // namespace elsa::phantoms 46 : 47 : /** 48 : * @brief Box Formatter to use the Logger.h functions 49 : */ 50 : template <typename data_t> 51 : struct fmt::formatter<elsa::phantoms::Box<data_t>> : fmt::formatter<std::string> { 52 : auto format(elsa::phantoms::Box<data_t> box, format_context& ctx) -> decltype(ctx.out()) 53 40 : { 54 40 : auto _center = box.getCenter(); 55 40 : data_t _amplit = box.getAmplitude(); 56 40 : auto _edgeLength = box.getEdgeLength(); 57 40 : return format_to( 58 40 : ctx.out(), "Box with amplitude {}, Center ({},{},{}) , edge length ({},{},{})", _amplit, 59 40 : _center[elsa::phantoms::INDEX_X], _center[elsa::phantoms::INDEX_Y], 60 40 : _center[elsa::phantoms::INDEX_Z], _edgeLength[elsa::phantoms::INDEX_X], 61 40 : _edgeLength[elsa::phantoms::INDEX_Y], _edgeLength[elsa::phantoms::INDEX_Z]); 62 40 : } 63 : };