MIDSX 0.1
A x-ray transport code system for dosimetry
Loading...
Searching...
No Matches
computational_domain.h
1#ifndef HVL_COMPUTATIONAL_DOMAIN_H
2#define HVL_COMPUTATIONAL_DOMAIN_H
3
4#include "voxel_grid.h"
5#include "json.h"
6#include "interaction_data.h"
7#include <vector>
8#include <Eigen/Core>
9#include <filesystem>
10#include <fstream>
11
12using json = nlohmann::json;
13
23public:
24 ComputationalDomain() = default;
31 explicit ComputationalDomain(const std::string &json_file_path, bool is_python_environment = false);
32
39
46 bool isInComputationalDomain(const Eigen::Vector3d &position) const;
47
54 Voxel& getVoxel(const Eigen::Vector3d &position);
55
63
70 Eigen::Vector3d getVoxelGridOriginN(int N);
71
78 Eigen::Vector3d getVoxelGridDimSpaceN(int N);
79
85 int getNumVoxelGrids() const;
86
91private:
92 std::vector<std::pair<VoxelGrid, Eigen::Vector3d>> voxel_grids_;
93 Eigen::Vector3d dim_space_;
94 bool is_python_environment_;
95
96 // related private functions
97
98
99 // initialization
100
106 void initializeCompDomain(const std::string &json_file_path);
107
114 static bool isJSON(const std::string &file_path);
115
121 void setCompProperties(const json &json_object);
122
129 void setVoxelGrids(const json &json_object, const std::string &json_directory_path);
130
131 // initializing interaction data
136 std::vector<std::string> getMaterialNames() const;
137
142 std::string getBackgroundMaterialName() const;
143
151 static void getNIFTIFilePaths(const json &voxel_grid_json, const std::string &json_directory_path, std::vector<std::string> &nifti_file_paths);
152
159 static void getOrigins(const json &voxel_grid_json, std::vector<Eigen::Vector3d> &origins);
160
166 static bool isNIFTI(const std::string &file_path);
167};
168
169#endif //HVL_COMPUTATIONAL_DOMAIN_H
Class which represents the computational domain.
static void getOrigins(const json &voxel_grid_json, std::vector< Eigen::Vector3d > &origins)
Adds origins of voxel grids to the given vector.
void initializeCompDomain(const std::string &json_file_path)
Runs the initialization of the computational domain.
static bool isNIFTI(const std::string &file_path)
Checks if the given file path is a NIFTI file.
ComputationalDomain(const std::string &json_file_path, bool is_python_environment=false)
Constructor for the ComputationalDomain class.
int getNumVoxelGrids() const
Returns the number of voxel grids in the computational domain.
Voxel background_voxel
Voxel which represents the background material.
bool isInComputationalDomain(const Eigen::Vector3d &position) const
Returns true if the position is within the computational domain, false otherwise.
void setCompProperties(const json &json_object)
Sets the properties of the computational domain.
static bool isJSON(const std::string &file_path)
Checks if the given file path is a JSON file.
Eigen::Vector3d getVoxelGridOriginN(int N)
Returns the origin of the voxel grid at index N.
std::vector< std::string > getMaterialNames() const
Returns the names of the materials in the computational domain.
std::string getBackgroundMaterialName() const
Returns the name of the background material.
Voxel & getVoxel(const Eigen::Vector3d &position)
Returns the voxel at the given position.
VoxelGrid & getVoxelGridN(int N)
Returns the voxel grid at index N.
void setVoxelGrids(const json &json_object, const std::string &json_directory_path)
Sets the voxel grids of the computational domain.
InteractionData getInteractionData() const
Returns the interaction data generated by the materials in the computational domain.
Eigen::Vector3d getVoxelGridDimSpaceN(int N)
Returns the spatial dimensions of the voxel grid at index N.
static void getNIFTIFilePaths(const json &voxel_grid_json, const std::string &json_directory_path, std::vector< std::string > &nifti_file_paths)
Adds NIFTI file paths to the given vector.
Class which provides access to various simulation significant data.
Class which represents a voxel grid.
Definition voxel_grid.h:28
Struct which represents a voxel.
Definition voxel.h:12