CTL  0.6.1
Computed Tomography Library
spectralvolumedata.h
1 #ifndef CTL_SPECTRALVOLUMEDATA_H
2 #define CTL_SPECTRALVOLUMEDATA_H
3 
4 #include "voxelvolume.h"
6 
7 namespace CTL {
40 class SpectralVolumeData : public VoxelVolume<float>
41 {
42 public:
45  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel,
46  float referenceEnergy,
47  const QString& materialName = QString());
48  SpectralVolumeData(VoxelVolume<float> materialDensity,
49  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel,
50  const QString& materialName = QString());
51 
52  ~SpectralVolumeData() override = default;
53  virtual SpectralVolumeData* clone() const;
54 
55  // getter methods
56  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel() const;
57  std::unique_ptr<SpectralVolumeData> densityVolume() const;
58  bool hasSpectralInformation() const;
59  bool isDensityVolume() const;
60  bool isMuVolume() const;
61  float massAttenuationCoeff(float atEnergy) const;
62  const QString& materialName() const;
63  float meanMassAttenuationCoeff(float centerEnergy, float binWidth) const;
64  std::unique_ptr<SpectralVolumeData> muVolume(float referenceEnergy) const;
65  std::unique_ptr<SpectralVolumeData> muVolume(float centerEnergy, float binWidth) const;
66  float referenceEnergy() const;
67  float referenceMassAttenuationCoeff() const;
68 
69  static SpectralVolumeData ball(float radius, float voxelSize, float density,
70  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel);
71  static SpectralVolumeData cube(uint nbVoxel, float voxelSize, float density,
72  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel);
73  static SpectralVolumeData cylinderX(float radius, float height, float voxelSize, float density,
74  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel);
75  static SpectralVolumeData cylinderY(float radius, float height, float voxelSize, float density,
76  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel);
77  static SpectralVolumeData cylinderZ(float radius, float height, float voxelSize, float density,
78  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel);
79 
80  // setter methods
82  void replaceAbsorptionModel(std::shared_ptr<AbstractIntegrableDataModel> absorptionModel);
83  void setDensity(VoxelVolume<float> density);
84  void setMaterialName(const QString& name);
85 
87 
88  SpectralVolumeData(const SpectralVolumeData&) = default;
90  SpectralVolumeData& operator=(const SpectralVolumeData&) = default;
91  SpectralVolumeData& operator=(SpectralVolumeData&&) = default;
92 
93  // factory methods
95  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel,
96  float referenceEnergy = 50.0f);
98  std::shared_ptr<AbstractIntegrableDataModel> absorptionModel,
99  float referenceEnergy = 50.0f);
100 
101  // transform data representation
102  void transformToAttenuationCoeff(float referenceEnergy);
103  void transformToDensity();
104 
105 private:
106  std::shared_ptr<AbstractIntegrableDataModel> _absorptionModel;
107  QString _materialName;
108 
109  bool _hasNonDefaultAbsModel{ false };
110  bool _isMu{ false };
111  float _refEnergy{ -1.0f };
112  float _refMassAttenuationCoeff{ -1.0f };
113 
114  // other methods
115  void changeReferenceEnergy(float newReferenceEnergy);
116  void changeReferenceMassAttCoeff(float newReferenceMassAttCoeff, float correspondingRefEnergy);
117  void transformToAttenuationCoeff(float referenceMassAttCoeff, float correspondingRefEnergy);
118 };
119 
120 }
121 
122 #endif // CTL_SPECTRALVOLUMEDATA_H
static SpectralVolumeData cylinderZ(float radius, float height, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
Definition: spectralvolumedata.cpp:394
float meanMassAttenuationCoeff(float centerEnergy, float binWidth) const
Definition: spectralvolumedata.cpp:105
float _refEnergy
Reference energy corresponding to mu values.
Definition: spectralvolumedata.h:111
std::unique_ptr< SpectralVolumeData > densityVolume() const
Definition: spectralvolumedata.cpp:127
static SpectralVolumeData fromMuVolume(VoxelVolume< float > muValues, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel, float referenceEnergy=50.0f)
Definition: spectralvolumedata.cpp:486
float massAttenuationCoeff(float atEnergy) const
Definition: spectralvolumedata.cpp:205
float _refMassAttenuationCoeff
Reference att. coeff. corresponding to mu values.
Definition: spectralvolumedata.h:112
float referenceMassAttenuationCoeff() const
Definition: spectralvolumedata.cpp:309
void setDensity(VoxelVolume< float > density)
Definition: spectralvolumedata.cpp:443
std::shared_ptr< AbstractIntegrableDataModel > absorptionModel() const
Definition: spectralvolumedata.cpp:94
The VoxelVolume class provides a simple container for storage of voxelized 3D volume data.
Definition: ctsystemview.h:14
bool _hasNonDefaultAbsModel
True if absorption model has been set explicitely.
Definition: spectralvolumedata.h:109
static SpectralVolumeData cube(uint nbVoxel, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
Definition: spectralvolumedata.cpp:338
float referenceEnergy() const
Definition: spectralvolumedata.cpp:296
SpectralVolumeData(VoxelVolume< float > muValues)
Constructs a SpectralVolumeData representing the attenuation coefficients muValues (in 1/mm).
Definition: spectralvolumedata.cpp:22
bool hasSpectralInformation() const
Definition: spectralvolumedata.cpp:148
void replaceAbsorptionModel(AbstractIntegrableDataModel *absorptionModel)
Definition: spectralvolumedata.cpp:407
bool isDensityVolume() const
Definition: spectralvolumedata.cpp:177
const QString & materialName() const
Definition: spectralvolumedata.cpp:216
unsigned int uint
Qt style alias for unsigned int.
Definition: modulelayout.h:6
The SpectralVolumeData class holds voxelized data (for a single material) along with information on i...
Definition: spectralvolumedata.h:40
bool _isMu
True if voxel data represents att. coefficents.
Definition: spectralvolumedata.h:110
bool isMuVolume() const
Definition: spectralvolumedata.cpp:197
std::unique_ptr< SpectralVolumeData > muVolume(float referenceEnergy) const
Definition: spectralvolumedata.cpp:258
static SpectralVolumeData cylinderX(float radius, float height, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
Definition: spectralvolumedata.cpp:356
void setMaterialName(const QString &name)
Definition: spectralvolumedata.cpp:456
static SpectralVolumeData fromHUVolume(VoxelVolume< float > HUValues, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel, float referenceEnergy=50.0f)
Definition: spectralvolumedata.cpp:524
The AbstractIntegrableDataModel class is the base class for data models that provide a means to integ...
Definition: abstractdatamodel.h:110
const VoxelSize & voxelSize() const
Definition: voxelvolume.tpp:1062
static SpectralVolumeData cylinderY(float radius, float height, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
Definition: spectralvolumedata.cpp:375
static SpectralVolumeData ball(float radius, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
Definition: spectralvolumedata.cpp:325