Extract contour waves using a function?
| s.r.chinn | April 4, 2012 - 07:16 | ||
|---|---|---|---|
|
From a function, I want to automate a curve-fitting procedure on a contour's wave. I know that As an alternative the Manual suggests
Since I created the custom contour level , I think I can construct the necessary instance name to use in a function. However, after I created a test image with contours, this folder was nowhere to be found. If it is temporary, how can it be accessed? I would appreciate any suggestions. |
|||

Joined: 2007-06-29
Location: United States
The heart of the Extract Contours As Waves procedure file is the function WMDuplicateTraceWave(). It uses TraceNameToWaveRef and XWaveRefFromTrace to get wave references for the underlying hidden waves that define a contour trace. It then uses the wave references to duplicate those waves to create non-hidden waves. The trick is to get the right name for the trace at the contour level you want. You can make that job a little easier using the /F=formatStr with AppendMatrixContour or AppendXYZContour to specify the format of the contour line naming.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Joined: 2007-08-16
Location: United States
John,
Thanks for your help. I initially thought I had solved the problem with the following example:
The new contour level was added to the Graph0 image plot, and the new extracted contour waves appeared in the Data Browser. However, these new waves each had 0 points. What did I do incorrectly?
Joined: 2007-06-29
Location: United States
It's the old gotcha- you need DoUpdate right after ModifyContour. Igor doesn't actually compute the values of the contour until it redraws the graph.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Joined: 2007-08-16
Location: United States
Thanks, John. Replacing 'DelayUpdate' with 'DoUpdate' in the above example fixed the problem.
I was confused in the application of the AppendMatrixContour help file contents:
This test example was somewhat artificial. However, fitting a contour shape of real data can be useful.
Joined: 2007-06-29
Location: United States
That is a tad confusing, isn't it. That bit would apply to a Procedure (that is, something declared as Macro or Proc or Window, etc.). The key is that interpreted code actually does an update between lines, so the default contour plot would be produced right away. In a Function, updates are suppressed so that explanation doesn't apply.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com