MIDSX 0.1
A x-ray transport code system for dosimetry
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
VoxelGrid Class Reference

Class which represents a voxel grid. More...

#include <voxel_grid.h>

Collaboration diagram for VoxelGrid:

Public Member Functions

 VoxelGrid (std::string filename, bool is_python_environment=false)
 Constructor for the VoxelGrid class.
 
VoxelgetVoxel (const Eigen::Vector3i &voxel_index)
 Gets the voxel at (i, j, k).
 
void setVoxel (const Eigen::Vector3i &voxel_index, Voxel &value)
 Sets the voxel at (i, j, k) to specified voxel.
 
Eigen::Vector3d getVoxelPosition (const Eigen::Vector3i &voxel_index)
 Gets the spatial position of the voxel at (i, j, k).
 
bool withinGrid (const Eigen::Vector3d &position) const
 Checks if a spatial position is within the voxel grid.
 
Eigen::Vector3i getVoxelIndex (const Eigen::Vector3d &position) const
 Gets the voxel index of a spatial position.
 
std::vector< std::string > getMaterialNames () const
 Gets vector of material names in voxel grid.
 
double getTotalEnergyDeposited ()
 Gets the total energy deposited in the voxel grid.
 
std::unordered_map< int, VectorValuegetEnergyDepositedInMaterials ()
 Gets the total energy deposited in the voxel grid by material.
 
void addExit ()
 Adds to the number of photons that have exited the voxel grid.
 
int getNumExits () const
 Gets the number of photons that have exited the voxel grid.
 
Eigen::Vector3d getDimSpace () const
 Gets the spatial dimensions of the voxel grid.
 

Private Member Functions

void initializeVoxels ()
 
int voxelNumber (const Eigen::Vector3i &voxel_index) const
 
void handleOutOfBounds (const Eigen::Vector3d &position) const
 
void setVoxelProperties (const py::array_t< uint8_t > &array, const py::object &header)
 
void setDimVox (const py::array_t< uint8_t > &array)
 
void setUnits (const py::object &header)
 
void setSpacing (const py::object &header)
 
void setNumOfVoxels ()
 
void setDimSpace ()
 
void setVoxelMaterialIDs (const py::array_t< uint8_t > &array)
 

Static Private Member Functions

static py::array_t< uint8_t > getNumPyArrayFromImg (const py::object &img)
 

Private Attributes

Eigen::Vector3i dim_vox_
 
Eigen::Vector3d spacing_
 
Eigen::Vector3d dim_space_
 
int numOfVoxels_ = 0
 
int numExits_ = 0
 
std::vector< Voxelvoxels_
 
std::string filename_
 
double units_ = 1.0
 
bool is_python_environment_
 

Detailed Description

Class which represents a voxel grid.

Stores the voxels and the properties of the voxel grid.

Definition at line 28 of file voxel_grid.h.

Constructor & Destructor Documentation

◆ VoxelGrid()

VoxelGrid::VoxelGrid ( std::string filename,
bool is_python_environment = false )
explicit

Constructor for the VoxelGrid class.

Parameters
dim_voxThe dimensions of the voxel grid in voxels.
is_python_environmentWhether or not the VoxelGrid is being constructed in a Python environment. Only True for python wrapper only.

Member Function Documentation

◆ addExit()

void VoxelGrid::addExit ( )
inline

Adds to the number of photons that have exited the voxel grid.

Definition at line 100 of file voxel_grid.h.

◆ getDimSpace()

Eigen::Vector3d VoxelGrid::getDimSpace ( ) const
inline

Gets the spatial dimensions of the voxel grid.

Returns
vector of spatial dimensions of the voxel grid

Definition at line 116 of file voxel_grid.h.

◆ getEnergyDepositedInMaterials()

std::unordered_map< int, VectorValue > VoxelGrid::getEnergyDepositedInMaterials ( )

Gets the total energy deposited in the voxel grid by material.

Returns
unordered map of material name to total energy deposited in the voxel grid by material (eV)

◆ getMaterialNames()

std::vector< std::string > VoxelGrid::getMaterialNames ( ) const

Gets vector of material names in voxel grid.

Returns
vector of material names in voxel grid

◆ getNumExits()

int VoxelGrid::getNumExits ( ) const
inline

Gets the number of photons that have exited the voxel grid.

Returns
number of photons that have exited the voxel grid

Definition at line 108 of file voxel_grid.h.

◆ getTotalEnergyDeposited()

double VoxelGrid::getTotalEnergyDeposited ( )

Gets the total energy deposited in the voxel grid.

Returns
total energy deposited in the voxel grid (eV)

◆ getVoxel()

Voxel & VoxelGrid::getVoxel ( const Eigen::Vector3i & voxel_index)

Gets the voxel at (i, j, k).

Parameters
voxel_index
Returns

◆ getVoxelIndex()

Eigen::Vector3i VoxelGrid::getVoxelIndex ( const Eigen::Vector3d & position) const

Gets the voxel index of a spatial position.

Parameters
position
Returns
voxel index of position

◆ getVoxelPosition()

Eigen::Vector3d VoxelGrid::getVoxelPosition ( const Eigen::Vector3i & voxel_index)

Gets the spatial position of the voxel at (i, j, k).

Parameters
voxel_index
Returns
vector of spatial position of voxel at (i, j, k)

◆ setVoxel()

void VoxelGrid::setVoxel ( const Eigen::Vector3i & voxel_index,
Voxel & value )

Sets the voxel at (i, j, k) to specified voxel.

Parameters
voxel_index
value

◆ withinGrid()

bool VoxelGrid::withinGrid ( const Eigen::Vector3d & position) const

Checks if a spatial position is within the voxel grid.

Parameters
position
Returns
true if position is within voxel grid, false otherwise

Member Data Documentation

◆ dim_space_

Eigen::Vector3d VoxelGrid::dim_space_
private

Definition at line 123 of file voxel_grid.h.

◆ dim_vox_

Eigen::Vector3i VoxelGrid::dim_vox_
private

Definition at line 121 of file voxel_grid.h.

◆ filename_

std::string VoxelGrid::filename_
private

Definition at line 127 of file voxel_grid.h.

◆ is_python_environment_

bool VoxelGrid::is_python_environment_
private

Definition at line 129 of file voxel_grid.h.

◆ numExits_

int VoxelGrid::numExits_ = 0
private

Definition at line 125 of file voxel_grid.h.

◆ numOfVoxels_

int VoxelGrid::numOfVoxels_ = 0
private

Definition at line 124 of file voxel_grid.h.

◆ spacing_

Eigen::Vector3d VoxelGrid::spacing_
private

Definition at line 122 of file voxel_grid.h.

◆ units_

double VoxelGrid::units_ = 1.0
private

Definition at line 128 of file voxel_grid.h.

◆ voxels_

std::vector<Voxel> VoxelGrid::voxels_
private

Definition at line 126 of file voxel_grid.h.


The documentation for this class was generated from the following file: