PCL Plotter main class. More...
#include <pcl/visualization/pcl_plotter.h>
Public Types | |
using | Ptr = shared_ptr< PCLPlotter > |
using | ConstPtr = shared_ptr< const PCLPlotter > |
using | PolynomialFunction = std::vector< double > |
A representation of polynomial function. More... |
|
using | RationalFunction = std::pair< PolynomialFunction, PolynomialFunction > |
A representation of rational function, defined as the ratio of two polynomial functions. More... |
|
Public Member Functions | |
PCLPlotter (char const *name="PCL Plotter") | |
PCL Plotter constructor. More... |
|
~PCLPlotter () | |
Destructor. More... |
|
void | addPlotData (double const *array_X, double const *array_Y, unsigned long size, char const *name="Y Axis", int type=vtkChart::LINE, char const *color=nullptr) |
Adds a plot with correspondences in the arrays arrayX and arrayY. More... |
|
void | addPlotData (std::vector< double > const &array_x, std::vector< double >const &array_y, char const *name="Y Axis", int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >()) |
Adds a plot with correspondences in vectors arrayX and arrayY. More... |
|
void | addPlotData (std::vector< std::pair< double, double > > const &plot_data, char const *name="Y Axis", int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >()) |
Adds a plot with correspondences in vector of pairs. More... |
|
void | addPlotData (PolynomialFunction const &p_function, double x_min, double x_max, char const *name="Y Axis", int num_points=100, int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >()) |
Adds a plot based on the given polynomial function and the range in X axis. More... |
|
void | addPlotData (RationalFunction const &r_function, double x_min, double x_max, char const *name="Y Axis", int num_points=100, int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >()) |
Adds a plot based on the given rational function and the range in X axis. More... |
|
void | addPlotData (double(*function)(double), double x_min, double x_max, char const *name="Y Axis", int num_points=100, int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >()) |
Adds a plot based on a user defined callback function representing the function to plot. More... |
|
void | addPlotData (char const *filename, int type=vtkChart::LINE) |
Adds a plot based on a space/tab delimited table provided in a file. More... |
|
void | addHistogramData (std::vector< double > const &data, int const nbins=10, char const *name="Histogram", std::vector< char > const &color=std::vector< char >()) |
Bins the elements in vector data into nbins equally spaced containers and plots the resulted histogram. More... |
|
template<typename PointT > | |
bool | addFeatureHistogram (const pcl::PointCloud< PointT > &cloud, int hsize, const std::string &id="cloud", int win_width=640, int win_height=200) |
Add a histogram feature to screen as a separate window, from a cloud containing a single histogram. More... |
|
bool | addFeatureHistogram (const pcl::PCLPointCloud2 &cloud, const std::string &field_name, const std::string &id="cloud", int win_width=640, int win_height=200) |
Add a histogram feature to screen as a separate window from a cloud containing a single histogram. More... |
|
template<typename PointT > | |
bool | addFeatureHistogram (const pcl::PointCloud< PointT > &cloud, const std::string &field_name, const pcl::index_t index, const std::string &id="cloud", int win_width=640, int win_height=200) |
Add a histogram feature to screen as a separate window. More... |
|
bool | addFeatureHistogram (const pcl::PCLPointCloud2 &cloud, const std::string &field_name, const pcl::index_t index, const std::string &id="cloud", int win_width=640, int win_height=200) |
Add a histogram feature to screen as a separate window. More... |
|
void | plot () |
Draws all the plots added by addPlotData() or addHistogramData() till now. More... |
|
void | spinOnce (const int spin_time=1) |
Spins (runs the event loop) the interactor for spin_time amount of time. More... |
|
void | spin () |
Spins (runs the event loop) the interactor indefinitely. More... |
|
void | clearPlots () |
Remove all plots from the window. More... |
|
void | setColorScheme (int scheme) |
Set method for the color scheme of the plot. More... |
|
int | getColorScheme () |
get the currently used color scheme More... |
|
void | setBackgroundColor (const double r, const double g, const double b) |
set/get method for the viewport's background color. More... |
|
void | setBackgroundColor (const double color[3]) |
set/get method for the viewport's background color. More... |
|
double * | getBackgroundColor () |
set/get method for the viewport's background color. More... |
|
void | setXRange (double min, double max) |
Set logical range of the X-Axis in plot coordinates. More... |
|
void | setYRange (double min, double max) |
Set logical range of the Y-Axis in plot coordinates. More... |
|
void | setTitle (const char *title) |
Set the main title of the plot. More... |
|
void | setXTitle (const char *title) |
Set the title of the X-Axis. More... |
|
void | setYTitle (const char *title) |
Set the title of the Y-Axis. More... |
|
void | setShowLegend (bool flag) |
Shows the legend of the graph. More... |
|
void | setWindowSize (int w, int h) |
set/get method for the window size. More... |
|
void | setWindowPosition (int x, int y) |
Set the position in screen coordinates. More... |
|
void | setWindowName (const std::string &name) |
Set the visualizer window name. More... |
|
int * | getWindowSize () const |
set/get method for the window size. More... |
|
vtkSmartPointer< vtkRenderWindow > | getRenderWindow () |
Return a pointer to the underlying VTK RenderWindow used. More... |
|
void | setViewInteractor (vtkSmartPointer< vtkRenderWindowInteractor > interactor) |
Set the view's interactor. More... |
|
void | startInteractor () |
Initialize and Start the view's interactor. More... |
|
void | renderOnce () |
Render the vtkWindow once. More... |
|
bool | wasStopped () const |
Returns true when the user tried to close the window. More... |
|
void | close () |
Stop the interaction and close the visualizaton window. More... |
|
PCL Plotter main class.
Given point correspondences this class can be used to plot the data one against the other and display it on the screen. It also has methods for providing plot for important functions like histogram etc. Important functions of PCLHistogramVisualizer are redefined here so that this single class can take responsibility of all plotting related functionalities.
Definition at line 75 of file pcl_plotter.h.
using pcl::visualization::PCLPlotter::ConstPtr = shared_ptr<const PCLPlotter> |
Definition at line 79 of file pcl_plotter.h.
using pcl::visualization::PCLPlotter::PolynomialFunction = std::vector<double> |
A representation of polynomial function.
i'th element of the vector denotes the coefficient of x^i of the polynomial in variable x.
Definition at line 83 of file pcl_plotter.h.
using pcl::visualization::PCLPlotter::Ptr = shared_ptr<PCLPlotter> |
Definition at line 78 of file pcl_plotter.h.
using pcl::visualization::PCLPlotter::RationalFunction = std::pair<PolynomialFunction, PolynomialFunction> |
A representation of rational function, defined as the ratio of two polynomial functions.
pair::first denotes the numerator and pair::second denotes the denominator of the Rational function.
Definition at line 87 of file pcl_plotter.h.
pcl::visualization::PCLPlotter::PCLPlotter | ( | char const * |
name = "PCL Plotter"
|
) |
PCL Plotter constructor.
[in] | name | Name of the window |
pcl::visualization::PCLPlotter::~PCLPlotter | ( | ) |
Destructor.
bool pcl::visualization::PCLPlotter::addFeatureHistogram | ( | const pcl::PCLPointCloud2 & | cloud, |
const std::string & | field_name, | ||
const pcl::index_t | index, | ||
const std::string & |
id = "cloud" , | ||
int |
win_width = 640 , | ||
int |
win_height = 200 | ||
) |
Add a histogram feature to screen as a separate window.
[in] | cloud | the PointCloud dataset containing the histogram |
[in] | field_name | the field name containing the histogram |
[in] | index | the point index to extract the histogram from |
[in] | id | the point cloud object id (default: cloud) |
[in] | win_width | the width of the window |
[in] | win_height | the height of the window |
bool pcl::visualization::PCLPlotter::addFeatureHistogram | ( | const pcl::PCLPointCloud2 & | cloud, |
const std::string & | field_name, | ||
const std::string & |
id = "cloud" , | ||
int |
win_width = 640 , | ||
int |
win_height = 200 | ||
) |
Add a histogram feature to screen as a separate window from a cloud containing a single histogram.
[in] | cloud | the PointCloud dataset containing the histogram |
[in] | field_name | the field name containing the histogram |
[in] | id | the point cloud object id (default: cloud) |
[in] | win_width | the width of the window |
[in] | win_height | the height of the window |
bool pcl::visualization::PCLPlotter::addFeatureHistogram | ( | const pcl::PointCloud< PointT > & | cloud, |
const std::string & | field_name, | ||
const pcl::index_t | index, | ||
const std::string & |
id = "cloud" , | ||
int |
win_width = 640 , | ||
int |
win_height = 200 | ||
) |
Add a histogram feature to screen as a separate window.
[in] | cloud | the PointCloud dataset containing the histogram |
[in] | field_name | the field name containing the histogram |
[in] | index | the point index to extract the histogram from |
[in] | id | the point cloud object id (default: cloud) |
[in] | win_width | the width of the window |
[in] | win_height | the height of the window |
Definition at line 69 of file pcl_plotter.hpp.
References addPlotData(), setWindowSize(), and pcl::PointCloud< PointT >::size().
bool pcl::visualization::PCLPlotter::addFeatureHistogram | ( | const pcl::PointCloud< PointT > & | cloud, |
int | hsize, | ||
const std::string & |
id = "cloud" , | ||
int |
win_width = 640 , | ||
int |
win_height = 200 | ||
) |
Add a histogram feature to screen as a separate window, from a cloud containing a single histogram.
[in] | cloud | the PointCloud dataset containing the histogram |
[in] | hsize | the length of the histogram |
[in] | id | the point cloud object id (default: cloud) |
[in] | win_width | the width of the window |
[in] | win_height | the height of the window |
Definition at line 49 of file pcl_plotter.hpp.
References addPlotData(), and setWindowSize().
void pcl::visualization::PCLPlotter::addHistogramData | ( | std::vector< double > const & | data, |
int const |
nbins = 10 , | ||
char const * |
name = "Histogram" , | ||
std::vector< char > const & |
color = std::vector< char >() | ||
) |
Bins the elements in vector data into nbins equally spaced containers and plots the resulted histogram.
[in] | data | the raw data |
[in] | nbins | the number of bins for the histogram |
[in] | name | name of this histogram which will appear on legends if toggled on |
[in] | color | a character array of 4 fields denoting the R,G,B and A component of the color of the plot ranging from 0 to 255. If this argument is not passed (or an empty vector is passed) the histogram is colored based on the current color scheme |
void pcl::visualization::PCLPlotter::addPlotData | ( | char const * | filename, |
int |
type = vtkChart::LINE | ||
) |
Adds a plot based on a space/tab delimited table provided in a file.
[in] | filename | name of the file containing the table. 1st column represents the values of X-Axis. Rest of the columns represent the corresponding values in Y-Axes. First row of the file is considered for naming/labeling of the plot. The plot-names should not contain any space in between. |
[in] | type | type of the graph plotted. vtkChart::LINE for line plot, vtkChart::BAR for bar plot, and vtkChart::POINTS for a scattered point plot |
void pcl::visualization::PCLPlotter::addPlotData | ( | double const * | array_X, |
double const * | array_Y, | ||
unsigned long | size, | ||
char const * |
name = "Y Axis" , | ||
int |
type = vtkChart::LINE , | ||
char const * |
color = nullptr | ||
) |
Adds a plot with correspondences in the arrays arrayX and arrayY.
[in] | array_X | X coordinates of point correspondence array |
[in] | array_Y | Y coordinates of point correspondence array |
[in] | size | length of the array arrayX and arrayY |
[in] | name | name of the plot which appears in the legend when toggled on |
[in] | type | type of the graph plotted. vtkChart::LINE for line plot, vtkChart::BAR for bar plot, and vtkChart::POINTS for a scattered point plot |
[in] | color | a character array of 4 fields denoting the R,G,B and A component of the color of the plot ranging from 0 to 255. If this argument is not passed (or NULL is passed) the plot is colored based on a color scheme |
Referenced by addFeatureHistogram().
void pcl::visualization::PCLPlotter::addPlotData | ( | double(*)(double) | function, |
double | x_min, | ||
double | x_max, | ||
char const * |
name = "Y Axis" , | ||
int |
num_points = 100 , | ||
int |
type = vtkChart::LINE , | ||
std::vector< char > const & |
color = std::vector< char >() | ||
) |
Adds a plot based on a user defined callback function representing the function to plot.
[in] | function | a user defined callback function representing the relation y = function(x) |
[in] | x_min | the left boundary of the range for displaying the plot |
[in] | x_max | the right boundary of the range for displaying the plot |
[in] | name | name of the plot which appears in the legend when toggled on |
[in] | num_points | Number of points plotted to show the graph. More this number, more is the resolution. |
[in] | type | type of the graph plotted. vtkChart::LINE for line plot, vtkChart::BAR for bar plot, and vtkChart::POINTS for a scattered point plot |
[in] | color | a character array of 4 fields denoting the R,G,B and A component of the color of the plot ranging from 0 to 255. If this argument is not passed (or NULL is passed) the plot is colored based on a color scheme |
void pcl::visualization::PCLPlotter::addPlotData | ( | PolynomialFunction const & | p_function, |
double | x_min, | ||
double | x_max, | ||
char const * |
name = "Y Axis" , | ||
int |
num_points = 100 , | ||
int |
type = vtkChart::LINE , | ||
std::vector< char > const & |
color = std::vector< char >() | ||
) |
Adds a plot based on the given polynomial function and the range in X axis.
[in] | p_function | A polynomial function which is represented by a vector which stores the coefficients. See description on the typedef. |
[in] | x_min | the left boundary of the range for displaying the plot |
[in] | x_max | the right boundary of the range for displaying the plot |
[in] | name | name of the plot which appears in the legend when toggled on |
[in] | num_points | Number of points plotted to show the graph. More this number, more is the resolution. |
[in] | type | type of the graph plotted. vtkChart::LINE for line plot, vtkChart::BAR for bar plot, and vtkChart::POINTS for a scattered point plot |
[in] | color | a character array of 4 fields denoting the R,G,B and A component of the color of the plot ranging from 0 to 255. If this argument is not passed (or NULL is passed) the plot is colored based on a color scheme |
void pcl::visualization::PCLPlotter::addPlotData | ( | RationalFunction const & | r_function, |
double | x_min, | ||
double | x_max, | ||
char const * |
name = "Y Axis" , | ||
int |
num_points = 100 , | ||
int |
type = vtkChart::LINE , | ||
std::vector< char > const & |
color = std::vector< char >() | ||
) |
Adds a plot based on the given rational function and the range in X axis.
[in] | r_function | A rational function which is represented by the ratio of two polynomial functions. See description on the typedef for more details. |
[in] | x_min | the left boundary of the range for displaying the plot |
[in] | x_max | the right boundary of the range for displaying the plot |
[in] | name | name of the plot which appears in the legend when toggled on |
[in] | num_points | Number of points plotted to show the graph. More this number, more is the resolution. |
[in] | type | type of the graph plotted. vtkChart::LINE for line plot, vtkChart::BAR for bar plot, and vtkChart::POINTS for a scattered point plot |
[in] | color | a character array of 4 fields denoting the R,G,B and A component of the color of the plot ranging from 0 to 255. If this argument is not passed (or NULL is passed) the plot is colored based on a color scheme |
void pcl::visualization::PCLPlotter::addPlotData | ( | std::vector< double > const & | array_x, |
std::vector< double >const & | array_y, | ||
char const * |
name = "Y Axis" , | ||
int |
type = vtkChart::LINE , | ||
std::vector< char > const & |
color = std::vector< char >() | ||
) |
Adds a plot with correspondences in vectors arrayX and arrayY.
This is the vector version of the addPlotData function.
[in] | array_x | X coordinates of point correspondence array |
[in] | array_y | Y coordinates of point correspondence array |
[in] | name | name of the plot which appears in the legend when toggled on |
[in] | type | type of the graph plotted. vtkChart::LINE for line plot, vtkChart::BAR for bar plot, and vtkChart::POINTS for a scattered point plot |
[in] | color | a character array of 4 fields denoting the R,G,B and A component of the color of the plot ranging from 0 to 255. If this argument is not passed (or NULL is passed) the plot is colored based on a color scheme |
void pcl::visualization::PCLPlotter::addPlotData | ( | std::vector< std::pair< double, double > > const & | plot_data, |
char const * |
name = "Y Axis" , | ||
int |
type = vtkChart::LINE , | ||
std::vector< char > const & |
color = std::vector< char >() | ||
) |
Adds a plot with correspondences in vector of pairs.
The the first and second field of the pairs of the vector forms the correspondence.
plot_data | ||
[in] | name | name of the plot which appears in the legend when toggled on |
[in] | type | type of the graph plotted. vtkChart::LINE for line plot, vtkChart::BAR for bar plot, and vtkChart::POINTS for a scattered point plot |
[in] | color | a character array of 4 fields denoting the R,G,B and A component of the color of the plot ranging from 0 to 255. If this argument is not passed (or NULL is passed) the plot is colored based on a color scheme |
void pcl::visualization::PCLPlotter::clearPlots | ( | ) |
Remove all plots from the window.
void pcl::visualization::PCLPlotter::close | ( | ) |
Stop the interaction and close the visualizaton window.
double* pcl::visualization::PCLPlotter::getBackgroundColor | ( | ) |
set/get method for the viewport's background color.
int pcl::visualization::PCLPlotter::getColorScheme | ( | ) |
get the currently used color scheme
vtkSmartPointer<vtkRenderWindow> pcl::visualization::PCLPlotter::getRenderWindow | ( | ) |
Return a pointer to the underlying VTK RenderWindow used.
int* pcl::visualization::PCLPlotter::getWindowSize | ( | ) | const |
set/get method for the window size.
void pcl::visualization::PCLPlotter::plot | ( | ) |
Draws all the plots added by addPlotData() or addHistogramData() till now.
void pcl::visualization::PCLPlotter::renderOnce | ( | ) |
Render the vtkWindow once.
void pcl::visualization::PCLPlotter::setBackgroundColor | ( | const double | color[3] | ) |
set/get method for the viewport's background color.
[in] | color | the array containing the 3 component of the RGB color |
void pcl::visualization::PCLPlotter::setBackgroundColor | ( | const double | r, |
const double | g, | ||
const double | b | ||
) |
void pcl::visualization::PCLPlotter::setColorScheme | ( | int | scheme | ) |
Set method for the color scheme of the plot.
The plots gets autocolored differently based on the color scheme.
[in] | scheme | the color scheme. Possible values are vtkColorSeries::SPECTRUM, vtkColorSeries::WARM, vtkColorSeries::COOL, vtkColorSeries::BLUES, vtkColorSeries::WILD_FLOWER, vtkColorSeries::CITRUS |
void pcl::visualization::PCLPlotter::setShowLegend | ( | bool | flag | ) |
Shows the legend of the graph.
[in] | flag | pass flag = true for the display of the legend of the graph |
void pcl::visualization::PCLPlotter::setTitle | ( | const char * | title | ) |
Set the main title of the plot.
[in] | title | the title to set |
void pcl::visualization::PCLPlotter::setViewInteractor | ( | vtkSmartPointer< vtkRenderWindowInteractor > | interactor | ) |
Set the view's interactor.
void pcl::visualization::PCLPlotter::setWindowName | ( | const std::string & | name | ) |
Set the visualizer window name.
[in] | name | the name of the window |
void pcl::visualization::PCLPlotter::setWindowPosition | ( | int | x, |
int | y | ||
) |
Set the position in screen coordinates.
[in] | x | where to move the window to (X) |
[in] | y | where to move the window to (Y) |
void pcl::visualization::PCLPlotter::setWindowSize | ( | int | w, |
int | h | ||
) |
set/get method for the window size.
[in] | w | the width of the window |
[in] | h | the height of the window |
Referenced by addFeatureHistogram().
void pcl::visualization::PCLPlotter::setXRange | ( | double | min, |
double | max | ||
) |
Set logical range of the X-Axis in plot coordinates.
[in] | min | the left boundary of the range |
[in] | max | the right boundary of the range |
void pcl::visualization::PCLPlotter::setXTitle | ( | const char * | title | ) |
Set the title of the X-Axis.
[in] | title | the title to set |
void pcl::visualization::PCLPlotter::setYRange | ( | double | min, |
double | max | ||
) |
Set logical range of the Y-Axis in plot coordinates.
[in] | min | the left boundary of the range |
[in] | max | the right boundary of the range |
void pcl::visualization::PCLPlotter::setYTitle | ( | const char * | title | ) |
Set the title of the Y-Axis.
[in] | title | the title to set |
void pcl::visualization::PCLPlotter::spin | ( | ) |
Spins (runs the event loop) the interactor indefinitely.
Same as plot() - added to retain the similarity between other existing visualization classes.
void pcl::visualization::PCLPlotter::spinOnce | ( | const int |
spin_time = 1
|
) |
Spins (runs the event loop) the interactor for spin_time amount of time.
The name is confusing and will be probably obsolete in the future release with a single overloaded spin()/display() function.
[in] | spin_time | - How long (in ms) should the visualization loop be allowed to run. |
void pcl::visualization::PCLPlotter::startInteractor | ( | ) |
Initialize and Start the view's interactor.
bool pcl::visualization::PCLPlotter::wasStopped | ( | ) | const |
Returns true when the user tried to close the window.
© 2009–2012, Willow Garage, Inc.
© 2012–, Open Perception, Inc.
Licensed under the BSD License.
https://pointclouds.org/documentation/classpcl_1_1visualization_1_1_p_c_l_plotter.html