Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SbDiscreteLineProfile Class Reference

ImageViz Profile line extractor More...

#include <ImageViz/SbDiscreteLineProfile.h>

Public Member Functions

 SbDiscreteLineProfile (SbVec2i32 p1, SbVec2i32 p2, SoImageDataAdapter *image)
 Constructor defining the profile line on the image.
 
 SbDiscreteLineProfile (SbVec3i32 p1, SbVec3i32 p2, SoImageDataAdapter *image)
 
 SbDiscreteLineProfile (SbVec4i32 p1, SbVec4i32 p2, SoImageDataAdapter *image)
 
 ~SbDiscreteLineProfile ()
 Destructor.
 
size_t getLength () const
 Returns the length of extracted data (i.e.
 
const double & getValue (int index, int component=0) const
 Returns the value along the line at specified displacement relatively to first point.
 
const double * getValues () const
 Returns the values buffer.
 
const SbVec4i32getPosition (int index) const
 Returns the position along the line at specified displacement relatively to first point.
 
const SbVec4i32getFirstPosition () const
 Returns the first point.
 
const SbVec4i32getLastPosition () const
 Returns the last point.
 
const double & operator[] (int i) const
 Accessor operator.
 

Detailed Description

ImageViz Profile line extractor

Define a profile line extractor based on the Bresenham's Line algorithm.

SEE ALSO

Definition at line 44 of file SbDiscreteLineProfile.h.

Constructor & Destructor Documentation

◆ SbDiscreteLineProfile() [1/3]

SbDiscreteLineProfile::SbDiscreteLineProfile ( SbVec2i32  p1,
SbVec2i32  p2,
SoImageDataAdapter image 
)

Constructor defining the profile line on the image.

Parameters
p1begin point of the profile. Can be a 2d, 3d and 3d+t point.
p2end point of the profile. Can be a 2d, 3d and 3d+t point.
imageimage 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() [2/3]

SbDiscreteLineProfile::SbDiscreteLineProfile ( SbVec3i32  p1,
SbVec3i32  p2,
SoImageDataAdapter image 
)

◆ SbDiscreteLineProfile() [3/3]

SbDiscreteLineProfile::SbDiscreteLineProfile ( SbVec4i32  p1,
SbVec4i32  p2,
SoImageDataAdapter image 
)

◆ ~SbDiscreteLineProfile()

SbDiscreteLineProfile::~SbDiscreteLineProfile ( )

Destructor.

Member Function Documentation

◆ getFirstPosition()

const SbVec4i32 & SbDiscreteLineProfile::getFirstPosition ( ) const

Returns the first point.

◆ getLastPosition()

const SbVec4i32 & SbDiscreteLineProfile::getLastPosition ( ) const

Returns the last point.

◆ getLength()

size_t SbDiscreteLineProfile::getLength ( ) const

Returns the length of extracted data (i.e.

the number of extracted voxels).

◆ getPosition()

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.

◆ getValue()

const double & SbDiscreteLineProfile::getValue ( int  index,
int  component = 0 
) const

Returns the value along the line at specified displacement relatively to first point.

Parameters
index
componentchoose 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.

◆ getValues()

const double * SbDiscreteLineProfile::getValues ( ) const

Returns the values buffer.

◆ operator[]()

const double & SbDiscreteLineProfile::operator[] ( int  i) const

Accessor operator.

So you can do:

val = profile[i];

Note:

  • profile[i] refers to profile.getValue( i, 0 ).
  • Range of index is between 0 and n-1 with n, the number of voxels in the segment (see getLength),
  • For performance reasons this is an unsafe accessor (bounds are not tested).
  • Applicable only for 1-component image or on the first component of image.

The documentation for this class was generated from the following file: