<div dir="ltr">Hi Miguel,<div><br></div><div>I think you listed all the histogram classes. The simplest is vtkImageHistogram, e.g.</div><div><a href="https://gitlab.kitware.com/vtk/vtk/blob/master/Imaging/Core/Testing/Cxx/ImageHistogram.cxx" target="_blank">https://gitlab.kitware.com/<wbr>vtk/vtk/blob/master/Imaging/<wbr>Core/Testing/Cxx/<wbr>ImageHistogram.cxx</a><br></div><div><br></div><div>Rather than producing a plot, per se, it produces the histogram as an image. It's basic interface is:</div><div><br></div><div>SetNumberOfBins(15)</div><div>SetBinSpacing(1.0)</div><div>SetBinOrigin(0.0)</div><div><br></div><div>So you would need to compute the "BinSpacing" from your desired range. The "BinOrigin" is simply the lower end of the range.</div><div><br></div><div>As well as producing an image of the histogram, it has a GetHistogram() method for getting the histogram as an array.</div><div><br></div><div> - David</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 20, 2017 at 8:09 AM, Miguel Nunes <span dir="ltr"><<a href="mailto:m.nunes@fratoria.com" target="_blank">m.nunes@fratoria.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
I would like to ask this list about histograms in VTK c++. I have been a vtk<br>
user for several years, but never had the need to use histograms through vtk<br>
as I was using pure c++ and openGL.<br>
Now, I would like to simply plot a basic histogram of a float 3d image. I<br>
have taken a look at the examples provided but I find myself quite confused.<br>
Honestly, for an advanced visualization toolkit I am quite surprised to find<br>
it so complicated. There are classes such as vtkPlot that allow bars, then<br>
there is vtkBarChartActor, vtkImageAccumulate, vtkXYPlotActor,<br>
vtkImageHistogramStatistics and vtkImageHistogram.<br>
<br>
It all needs to be remixed, connected and many properties have to be set<br>
manually.<br>
<br>
Maybe I am missing a class (or the point), but in general terms I would like<br>
to easily plot and render a simple histogram, like:<br>
<br>
myHistogram->setData( vtkImagaData *)<br>
myHistogram->setXRange(range[2<wbr>]) // clips values under and above the range specified<br>
myHistogram->setNumberOfBins(1<wbr>5) // calculates the bin width and each bins' Y<br>
myHistogram->update() //generate the whole thing<br>
renderer->getActor()->setData(<wbr>myHistogram)<br>
<br>
...and then its done.<br>
<br>
Any chance this actually exist? Thank you very much!<br></blockquote></div></div></div></div>