|
GGEMS
1.1
GPU GEant4-based Monte Carlo Simulations
|
Go to the documentation of this file.
40 : number_elements_(0),
41 data_type_(
"MET_FLOAT"),
42 output_image_filename_(
""),
43 output_range_to_material_filename_(
""),
44 voxelized_volume_(nullptr)
46 GGcout(
"GGEMSVolumeCreatorManager",
"GGEMSVolumeCreatorManager", 3) <<
"GGEMSVolumeCreatorManager creating..." <<
GGendl;
56 GGcout(
"GGEMSVolumeCreatorManager",
"GGEMSVolumeCreatorManager", 3) <<
"GGEMSVolumeCreatorManager created!!!" <<
GGendl;
65 GGcout(
"GGEMSVolumeCreatorManager",
"~GGEMSVolumeCreatorManager", 3) <<
"GGEMSVolumeCreatorManager erasing..." <<
GGendl;
67 GGcout(
"GGEMSVolumeCreatorManager",
"~GGEMSVolumeCreatorManager", 3) <<
"GGEMSVolumeCreatorManager erased!!!" <<
GGendl;
76 GGcout(
"GGEMSVolumeCreatorManager",
"Clean", 3) <<
"GGEMSVolumeCreatorManager cleaning..." <<
GGendl;
85 GGcout(
"GGEMSVolumeCreatorManager",
"Clean", 3) <<
"GGEMSVolumeCreatorManager cleaned!!!" <<
GGendl;
131 std::ostringstream oss(std::ostringstream::out);
132 oss <<
"Your type in not compatible. The type has to be:" << std::endl;
133 oss <<
" - MET_CHAR" << std::endl;
134 oss <<
" - MET_UCHAR" << std::endl;
135 oss <<
" - MET_SHORT" << std::endl;
136 oss <<
" - MET_USHORT" << std::endl;
137 oss <<
" - MET_INT" << std::endl;
138 oss <<
" - MET_UINT" << std::endl;
139 oss <<
" - MET_FLOAT" << std::endl;
150 GGcout(
"GGEMSVolumeCreatorManager",
"AddLabelAndMaterial", 3) <<
"Adding new material and label..." <<
GGendl;
153 auto const [iter, success] =
label_to_material_.insert(std::make_pair(label, material));
155 std::ostringstream oss(std::ostringstream::out);
156 oss <<
"The label: " << iter->first <<
" already exists...";
185 GGcout(
"GGEMSVolumeCreatorManager",
"CheckParameters", 3) <<
"Checking parameters for phantom creator manager..." <<
GGendl;
199 GGEMSMisc::ThrowException(
"GGEMSVolumeCreatorManager",
"CheckParameters",
"A output image filename has to be done to phantom manager!!!");
204 GGEMSMisc::ThrowException(
"GGEMSVolumeCreatorManager",
"CheckParameters",
"A output range to material data filename has to be done to phantom manager!!!");
214 GGcout(
"GGEMSVolumeCreatorManager",
"Initialize", 3) <<
"Initializing phantom creator manager..." <<
GGendl;
219 if (!
data_type_.compare(
"MET_CHAR")) AllocateImage<char>();
220 else if (!
data_type_.compare(
"MET_UCHAR")) AllocateImage<unsigned char>();
221 else if (!
data_type_.compare(
"MET_SHORT")) AllocateImage<GGshort>();
222 else if (!
data_type_.compare(
"MET_USHORT")) AllocateImage<GGushort>();
223 else if (!
data_type_.compare(
"MET_INT")) AllocateImage<GGint>();
224 else if (!
data_type_.compare(
"MET_UINT")) AllocateImage<GGuint>();
225 else if (!
data_type_.compare(
"MET_FLOAT")) AllocateImage<GGfloat>();
247 GGcout(
"GGEMSVolumeCreatorManager",
"WriteRangeToMaterialFile", 3) <<
"Writing range to material text file..." <<
GGendl;
249 GGcout(
"GGEMSVolumeCreatorManager",
"WriteRangeToMaterialFile", 0) <<
"List of label and material:" <<
GGendl;
251 GGcout(
"GGEMSVolumeCreatorManager",
"WriteRangeToMaterialFile", 0) <<
" * Material: " << i.second <<
", label: " << i.first <<
GGendl;
257 range_to_data_stream << i.first <<
" " << i.first <<
" " << i.second << std::endl;
259 range_to_data_stream.close();
268 GGcout(
"GGEMSVolumeCreatorManager",
"WriteMHDImage", 3) <<
"Writing MHD output file..." <<
GGendl;
303 volume_creator_manager->
SetElementSizes(voxel_width, voxel_height, voxel_depth, unit);
339 volume_creator_manager->
Write();
I/O class handling MHD file.
void AddLabelAndMaterial(GGfloat const &label, std::string const &material)
add the label and the material
void initialize_volume_creator_manager(GGEMSVolumeCreatorManager *volume_creator_manager)
Initialize the volume creator manager.
void SetElementSizes(GGfloat const &voxel_width, GGfloat const &voxel_height, GGfloat const &voxel_depth, std::string const &unit="mm")
Set the size of the elements for the voxelized volume.
void WriteMHDImage(void) const
Write output MHD file.
void set_material_volume_creator_manager(GGEMSVolumeCreatorManager *volume_creator_manager, char const *material)
set the material of the global (background volume)
static GGEMSVolumeCreatorManager & GetInstance(void)
Create at first time the Singleton.
void SetDataType(std::string const &data_type)
set the type of data
~GGEMSVolumeCreatorManager(void)
Unable the destructor for the user.
void SetMaterial(std::string const &material="Air")
set the material, Air by default
void SetElementSizes(GGfloat3 const &element_sizes)
set the size of the elements
void set_element_sizes_volume_creator_manager(GGEMSVolumeCreatorManager *volume_creator_manager, GGfloat const voxel_width, GGfloat const voxel_height, GGfloat const voxel_depth, char const *unit)
Set the size of the elements for the voxelized volume.
void WriteRangeToMaterialFile(void)
Write the file with range to material data.
void write_volume_creator_manager(GGEMSVolumeCreatorManager *volume_creator_manager)
Save the voxelized volume to raw data in mhd file.
void Deallocate(cl::Buffer *buffer, GGsize size, GGsize const &thread_index, std::string const &class_name="Undefined")
Deallocation of OpenCL memory.
void Write(void)
Save the voxelized volume to raw data in mhd file.
GGsize3 volume_dimensions_
void Clean(void)
clean OpenCL data
void Write(cl::Buffer *image, GGsize const &thread_index) const
Write mhd header/raw file.
void SetOutputFileName(std::string const &basename)
set the output filename (*.mhd)
void set_output_range_to_material_filename_volume_creator_manager(GGEMSVolumeCreatorManager *volume_creator_manager, char const *output_range_to_material_filename)
Set the filename of range to material data.
cl::Buffer * voxelized_volume_
Singleton class handling convertion from analytical volume to voxelized volume.
Singleton class generating voxelized volume from analytical volume.
void SetVolumeDimensions(GGsize const &volume_width, GGsize const &volume_height, GGsize const &volume_depth)
Set the dimension of the volume for the voxelized volume.
std::string output_range_to_material_filename_
void set_output_image_filename_volume_creator_manager(GGEMSVolumeCreatorManager *volume_creator_manager, char const *output_image_filename)
Set the filename of MHD output.
void set_volume_dimension_volume_creator_manager(GGEMSVolumeCreatorManager *volume_creator_manager, GGsize const volume_width, GGsize const volume_height, GGsize const volume_depth)
Set the dimension of the volume for the voxelized volume.
void Initialize(void)
Initialize the volume Creator manager.
void SetDimensions(GGsize3 const &dimensions)
set the dimensions of the image
LabelToMaterialMap label_to_material_
GGEMSVolumeCreatorManager(void)
Unable the constructor for the user.
Namespace storing all the usefull physical units.
std::string output_image_filename_
#define GGendl
overload C++ std::endl
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
void SetOutputImageFilename(std::string const &output_image_filename)
Set the filename of MHD output.
void SetRangeToMaterialDataFilename(std::string const &output_range_to_material_filename)
Set the filename of range to material data.
void set_data_type_volume_creator_manager(GGEMSVolumeCreatorManager *volume_creator_manager, char const *data_type)
set the type of data
void CheckParameters(void) const
Check the mandatory parameters.
I/O class handling MHD image file.
GGEMSVolumeCreatorManager * get_instance_volume_creator_manager(void)
Get the GGEMSVolumeCreatorManager pointer for python user.
void SetDataType(std::string const &data_type="MET_FLOAT")
set the type of data
void ThrowException(std::string const &class_name, std::string const &method_name, std::string const &message)
Throw a C++ exception.
T DistanceUnit(T const &value, std::string const &unit)
Choose best distance unit.
static GGEMSOpenCLManager & GetInstance(void)
Create at first time the Singleton.