Results 1 to 4 of 4

Thread: [Spectrogram Example] Visualisation of double[11][11] array

  1. #1
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question [Spectrogram Example] Visualisation of double[11][11] array

    Hello everyone,

    This is my first post on the forums. I've lurked on a few threads trying to understand how the Qwt spectrogram example can take data, but I can't get my head around QwtRasterData.

    Qt Code:
    1. class SpectrogramData: public QwtRasterData
    2. {
    3. public:
    4. SpectrogramData():
    5. QwtRasterData(QwtDoubleRect(-1.5, -1.5, 3.0, 3.0))
    6. {
    7. }
    8.  
    9. virtual QwtRasterData *copy() const
    10. {
    11. return new SpectrogramData();
    12. }
    13.  
    14. virtual QwtDoubleInterval range() const
    15. {
    16. return QwtDoubleInterval(0.0, 10);
    17. }
    18.  
    19. virtual double value(double x, double y) const
    20. {
    21. const double c = 0.842;
    22.  
    23. const double v1 = x * x + (y-c) * (y+c);
    24. const double v2 = x * (y+c) + x * (y+c);
    25.  
    26. return 1.0 / (v1 * v1 + v2 * v2);
    27. }
    28. };
    To copy to clipboard, switch view to plain text mode 

    My data is an 11x11 array (double data[11][11];). Each entry is depicting a 1x1cm^2 area from a detector. How could I modify the spectrogram example to display my data?

    Secondary: Would there be a way to disable interpolation?

    Thank you.


    Mr_Cloud

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

    Default Re: [Spectrogram Example] Visualisation of double[11][11] array

    You are looking for QwtMatrixRasterData - the rasterview example shows how to use it.

    Uwe

  3. #3
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [Spectrogram Example] Visualisation of double[11][11] array

    Dear Uwe,

    Which rasterview example are you referring to?


    Mr_Cloud

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

    Default Re: [Spectrogram Example] Visualisation of double[11][11] array

    Quote Originally Posted by Mr_Cloud View Post
    Which rasterview example are you referring to?
    http://qwt.svn.sourceforge.net/viewv...les/rasterview

    You find it also in your tarball in the examples directory - like all examples. If it is not there you have probably a Qwt 5.x tarball ?

    Uwe

Similar Threads

  1. Cast QString array to std::string array
    By Ishtar in forum Newbie
    Replies: 4
    Last Post: 15th July 2011, 09:28
  2. Program not finding an existing double in a QList<double>
    By aarelovich in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2011, 21:59
  3. read a .txt file and store it in a double array
    By fatecasino in forum Newbie
    Replies: 5
    Last Post: 3rd December 2010, 21:13
  4. Replies: 2
    Last Post: 12th November 2010, 15:42
  5. declare an array of QSemaphore and array of slot functions
    By radeberger in forum Qt Programming
    Replies: 11
    Last Post: 2nd May 2010, 14:24

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.