Voxel Objects
A voxel object is how the program represents a material in the phantom. By utilising the voxel object, we can create different shapes of within your phantom.
voxel_object
Purpose
The voxel object is a class that is used to represent a material in the phantom. It contains a function to determine if a point is inside the object or not and a function to determine the linear attenuation coefficient of the material.
Properties
All of these properties are immutable, therefore they cannot be changed after the object is created.
- is_in_object
(
function) A function that takes a set of points(x, y, z)and returns a list of logical values indicating if the point is inside the object or not.
- material
(
material_attenuation) The material of the object.
- get_mu
(
function) A function that takes an energy and returns the linear attenuation coefficient of the material at that energy.
Functions
- voxel_object(is_in_object, material)
Returns a voxel object with the given
is_in_objectfunction andmaterial.get_muis an anonymous function that returns the linear attenuation coefficient of the material at the given energy.- Parameters:
is_in_object (
function) – A function that takes a set of points(x, y, z)and returns a list of logical values indicating if the point is inside the object or not.material (
material_attenuation) – The material of the object.
- Returns:
obj - An instance of the voxel object class.
- Return type:
Functions to create voxel objects
There are several functions that can be used to create a voxel object. These are:
- voxel_cylinder(centre, radius, width, material)
Returns a voxel object that represents a cylinder with the given
centre,radius,widthandmaterial.- Parameters:
centre (
1x3 double) – The centre of the cylinder.radius (
double) – The radius of the cylinder.width (
double) – The width of the cylinder.material (
material_attenuation) – The material of the cylinder.
- Returns:
obj - An instance of the voxel object class.
- Return type:
- voxel_cube(cube_centre, cube_size, material)
Returns a voxel object that represents a cube with the given
cube_centre,cube_sizeandmaterial.- Parameters:
cube_centre (
1x3 double) – The centre of the cube.cube_size (
double) – The size of the cube.material (
material_attenuation) – The material of the cube.
- Returns:
obj - An instance of the voxel object class.
- Return type:
- voxel_ellipsoid(centre, a, b, c, material)
Returns a voxel object that represents an ellipsoid with the given
centre,a,b,candmaterial.- Parameters:
centre (
1x3 double) – The centre of the ellipsoid.a (
double) – The semi-axis of the ellipsoid in the x-direction.b (
double) – The semi-axis of the ellipsoid in the y-direction.c (
double) – The semi-axis of the ellipsoid in the z-direction.material (
material_attenuation) – The material of the ellipsoid.
- Returns:
obj - An instance of the voxel object class.
- Return type:
- voxel_ellipsoid_rotated(centre, a, b, c, angle, material)
Returns a voxel object that represents an ellipsoid rotated about the z-axis with the given
centre,a,b,c,angleandmaterial.- Parameters:
centre (
1x3 double) – The centre of the ellipsoid.a (
double) – The semi-axis of the ellipsoid in the x-direction.b (
double) – The semi-axis of the ellipsoid in the y-direction.c (
double) – The semi-axis of the ellipsoid in the z-direction.angle (
double) – The angle of rotation about the z-axis.material (
material_attenuation) – The material of the ellipsoid.
- Returns:
obj - An instance of the voxel object class.
- Return type: