PDA

View Full Version : Spectrogram



Ronayn
1st April 2011, 18:59
Hello,

I am trying to understand the QwtPlotSpectrogram class, but I am having some trouble. I'd like to explain what I am trying to do, and then follow that with some questions.

I have data in the form of a 2D array of byte. The X and Y dimensions of the array are variable, X can be anything between 1 and 700, and Y can be anything between 1 and 3000. The values of the array represent amplitude, and are in the range of 10 to 200.

I'd am trying to use QwtPlotSpectrogram to display this data (see code attachments) and I am working from the example provided in the Qwt tarball. My questions revolve around the QwtRasterData; which as I understand it, I must subclass and fill in the virtual functions.

My questions are:
1) In the value() function, X and Y are the indicies I am to use into my 2D array. What determines their min/max values?
2) What determines how many times value() is called? I have test data with 32 columns and 55 rows, but value() is called more than 1760 times for it.
3) Does the range() function set the min/max values of the data or the data's dimensions?
4) In the constructor I pass a QwtDoubleRect. What are the four arguments to the QwtDoubleRect supposed to be if my data is 32 columns by 55 rows?
5) When trying to modify the example code, I produced a spectrogram that doesnt mesh to the plot its in. Is that fixable? (see plot image)

Finally, I just want to say thanks to the author of Qwt. I think its an awesome toolbox, and I've been using it for years (finally upgrading from version 0.4.1 to 5.0.2!)

Uwe
2nd April 2011, 16:30
I recommend to try Qwt6 ( from SVN trunk ) and check QwtMatrixRasterData. The rasterview examples shows how to use it.

Uwe

Ronayn
4th April 2011, 17:36
Thanks very much. I will download and examine the example. I am not sure though if I can use Qwt6 with my system (the version of QT I am using is set in stone), but I will figure something out.

Ronayn
22nd April 2011, 14:23
I've download Qwt6 and have been working on understand QwtMatrixRasterData. While I can create a single spectrogram with it using preloaded data, I cant seem to update (change) it with new data. Do I have to delete the instance of QwtMatrixRasterData and create a new one each time I want to update my plot? Or do I delete the spectrogram and recreate that and then the QwtMatrixRasterData?

:confused:

Uwe
25th April 2011, 20:14
At least you have to invalidate the cached image, when you change your data behind the back of your spectrogram item.

See http://qwt.sourceforge.net/class_qwt_plot_raster_item.html#a547ce4d8d031b2302 26cfbd509ef65b5

Uwe