Volumes
VDB-backed volumes and loaders used with attribute / grid workflows.
Typedefs
-
typedef openvdb::Grid<openvdb::tree::Tree4<openvdb::Vec2s, 5, 4, 3>::Type> Vec2sGrid
-
typedef openvdb::Grid<openvdb::tree::Tree4<openvdb::Vec4s, 5, 4, 3>::Type> Vec4sGrid
-
template<typename GridType>
class VDBVolume - #include <vdb_volume.h>
Public Types
-
namespace VDB_Loader
Functions
-
std::shared_ptr<Vec3sVDBVolume> load_vdb_vec3s_volume_from_grid(const std::string &file_path, const std::string &grid_name, bool center = false)
-
std::shared_ptr<Vec4sVDBVolume> load_vdb_vec4s_volume_from_grid(const std::string &file_path, const std::string &grid_name, bool center = false)
-
std::shared_ptr<FloatVDBVolume> load_vdb_volume_from_grid(const std::string &file_path, const std::string &grid_name, bool center = false)
-
std::shared_ptr<Vec3sVDBVolume> load_vdb_vec3s_volume_from_grid(const std::string &file_path, const std::string &grid_name, bool center = false)
-
class DICOMLoader
- #include <dicom_loader.h>
Public Functions
-
std::shared_ptr<FloatVDBVolume> as_volume()
-
DICOMLoader(const std::string &directory, bool center = false, double rescale_slope = -std::numeric_limits<double>::infinity(), double rescale_intercept = -std::numeric_limits<double>::infinity(), double slice_thickness = -std::numeric_limits<double>::infinity(), double x_pixel_spacing = -std::numeric_limits<double>::infinity(), double y_pixel_spacing = -std::numeric_limits<double>::infinity())
Construct a DICOM volume from the given directory.
- Parameters:
directory – The directory containing the DICOM stack.
center – Whether to center the volume at the origin. Default is false.
rescale_slope – The rescale slope to apply to the pixel values. If not provided, it will be read from the DICOM metadata.
rescale_intercept – The rescale intercept to apply to the pixel values. If not provided, it will be read from the DICOM metadata.
slice_thickness – The slice thickness in mm. If not provided, it will be read from the DICOM metadata.
x_pixel_spacing – The pixel spacing in the x direction in mm. If not provided, it will be read from the DICOM metadata.
y_pixel_spacing – The pixel spacing in the y direction in mm. If not provided, it will be read from the DICOM metadata.
-
inline std::pair<glm::vec3, glm::vec3> get_bounding_box() const
-
inline glm::vec3 get_dimensions() const
-
inline std::pair<double, double> get_min_max_hu() const
-
inline double get_rescale_intercept() const
-
inline double get_rescale_slope() const
-
inline glm::vec3 get_voxel_size() const
Private Types
-
using GridType = openvdb::FloatGrid
Private Functions
-
std::vector<std::vector<double>> load_dicom_image(const std::string &file_path)
Load a single DICOM image from the given file path and return the pixel data as a 2D vector.
-
void load_dicom_stack(const std::string &directory)
Load a DICOM stack from the given directory into an OpenVDB volume.
- Parameters:
directory – The directory containing the DICOM stack.
Private Members
-
bool m_center = false
-
double m_hu_max = std::numeric_limits<double>::min()
-
double m_hu_min = std::numeric_limits<double>::max()
-
double m_rescale_intercept = -std::numeric_limits<double>::infinity()
-
double m_rescale_slope = -std::numeric_limits<double>::infinity()
-
double m_x_size = 0
-
double m_x_spacing = -std::numeric_limits<double>::infinity()
-
double m_y_size = 0
-
double m_y_spacing = -std::numeric_limits<double>::infinity()
-
double m_z_size = 0
-
double m_z_spacing = -std::numeric_limits<double>::infinity()
Private Static Functions
-
static DICOM_Meta_Data GetDICOMMetaData(const std::string &file_path)
Get the metadata for a DICOM image from the given file path.
-
static glm::mat4 GetDICOMRigidTransform(DcmDataset *dataset)
-
static double GetRescaledValue(Uint16 pixel_value, double rescale_slope, double rescale_intercept)
-
struct DICOM_Meta_Data
Public Members
-
bool found_rescale_intercept = false
-
bool found_rescale_slope = false
-
bool found_thickness = false
-
bool found_width_and_height = false
-
bool found_xy_spacing = false
-
size_t height = 0
-
double rescale_intercept = 0.0
-
double rescale_slope = 1.0
-
glm::mat4 rigid_transform = glm::mat4(1.0f)
-
double slice_thickness = 1
-
size_t width = 0
-
double x_pixel_spacing = -1
-
double y_pixel_spacing = -1
-
bool found_rescale_intercept = false
-
std::shared_ptr<FloatVDBVolume> as_volume()