[Insight-users] Re: Display histogram

Luis Ibanez luis.ibanez at kitware.com
Fri Nov 19 08:23:01 EST 2004



Hi Jimmy,


ITK already provides the classes that you need for
computing the actual histogram.

Please look at the examples:

    Insight/Examples/Statistics
                      Histogram.cxx
                      ImageHistogram1.cxx
                      ImageHistogram2.cxx
                      ImageHistogram3.cxx
                      ImageHistogram4.cxx
                      ListSampleToHistogramFilter.cxx
                      ListSampleToHistogramGenerator.cxx
                      SampleToHistogramProjectionFilter.cxx


In particular you may be interested in the example

              ImageHistogram2.cxx

that illustrates how to compute the histogram of a
scalar image. This is probably the most common use
of the histograms.

This example uses the
http://www.itk.org/Insight/Doxygen/html/classitk_1_1Statistics_1_1ScalarImageToHistogramGenerator.html



Note however that the Statistics Framework in ITK
is much wider than this. It allows you to do multi-
variate statistics in different ways.


Please let us know if you have further questions.


     Thanks



        Luis




---------------------
Jimmy Wong wrote:
> Luis, thank you.
> 
> After reading your comments, I want to use method A).
> 
> You know, I am considering of converting my code from Matlab to 
> OpenSource. But quite new to ITK, VTK and FLTK.
> 
> To use XYPlotActor, I need the X and Y data, right? Does it mean that I 
> need to compute the data from vtkImageData by iteration? Any class can 
> calculate the histogram data? If there is, what I need to do is to pass 
> them to the Actor and render it lol.
> 
> Regards,
> 
> Zhimin
> 
>> From: Luis Ibanez <luis.ibanez at kitware.com>
>> To: Jimmy Wong <good_piggy at msn.com>
>> CC: Insight-users at itk.org
>> Subject: Re: Display histogram
>> Date: Thu, 18 Nov 2004 11:13:15 -0500
>>
>>
>> Hi Jimmy,
>>
>> Displaying a histogram can be done in many different ways,
>>
>> A) You could use the XYPlot Actor and/or Widget classes from VTK
>>
>>   http://www.vtk.org/doc/nightly/html/classvtkXYPlotActor.html
>>   http://www.vtk.org/doc/nightly/html/classvtkXYPlotWidget.html
>>
>>
>> B) You could use the Fl_PlotXY from FLTK  Baazar
>>
>>       http://www.fltk.org/links.php?V237
>>
>>
>> C) You could create a 2D image with the drawing of the
>>    histogram plot, and save it as JPEG, BMP, PNG...
>>
>>
>> If you want an example on how to display a histogram,
>> you may want to look at the code in SNAP:
>>
>>         InsightApplications/SNAP
>>
>> more specifically in
>>
>>   InsightApplications/SNAP/
>>         UserInterface/MainComponents/
>>                          IntensityCurveBox  .h .cxx
>>
>>
>>
>> Regards,
>>
>>
>>     Luis
>>
>>
>>
>> ---------------------
>> Jimmy Wong wrote:
>>
>>> Dear Luis,
>>>
>>> May I know how to display a histogram of a specified image? Do I need 
>>> VTK or FLTK?
>>>
>>> I have sucessfully displayed the image via VTK. Now I want to draw 
>>> the histogram.
>>>
>>> Can you teach me how? If possible, can send me example code?
>>>
>>> Thank you very much.
>>>
>>> Zhimin
>>>
>>>
>>>
>>>
>>
>>
>>
>>
> 
> 
> 
> 






More information about the Insight-users mailing list