plastimatch
|
The Volume class represents a three-dimensional volume on a uniform grid. The volume can be located at arbitrary positions and orientations in space, and can represent most voxel types (float, unsigned char, etc.). A volume can also support multiple planes, which is used to hold three dimensional vector fields, or three-dimensional bitfields.
More...
#include <volume.h>
Public Member Functions | |
SMART_POINTER_SUPPORT (Volume) | |
Volume () | |
Volume (const plm_long dim[3], const float origin[3], const float spacing[3], const float direction_cosines[9], enum Volume_pixel_type vox_type, int vox_planes) | |
Volume (const plm_long dim[3], const float origin[3], const float spacing[3], const Direction_cosines &direction_cosines, enum Volume_pixel_type vox_type, int vox_planes) | |
Volume (const Volume_header &vh, enum Volume_pixel_type vox_type, int vox_planes) | |
~Volume () | |
plm_long | index (plm_long i, plm_long j, plm_long k) const |
Return a linear index to a voxel. | |
plm_long | index (plm_long ijk[3]) const |
Return a linear index to a voxel. | |
void | create (const plm_long new_dim[3], const float origin[3], const float spacing[3], const float direction_cosines[9], enum Volume_pixel_type vox_type, int vox_planes=1) |
Initialize and allocate memory for the image. | |
void | create (const Volume_header &vh, enum Volume_pixel_type vox_type, int vox_planes=1) |
Initialize and allocate memory for the image. | |
Volume::Pointer | clone () |
Make a copy of the volume. | |
Volume::Pointer | clone (Volume_pixel_type new_type) const |
Make a copy of the volume with the same geometry and same voxel values, but converted to a different data type. | |
Volume::Pointer | clone_empty () |
Make a copy of the volume with the same geometry, but set all the voxel values to zero. | |
void | convert (Volume_pixel_type new_type) |
Convert the image voxels to a new data type. | |
const float * | get_origin (void) const |
Get a pointer to the origin of the volume. The origin is defined as the location in world coordinates of the center of the first voxel in the volume. | |
void | get_origin (float *) const |
void | set_origin (const float origin[3]) |
Set the origin. The origin is defined as the location in world coordinates of the center of the first voxel in the volume. | |
const plm_long * | get_dim (void) |
Get a pointer to the volume dimensions. | |
const float * | get_spacing (void) const |
Get a pointer to the spacing of the volume. The spacing is distance between voxels. | |
void | get_spacing (float *) const |
void | set_spacing (const float spacing[3]) |
Set the spacing. The spacing is distance between voxels. | |
Direction_cosines & | get_direction_cosines (void) |
Get a pointer to the direction cosines. Direction cosines hold the orientation of a volume. They are defined as the unit length direction vectors of the volume in world space as one traverses the pixels in the raw array of values. | |
const Direction_cosines & | get_direction_cosines (void) const |
float * | get_direction_matrix (void) |
const float * | get_direction_matrix (void) const |
void | set_direction_cosines (const float direction_cosines[9]) |
Set the direction cosines. Direction cosines hold the orientation of a volume. They are defined as the unit length direction vectors of the volume in world space as one traverses the pixels in the raw array of values. | |
void | set_header (const Volume_header &) |
Set the image header. This routine doesn't change any of the pixel values. It just changes the image geometry. | |
void | set_header (const Plm_image_header *) |
template<class T > | |
T * | get_raw () |
Get the raw image pointer as specified type. No error checking done. | |
template<class T > | |
const T * | get_raw () const |
const float * | get_step (void) const |
Get the step matrix. The step matrix encodes the transform from voxel coordinates to world coordinates. | |
const float * | get_proj (void) const |
Get the proj matrix. The proj matrix encodes the transform from world coordinates to voxel coordinates. | |
void | position (float xyz[3], const plm_long ijk[3]) |
Return a world coordinates of a voxel. | |
void | coordinates (plm_long ijk[3], plm_long idx) |
Return coordinates from index. | |
float | get_ijk_value (const float xyz[3]) const |
Get the value at a voxel coordinate, clamped and tri-linearly interpolated. Only applies to float volumes. | |
void | get_xyz_from_ijk (double xyz[3], const plm_long ijk[3]) |
plm_long | get_idx_from_xyz (const float xyz[3], bool *in) |
void | get_ijk_from_xyz (plm_long ijk[3], const float xyz[3], bool *in) |
void | get_ijk_from_xyz (float ijk[3], const float xyz[3], bool *in) |
bool | is_inside (const float ijk[3]) const |
Return true if continuous index ijk is inside volume. | |
void | move_origin_to_idx (const plm_long ijk[3]) |
Move the origin to the coordinate at a given index. This is used to correct itk images which have a non-zero region index. | |
void | scale_inplace (float scale) |
In-place (destructive) scaling of the image according to the supplied scale factor. | |
void | debug () |
void | direction_cosines_debug () |
Volume * | clone_raw () |
Public Attributes | |
plm_long | dim [3] |
plm_long | npix |
float | origin [3] |
float | spacing [3] |
Direction_cosines | direction_cosines |
enum Volume_pixel_type | pix_type |
int | vox_planes |
int | pix_size |
void * | img |
float | step [9] |
float | proj [9] |
Protected Member Functions | |
void | allocate (void) |
void | init () |
The Volume class represents a three-dimensional volume on a uniform grid. The volume can be located at arbitrary positions and orientations in space, and can represent most voxel types (float, unsigned char, etc.). A volume can also support multiple planes, which is used to hold three dimensional vector fields, or three-dimensional bitfields.
Volume::Volume | ( | ) |
Volume::Volume | ( | const plm_long | dim[3], |
const float | origin[3], | ||
const float | spacing[3], | ||
const float | direction_cosines[9], | ||
enum Volume_pixel_type | vox_type, | ||
int | vox_planes ) |
Volume::Volume | ( | const plm_long | dim[3], |
const float | origin[3], | ||
const float | spacing[3], | ||
const Direction_cosines & | direction_cosines, | ||
enum Volume_pixel_type | vox_type, | ||
int | vox_planes ) |
Volume::Volume | ( | const Volume_header & | vh, |
enum Volume_pixel_type | vox_type, | ||
int | vox_planes ) |
Volume::~Volume | ( | ) |
|
protected |
Volume::Pointer Volume::clone | ( | ) |
Make a copy of the volume.
Volume::Pointer Volume::clone | ( | Volume_pixel_type | new_type | ) | const |
Make a copy of the volume with the same geometry and same voxel values, but converted to a different data type.
Volume::Pointer Volume::clone_empty | ( | ) |
Make a copy of the volume with the same geometry, but set all the voxel values to zero.
Volume * Volume::clone_raw | ( | ) |
void Volume::convert | ( | Volume_pixel_type | new_type | ) |
Convert the image voxels to a new data type.
|
inline |
Return coordinates from index.
void Volume::create | ( | const plm_long | new_dim[3], |
const float | origin[3], | ||
const float | spacing[3], | ||
const float | direction_cosines[9], | ||
enum Volume_pixel_type | vox_type, | ||
int | vox_planes = 1 ) |
Initialize and allocate memory for the image.
void Volume::create | ( | const Volume_header & | vh, |
enum Volume_pixel_type | vox_type, | ||
int | vox_planes = 1 ) |
Initialize and allocate memory for the image.
void Volume::debug | ( | ) |
void Volume::direction_cosines_debug | ( | ) |
|
inline |
Get a pointer to the volume dimensions.
|
inline |
Get a pointer to the direction cosines.
Direction cosines hold the orientation of a volume. They are defined as the unit length direction vectors of the volume in world space as one traverses the pixels in the raw array of values.
|
inline |
|
inline |
|
inline |
plm_long Volume::get_idx_from_xyz | ( | const float | xyz[3], |
bool * | in ) |
void Volume::get_ijk_from_xyz | ( | float | ijk[3], |
const float | xyz[3], | ||
bool * | in ) |
void Volume::get_ijk_from_xyz | ( | plm_long | ijk[3], |
const float | xyz[3], | ||
bool * | in ) |
float Volume::get_ijk_value | ( | const float | xyz[3] | ) | const |
Get the value at a voxel coordinate, clamped and tri-linearly interpolated. Only applies to float volumes.
void Volume::get_origin | ( | float * | origin | ) | const |
const float * Volume::get_origin | ( | void | ) | const |
Get a pointer to the origin of the volume.
The origin is defined as the location in world coordinates of the center of the first voxel in the volume.
const float * Volume::get_proj | ( | void | ) | const |
Get the proj matrix. The proj matrix encodes the transform from world coordinates to voxel coordinates.
template float * Volume::get_raw< float > | ( | ) |
Get the raw image pointer as specified type. No error checking done.
template const float * Volume::get_raw< float > | ( | ) | const |
void Volume::get_spacing | ( | float * | spacing | ) | const |
const float * Volume::get_spacing | ( | void | ) | const |
Get a pointer to the spacing of the volume.
The spacing is distance between voxels.
const float * Volume::get_step | ( | void | ) | const |
Get the step matrix. The step matrix encodes the transform from voxel coordinates to world coordinates.
void Volume::get_xyz_from_ijk | ( | double | xyz[3], |
const plm_long | ijk[3] ) |
|
inline |
Return a linear index to a voxel.
|
inline |
Return a linear index to a voxel.
|
protected |
bool Volume::is_inside | ( | const float | ijk[3] | ) | const |
Return true if continuous index ijk is inside volume.
void Volume::move_origin_to_idx | ( | const plm_long | ijk[3] | ) |
Move the origin to the coordinate at a given index. This is used to correct itk images which have a non-zero region index.
|
inline |
Return a world coordinates of a voxel.
void Volume::scale_inplace | ( | float | scale | ) |
In-place (destructive) scaling of the image according to the supplied scale factor.
void Volume::set_direction_cosines | ( | const float | direction_cosines[9] | ) |
Set the direction cosines.
Direction cosines hold the orientation of a volume. They are defined as the unit length direction vectors of the volume in world space as one traverses the pixels in the raw array of values.
void Volume::set_header | ( | const Plm_image_header * | pih | ) |
void Volume::set_header | ( | const Volume_header & | vh | ) |
Set the image header. This routine doesn't change any of the pixel values. It just changes the image geometry.
void Volume::set_origin | ( | const float | origin[3] | ) |
Set the origin. The origin is defined as the location in world coordinates of the center of the first voxel in the volume.
void Volume::set_spacing | ( | const float | spacing[3] | ) |
Set the spacing. The spacing is distance between voxels.
Volume::SMART_POINTER_SUPPORT | ( | Volume | ) |
plm_long Volume::dim[3] |
Direction_cosines Volume::direction_cosines |
void* Volume::img |
plm_long Volume::npix |
float Volume::origin[3] |
int Volume::pix_size |
enum Volume_pixel_type Volume::pix_type |
float Volume::proj[9] |
float Volume::spacing[3] |
float Volume::step[9] |
int Volume::vox_planes |