Results 1 to 4 of 4

Thread: Resolution Spectrogram

  1. #1
    Join Date
    Oct 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Resolution Spectrogram

    I have a spectrogram, and i want change the resolution of initRaster.
    how can i do this ???
    i would want see a example of initRaster implementation.
    sorry im not good with write english im from brazil

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

    Default Re: Resolution Spectrogram

    I have a spectrogram, and i want change the resolution of initRaster.
    The whole things works like this: the spectrogram item calculates the position for each pixel it needs to paint in scale coordinates and requests a value for it from the data object. Your data object (derived from QwtRasterData) has to calculate and return a value. Of course your matrix won't have a value at the requested position, so your data object needs to do something that is called resampling. The most simple algorithm for resampling is returning the value of the next neighbour, but you could also return an average value from all neigbours or whatever you want.

    QwtRasterData::initRaster tells your data object about the raster that is used for the next image composition. It can be used to prepare the resampling algorithm f.e. if you have values for the elevation in Brazil in different resolutions stored in files and you know that the values will be requested for your home town in a resolution of 100x100 m you can load the right values into memory in advance. If you don't have anything to initialize you don't need to implement YourRasterData::initRaster/discardRaster. ( It makes no sense to call initRaster() from your application. )

    You should implement YourRasterData::boundingRect() to avoid requests for pixels, where you don't have any values. By implementing YourRasterData::rasterHint() you can avoid, that the image resolution is much higher than the resolution of your raster - but this is for performance reasons only. ( And of course you need to implement YourRasterData::value() )

    And note: don't try to control the raster of the image - you always have to resample !

    Uwe

  3. #3
    Join Date
    Oct 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Resolution Spectrogram

    Sorry again I couldnt explain it

    I have a file with 100 points, each point has the coordinates x, y and elevation.
    I wanted to make a spectrogram based on these 100 points.
    I would like to control the resolution of the spectrogram and I thought it would
    be done using the function initRaster, as suggested by the documentation:

    void QwtRasterData: initRaster (const QwtDoubleRect &,const QSize & raste) [Virtual]

    Initialize the raster.

    Before the composition of an image calls QwtPlotSpectrogram initRaster, Announcing the area and Its Will Be That resolution requested.

    Implementation The default does nothing, But is That data sets are stored in files, It Might Be good idea to reimplement initRaster, Where the date is resampled and loaded into memory.


    I could not even understand how the (value) function works, what the function that inserts values in x and y?, How do I change the pitch between each value of x and y ???
    virtual double QwtRasterData:: value (double x, double y) const [pure virtual]

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

    Default Re: Resolution Spectrogram

    Quote Originally Posted by edney View Post
    I would like to control the resolution of the spectrogram and I thought ...
    And once more: you can't - it's the resolution of the target device ( f.e your monitor or printer ) that counts ! And once more: you always have to resample !

    Why don't you start with a simple raster data object using a next neighbour algorithm (rounding x,y to the steps of your data resolution) in YourSpectrogram::value() - of course adding an implementation of rasterHint() later makes much sense for a 10x10 matrix.

    You are not the first one completely missing how the raster data object works. Maybe it helps to recall that all virtual methods are called from the spectrogram item to support the process of rendering an image in screen resolution. You have to implement these virtual methods, but you will never call them from your application code.

    Uwe

Similar Threads

  1. Incremental Spectrogram...
    By uppu in forum Qwt
    Replies: 11
    Last Post: 13th April 2011, 13:47
  2. Spectrogram data resolution...
    By uppu in forum Qwt
    Replies: 4
    Last Post: 9th December 2009, 10:13
  3. get min and max value from spectrogram
    By rambo83 in forum Qwt
    Replies: 1
    Last Post: 2nd December 2009, 14:25
  4. zoomer in spectrogram example
    By rambo83 in forum Qwt
    Replies: 0
    Last Post: 1st December 2009, 09:06
  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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.