Puzzled by ImageInterpolate

Hi - I am having some problems with the outcome of the ImageInterpolate command (see attached file).
I have 3 waves (the xwave, ywave, zwave) and I initially created a contour plot with them (image on the left in the attached file). At this point, I wanted to interpolate the data of the contour plot and create a smooth image plot. I have tried various types of linear interpolations (passing through Interpolate2/T, XYGridandZtoMatrix, XYZtoMatrix, ImageInterpolate/S), but what I get is a very pixelated image (image on the right in the attached file) and sometimes the outlines of the interpolation do noto follow the outlines of the contour plot. As you can see, my data are displayed as a log-log plot, but I am still confused as to whether this contributes to the weird look of my images. I have looked at similar posts but seem to be unable to find a solution. Thanks!
contour and image plot.pdf (11.21 KB)
Hello Annalisa,

It is difficult to give you a definitive answer without having access to the data but I suspect the issue here is that you are expecting an interpolation in log scaled data while ImageInterpolate splits the range that you specify with the /S={...} flag into equal (rectangular intervals) in linear space.

As I see it, you have two choices: one is to use /S flag with dx, and dy that correspond to the smallest interval size that you wish to have in log scale. This may require very dense sampling. The second solution is for you to write a function that uses contourZ() and then you are free to interpolate anywhere you want within the convex domain defined by your data.

If you are not sure how to proceed feel free to send us an IGOR experiment with this data set.

A.G.
WaveMetrics, Inc.
Hi there – I have tried using the /S flag with small dx values but, as you mentioned, this ends up taking a very long time and I still have the problem of the image colors being distributed very differently than the contour lines. I have not been successful with the ContourZ command either, so at this point it seems best to share some example data. Is there something wrong with my data set? Thanks a lot.
Annalisa_contour puzzle.pxp (102.51 KB)
Hello Annalisa,

Annalisa Scimemi wrote:
Hi there – I have tried using the /S flag with small dx values but, as you mentioned, this ends up taking a very long time and I still have the problem of the image colors being distributed very differently than the contour lines. I have not been successful with the ContourZ command either, so at this point it seems best to share some example data. Is there something wrong with my data set? Thanks a lot.


To investigate this I executed:
concatenate {xwave,ywave,zwave}, tripletwave
NewGizmo; ModifyGizmo ShowInfo
AppendToGizmo DefaultScatter=root:Graph0:tripletwave,


This shows me that your data consist of multiple samples that are effectively clustered at the four corners of the XY domain with relatively large variations in the z-values at inside each cluster.

I then executed:
ImageInterpolate/S={-5,0.1,15,-50,1,1000} voronoi tripletwave


This is not very high resolution but should give me an idea about possible issues. Note that I went outside the convex domain of the data to be sure I am not missing anything. To add this to the Gizmo plot:
AppendToGizmo nextSurface=root:Graph0:M_InterpolatedImage


At this point you can display M_InterpolatedImage as an image and use log scale axes. You should expect to have some NaNs in the display as a result of exceeding the boundary in the /S flag above. Overall I do not see a major problem here as long as you control the resolution of your image with the dx, dy parameters of the /S flag.

I hope this helps,

A.G.
WaveMetrics, Inc.

Hi - yes, I understand that the pixelation that I was mentioning can be resolved with the dx,dy values of /S.

However, I still cannot explain the fact that the interpolated image does not look like what I would have expected from the contour plot. In the example exp that I sent out, you can see that the contours define 6 concentric sections (<1.5; 1.5-2; 2-2.5; 2.5-3; 3-3.5; >3.5). I was expecting that, with the image interpolation, I would have obtained an image with the same sections described above, not separated by lines (as in the contour plot) but by color gradients. I am essentially trying to obtain an image interpolation of the contour plot.

Thanks,
Annalisa
Annalisa Scimemi wrote:

However, I still cannot explain the fact that the interpolated image does not look like what I would have expected from the contour plot. In the example exp that I sent out, you can see that the contours define 6 concentric sections (<1.5; 1.5-2; 2-2.5; 2.5-3; 3-3.5; >3.5). I was expecting that, with the image interpolation, I would have obtained an image with the same sections described above, not separated by lines (as in the contour plot) but by color gradients. I am essentially trying to obtain an image interpolation of the contour plot.


I'm not sure these are concentric sections but then again I can't tell from your graph.

If you follow my directions above and after displaying the image you can add a contour using:
AppendMatrixContour M_InterpolatedImage


you should get contour lines that cover the range of interpolation. Alternatively, if you want to see more detail in your original contour you can execute:
ModifyContour zWave interpolate=1


If you think there is something obvious that I am missing here please contact support@wavemetrics.com so we can resolve this promptly.

A.G.
WaveMetrics, Inc.