35 #ifndef __XRayDetector_h 36 #define __XRayDetector_h 73 #ifndef __gVirtualXRayConfig_h 93 #ifndef __SphereMesh_h 101 #ifndef __Scintillator_h 128 typedef enum SourceShapeTag
258 unsigned int aNumberOfSamplesAlongOneDirection,
273 unsigned int aNumberOfSamplesAlongOneDirection,
298 unsigned int aNumberOfSamplesAlongLength,
299 unsigned int aNumberOfSamplesAlongHeight,
314 const VEC3& aDirection,
315 unsigned int aNumberOfSamplesAlongOneDirection,
543 const VEC3& aRotationCentre,
544 const VEC3& aRotationAxis);
587 void setEnergyResponse(
const std::vector<std::pair<float, float> >& anEnergyResponse);
590 void setEnergyResponse(
const std::vector<std::pair<double, double> >& anEnergyResponse);
597 const float& aThickness);
605 std::vector<std::pair<RATIONAL_NUMBER, RATIONAL_NUMBER> >
getEnergyResponse()
const;
624 void setLSF(
const std::string& aFileName);
633 void setLSF(
const std::vector<RATIONAL_NUMBER>& aLSF);
642 const std::vector<RATIONAL_NUMBER>&
getLSF()
const;
760 #if __cplusplus < 199711L 769 #if __cplusplus < 199711L 777 #if __cplusplus < 199711L 785 #if __cplusplus < 199711L 793 #if __cplusplus < 199711L 859 #endif // __XRayDetector_h SourceShape
SourceShape is a type that defines the shape of X-ray sources.
void clearLSF()
Clear the LSF to use a Dirac as impulse response.
RATIONAL_NUMBER applyEnergyResponse(const RATIONAL_NUMBER &anEnergy) const
Apply the energy response if any.
void rotateFocalSpot(const RATIONAL_NUMBER &aRotationAngle, const VEC3 &aRotationAxis)
Rotate the focal spot around its centre.
bool useParallelBeam() const
Accessor on the flag about projection.
double getScintillatorThickness()
RATIONAL_NUMBER m_distance_source_detector
Distance between the source and the detector.
std::auto_ptr< VBO > m_parallel_beam
The triangle mesh corresponding to the parallel beam.
Class to handle 3D meshes of spheres.
void loadEnergyResponse(const std::string &aFileName, const RATIONAL_NUMBER &aUnitOfEnergy)
Load the energy response of the detector from a TSV file.
void rotateSource(const RATIONAL_NUMBER &aRotationAngle, const VEC3 &aRotationCentre, const VEC3 &aRotationAxis)
Rotate the source around and arbitrary point.
void setPSF(const Image< RATIONAL_NUMBER > &aPSF)
Set the point spread function from a 2D image.
Scintillator is a class to generate the energy response due to the scintillator of the X-Ray detector...
void setEnergyResponse(const std::vector< std::pair< float, float > > &anEnergyResponse)
void setLineSource()
Set the shape of the source as a line segment.
Class to generate the energy response due to the scintillator of the X-Ray detector.
std::auto_ptr< VBO > m_cone_beam_highlight
The triangle mesh corresponding to the cone beam highlight.
VEC3 m_xray_source_centre
The position of the source centre.
Class to handle 3D meshes of cubes.
VEC3 m_normal
The vector normal to the detector.
void displayBeam()
Display the beam using OpenGL.
Image< RATIONAL_NUMBER > m_PSF
Impulse response of the detector as a point spread function.
Class to handle vertex buffer objects (VBOs).
const VEC3 & getSourceSamplePosition(unsigned int aSampleID) const
void displaySourceWireframe()
Display the source using OpenGL.
std::vector< RATIONAL_NUMBER > m_LSF
Impulse response of the detector as a line spread function.
void setLSF(const std::string &aFileName)
Set the line spread function from a file.
Vec3 is a template class to handle a 3D vector.
const MATRIX4 & getRotationMatrix() const
Accessor on the rotation matrix.
void setSquareSource()
Set the shape of the source as a square.
bool m_vbo_need_update
A flag set to true when the VBOs need to be updated.
void setScintillator(const Scintillator &aScintillator)
const std::string & getScintillatorMaterial()
void setRightVector(const VEC3 &aRightVector)
Set the right vector that defines the detector's orientation.
bool m_update_right_vector_flag
VEC2 m_size_in_unit_of_length
The size of the detector.
void setRotationMatrix(const MATRIX4 &aMatrix)
Set the rotation matrix.
const VEC2 & getPixelSizeInUnitOfLength() const
const std::vector< RATIONAL_NUMBER > & getLSF() const
Accessor on the line spread function.
std::vector< VEC3 > m_p_xray_source_position_set
The sample positions of the source.
VEC3 m_right_vector
The cross product between m_look_at_vector and m_up_vector.
SphereMesh is a class to handle 3D meshes of spheres.
MATRIX4 m_rotation_matrix
The rotation matrix.
CubeMesh< float > m_first_pixel_mesh
Polygon mesh of the first pixel of the detector.
Source whose shape corresponds to a square.
Vec2ui m_size_in_number_of_pixels
Size of the detector (in number of pixels)
void autoAlignDetector(bool aFlag=true)
VEC2 m_resolution_in_unit_of_length_per_pixel
Resolution (in unit of length per pixel)
void displayDetector()
Display the detector using OpenGL.
const std::vector< VEC3 > & getSourcePositionSet() const
void setCubicSource()
Set the shape of the source as a cube.
const VEC3 & getRightVector() const
Accessor on the cross product between m_look_at_vector and m_up_vector.
void updateInternalValues()
Compute the distance between the source and the detector, etc.
XRayDetector is a class to handle a X-ray detector.
SourceShape m_source_shape
Source type.
void updateConeBeamVBO()
Update the VBO of the cone beam.
Template class to handle a 4x4 matrixs.
RATIONAL_NUMBER m_fovy
Field of view along the Y-axis.
const Vec2ui & getNumberOfPixels() const
Accessor on the number of pixels.
RATIONAL_NUMBER m_widget_length
The length of the widgets.
SphereMesh m_detector_centre_mesh
std::auto_ptr< VBO > m_parallel_beam_highlight
The triangle mesh corresponding to the parallel beam highlight.
std::vector< GLfloat > m_p_detector_geometry_vertices
float RATIONAL_NUMBER
Type of data used to store real numbers.
Source whose shape corresponds to a line segment.
void setDetectorPosition(const VEC3 &aDetectorPosition)
Set the position of the X-ray detector.
const RATIONAL_NUMBER & getFOVY() const
Accessor on the view along the Y-axis.
Class to handle a greyscale image.
void setXrayPointSource()
Set the shape of the source as an infinitely small point.
void updateParallelBeamVBO()
Update the VBO of the parallel beam.
std::auto_ptr< VBO > m_cone_beam
The triangle mesh corresponding to the cone beam.
const VEC3 & getDetectorPosition() const
Accessor on the detector position.
VEC3 m_detector_position
The position of the detector centre.
const std::vector< float > & getVertices() const
Accessor on the four corners of the X-ray detector.
void setConeBeam()
Set the projection mode to cone beam (same as point source).
void setPointSource()
Set the projection mode to point source (same as cone beam).
Source whose shape corresponds to a cube.
void updateSizeInUnitOfLength()
Compute the size of the detector.
void updateDetectorVBO()
Update the VBO of the detector.
void clearEnergyResponse()
Clear the energy response of the detector.
void setParallelBeam()
Set the projection mode to parallel beam.
void getPlaneEquation(RATIONAL_NUMBER &A, RATIONAL_NUMBER &B, RATIONAL_NUMBER &C, RATIONAL_NUMBER &D)
Accessor on the plane equation (Ax + By + Cz + D = 0).
SourceShape getSourceShape() const
Accessor on the shape of the source.
XRayDetector()
Default constructor.
const VEC2 & getSizeInUnitOfLength() const
Accessor on the size of the detector (in unit of length).
Source whose shape corresponds to a rectangle.
SphereMesh m_source_mesh
Polygon mesh of the source.
Class to handle virtual X-Ray detectors.
const VEC3 & getXraySourceCentre() const
Accessor on the centre of the source.
unsigned int getNumberOfSourceSamples() const
Infinitively small point source.
void rotateDetector(const RATIONAL_NUMBER &anAngle, const VEC3 &aRotationAxis)
const Image< RATIONAL_NUMBER > & getPSF() const
Accessor on the point spread function.
void setNumberOfPixels(const Vec2ui &aSizeInPixels)
Set the number of pixels.
void setSourcePositions(const std::vector< VEC3 > &aSourcePostionSet)
std::vector< std::pair< RATIONAL_NUMBER, RATIONAL_NUMBER > > getEnergyResponse() const
const VEC3 & getNormal() const
Accessor on the vector normal to the detector.
void setRectangleSource()
Set the shape of the source as a rectangle.
~XRayDetector()
Destructor.
std::auto_ptr< VBO > m_detector_geometry
The triangle mesh corresponding to the detector.
void release()
Release the data.
void setResolutionInUnitsOfLengthPerPixel(const RATIONAL_NUMBER &aResolution)
void updateFOVY()
Update the view along the Y-axis.
const VEC3 & getUpVector() const
Accessor on the up vector, which defines the orientation of the detector.
void updateVBOs()
Update the VBOs.
VEC3 m_up_vector
The "up" vector the the detector.
void clearPSF()
Clear the PSF to use a Dirac as impulse response.
Matrix4x4 is a template class to handle a 4 by 4 matrix.
void setUpVector(const VEC3 &anUpVector)
Set the up vector that defines the detector's orientation.
void displaySource()
Display the source using OpenGL.
void displayDetectorPosition()
Display a sphere on the position of the centre of the detecotr using OpenGL.
void setWidgetLength(const RATIONAL_NUMBER &aLength)
Scintillator m_scintillator
Scintillator.
void displayFirstPixelPosition()
Display a sphere on the position of the first pixel of the image using OpenGL.
const VEC2 & getPixelSpacingInUnitOfLength() const
Accessor on the pixel spacing (in unit of length).