Results 1 to 4 of 4

Thread: Qwt spectrogram value() method vs setValueMatrix

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2015
    Posts
    4
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qwt spectrogram value() method vs setValueMatrix

    Thanks for the reply Uwe. I got the waterfall working using the value method. What im doing is add my data to a buffer and shift out the old data with the new samples, this gets the waterfall scrolling nicely. The only problem is it slows down my system quite a bit, the gui becomes less responsive. I think its because the entire waterfall is being redrawn from scratch every time the value method is called. Is there a way i can shift the current waterfall by one pixel and only draw the last line? The buffer is about lengthXheightXsizeof(double)=1024x200x8=1.6MB big. Is this too much data?

    This is my QwtRasterData::value() method implementation.

    Qt Code:
    1. double WaterfallData::value(double x, double y) const
    2. {
    3. double returnValue = -90.0;
    4.  
    5.  
    6. double height = interval(Qt::YAxis).maxValue();
    7. double left = interval(Qt::XAxis).minValue();
    8. double right = interval(Qt::XAxis).maxValue();
    9. double ylen = static_cast<double>(_historyLength-1);
    10. double xlen = static_cast<double>(_dataPoints-1);
    11. const unsigned int intY = static_cast<unsigned int>((1.0 - y/height) * ylen);
    12. const unsigned int intX = static_cast<unsigned int>((((x - left) / (right-left)) * xlen) + 0.5);
    13.  
    14. const int location = (intY * _dataPoints) + intX;
    15. //ensure location is valid
    16. if((location > -1) && (location < WATERFALL_AREA)){
    17. returnValue = _waterfallDataBuffer[location];
    18. }
    19.  
    20. return returnValue;
    21. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by earless; 12th February 2015 at 21:25.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt spectrogram value() method vs setValueMatrix

    The buffer is about lengthXheightXsizeof(double)=1024x200x8=1.6MB big. Is this too much data?
    For the image composition the size/resolution of the target paint device ( in your case the size of the plot canvas ) is a maximum. Guess in your case the resolution of your data is way below that and you should implement the QwtRasterData::pixelHint() method.
    Considering a canvas of 1200x1200 pixels the loop ( calling value() in each iteration ) would be reduced from 1444000 to 204800 for your data. How much effect you will have of course depends on the geometry of your canvas, but in this example only 15% of the loop would be left ( In case of using QwtMatrixRasterData the pixelHint method is provided automatically ).

    Is there a way i can shift the current waterfall by one pixel and only draw the last line?
    Sure by overloading renderImage(). But I don't have the details before having tried this myself - that's why I will implement such an example some day.

    Uwe

Similar Threads

  1. QWT Spectrogram
    By iamzen in forum Qwt
    Replies: 2
    Last Post: 29th March 2012, 20:31
  2. Calling a method from a non-member method
    By AndresBarbaRoja in forum Newbie
    Replies: 5
    Last Post: 19th March 2011, 10:38
  3. Replies: 1
    Last Post: 25th November 2010, 11:37
  4. get min and max value from spectrogram
    By rambo83 in forum Qwt
    Replies: 1
    Last Post: 2nd December 2009, 14:25
  5. qwt spectrogram example
    By rambo83 in forum Qwt
    Replies: 2
    Last Post: 17th November 2009, 21:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.