Profile line extractor More...
#include <ImageViz/SbDiscreteLineProfile.h>
Public Member Functions | |
~SbDiscreteLineProfile () | |
size_t | getLength () const |
const double & | getValue (int index, int component=0) const |
const double * | getValues () const |
const SbVec4i32 & | getPosition (int index) const |
const SbVec4i32 & | getFirstPosition () const |
const SbVec4i32 & | getLastPosition () const |
const double & | operator[] (int i) const |
| |
SbDiscreteLineProfile (SbVec2i32 p1, SbVec2i32 p2, SoImageDataAdapter *image) | |
SbDiscreteLineProfile (SbVec3i32 p1, SbVec3i32 p2, SoImageDataAdapter *image) | |
SbDiscreteLineProfile (SbVec4i32 p1, SbVec4i32 p2, SoImageDataAdapter *image) |
Define a profile line extractor based on the Bresenham's Line algorithm.
SbDiscreteLineProfile::SbDiscreteLineProfile | ( | SbVec2i32 | p1, | |
SbVec2i32 | p2, | |||
SoImageDataAdapter * | image | |||
) |
Constructor defining the profile line on the image.
p1 | begin point of the profile. Can be a 2d, 3d and 3d+t point. | |
p2 | end point of the profile. Can be a 2d, 3d and 3d+t point. | |
image | image to profile. Cannot be NULL. Throws an SbException if any p1 or p2 are out of image. Throws an SbException if image is NULL. |
SbDiscreteLineProfile::SbDiscreteLineProfile | ( | SbVec3i32 | p1, | |
SbVec3i32 | p2, | |||
SoImageDataAdapter * | image | |||
) |
Constructor defining the profile line on the image.
p1 | begin point of the profile. Can be a 2d, 3d and 3d+t point. | |
p2 | end point of the profile. Can be a 2d, 3d and 3d+t point. | |
image | image to profile. Cannot be NULL. Throws an SbException if any p1 or p2 are out of image. Throws an SbException if image is NULL. |
SbDiscreteLineProfile::SbDiscreteLineProfile | ( | SbVec4i32 | p1, | |
SbVec4i32 | p2, | |||
SoImageDataAdapter * | image | |||
) |
Constructor defining the profile line on the image.
p1 | begin point of the profile. Can be a 2d, 3d and 3d+t point. | |
p2 | end point of the profile. Can be a 2d, 3d and 3d+t point. | |
image | image to profile. Cannot be NULL. Throws an SbException if any p1 or p2 are out of image. Throws an SbException if image is NULL. |
SbDiscreteLineProfile::~SbDiscreteLineProfile | ( | ) |
Destructor.
const SbVec4i32& SbDiscreteLineProfile::getFirstPosition | ( | ) | const |
Returns the first point.
const SbVec4i32& SbDiscreteLineProfile::getLastPosition | ( | ) | const |
Returns the last point.
size_t SbDiscreteLineProfile::getLength | ( | ) | const |
Returns the length of extracted data (i.e.
the number of extracted voxels).
const SbVec4i32& SbDiscreteLineProfile::getPosition | ( | int | index | ) | const |
Returns the position along the line at specified displacement relatively to first point.
Range of index is between 0 and n-1 with n, the number of voxels in the segment (see getLength), Throws an SbException if index is out of bounds.
const double& SbDiscreteLineProfile::getValue | ( | int | index, | |
int | component = 0 | |||
) | const |
Returns the value along the line at specified displacement relatively to first point.
index | ||
component | choose the component of the voxel. Default is 0 which correspond to 1-component image. Range of index is between 0 and n-1 with n, the number of voxels in the segment (see getLength). Range of component is between 0 and c - 1 with c is the number of component of the image ( e.g c = 1 for grayscale, c = 3 for RGB, c = 4 for RGBA ). Throws an SbException if index is out of bounds. |
const double* SbDiscreteLineProfile::getValues | ( | ) | const |
Returns the values buffer.
const double& SbDiscreteLineProfile::operator[] | ( | int | i | ) | const |
Accessor operator.
So you can do:
val = profile[i];
Note: