
Access user drawed objects by programming code

flashbanger
i want to use Igor to analize some structures in an image. Therefore i am drawing some lines (more than 100 lines) onto a drawing layer with the line-drawing tool. Now i want to do some statistics on the lines for example calculate the length of the lines, crossing points, etc. Sadly i can't find any example how to do that and if it is even possible to for example to generate a wave which contains all coordinates of the user drawed lines so that i could analize the properties of each line in a loop.
Does anyone know how this can be done?
Best,
flashbanger
In your image graph, first specify the drawing coordinates to be the left (y) and bottom (x) axes, with whatever line appearance you wish.
Draw all your lines.
Exit drawing mode, and create the graph recreation macro. In that macro each line drawing command will look like:
DrawLine -0.778770949720671,-0.385988483685221,0.489385474860335,0.550671785028791
Save the macro in a Notebook, and then save the Notebook as a text file.
Load and parse the text file to extract the numerical data following each "DrawLine" string, converting each pair vertex string into two numerical N=2 x-waves and y-waves (or use a multidimensional wave to accumulate all the data). (You may also try to parse and extract the data directly from the Notebook, without saving an external file.)
The main idea is to use the recreation macro to access the drawing data. Subsequent processing will be your burden. I hope someone else may suggest an easier approach.
April 19, 2018 at 09:32 am - Permalink
Drawing that many lines using drawing tools can get old pretty quickly and the result is not ideal for further processing. On the other hand, if you use a pair of waves say YYY plotted vs. XXX and edit these curves (possibly adding NaNs where you want to end a segment), leaves you with numeric representation in a coordinate system that matches the image. You can also pre-populate the wave programmatically (especially the NaNs). To find out more about this execute
I hope this helps,
A.G.
WaveMetrics, Inc.
April 19, 2018 at 10:18 am - Permalink
April 19, 2018 at 10:56 am - Permalink