LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

xy graph to boolean array

Solved!
Go to solution

hi there,

iam struggling with a little a problem here ... what iam trying to do is basically convert a xy graph to a boolean array (doesnt matter if it's graphic or tabular)

i've made a sketch in photoshop so it's easier to understand.

 

xy graph:                                                                                     boolean array:

xy-graph.png

boolean-array.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

any idea on how to do this?

 

kind regards,

oli

0 Kudos
Message 1 of 11
(5,178 Views)
Solution
Accepted by topic author re-fuse

Initializ a boolean array of the desired dimension and put it in a shift register. iterate over the xy pairs, map the coordinates to array indices, and use replace array subset to turn the LED ON at that index. Repeat for all points.

 

(If the points are relatively far apart and you need to create interpolation lines, you would add a little bit more code)

 

Message 2 of 11
(5,167 Views)

Here's my attempt.

 

Cheers

2015-07-31 10_58_24-Untitled 1 Front Panel on ABT.lvproj_My Computer rev. 0 _.png

Message 3 of 11
(5,124 Views)

thx guys!!

the answer was pretty obvious 🙂

 

but now iam stucked with the next problem .. i want to floodfill (set TRUE) everything within the shape. i've attached the code for the floodfill.

 

 

program.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

it works well with simple figures like a rectangle ... but not with bended figures. any idea why?

 

edit: i can't attach the vi ... it says "The attachment's FloodFill.vi content type (application/octet_stream) does not match its file extension and has been removed." 😞

0 Kudos
Message 4 of 11
(5,028 Views)

@re-fuse wrote:

 

 

program.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

it works well with simple figures like a rectangle ... but not with bended figures. any idea why?

 

edit: i can't attach the vi ... it says "The attachment's FloodFill.vi content type (application/octet_stream) does not match its file extension and has been removed." 😞


1. You really should learn about Autoindexing Tunnels.  They will simplify your loop since you will not need the Array Size or the Index Array.

2. The attaching the VI is a common issue on these forums.  Put your code in a zip file and attach that as an alternative.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(5,016 Views)

Zip the VI up or use a different browser. Is floodfill from a toolkit or your own code? Please attach that too.

 

  • Why don't you simply operate on the boolean 2D array directly?
  • What is the point of the green color if you convert back to a boolean array?
  • What is the raw data of the xy graph? Why aren't these integers?
  • Where is the control/indicator of the local variable and where does it get it's value?
  • Yes, use autoindexing. No need to get the size, no need to wire N, and no need for "index array".
0 Kudos
Message 6 of 11
(4,983 Views)

Thanks for the hint with autoindexing! Much easier indeed 🙂

 

To get an idea what the VI is all about:

I want to write waveguide structures (via electron beam) onto a wafer (semiconducting material) based on Bezier curves made in Inkscape.

These Curves are loaded into Labview, then there's a SubVI to calculate a graph (x/y pairs) based on this structure.

This array then needs to be transformed into a 2D boolean array to pass it on to the AD converter.

 

  • Why don't you simply operate on the boolean 2D array directly

The Floodfill VI is from somebody on this forum and he wrote it for a 2D picture array of unsigned long integer ... so i had to convert it there and back.

Actually the Floodline VI works well with bended figures, but just small ones. It takes an awful while with big figures.

Therefore i'd prefer the scanline algorithm but it's much harder to implement in Labview.

 

  • What is the point of the green color if you convert back to a boolean array?

There is actually no point 😄

 

 

  • What is the raw data of the xy graph? Why aren't these integers?

They aren't integer cause i need the the x/y pairs to be pretty precise (about 5 decimal places).

 

  • Where is the control/indicator of the local variable and where does it get it's value?

You mean the "Iteration Points"? That comes from the user and defines how fine/sharp (decimal places) the calculation of the x/y graph will be.

 

 

0 Kudos
Message 7 of 11
(4,896 Views)

hi altenbach,

 

unfortunately iam still stucked ...

 

the x/y values of the figure have 5 decimal places but using your method (via replace array subset) it only takes the value before the decimal point.

so no matter how precise or how many xy pairs describes the figure in the xy graph the figure in the 2D boolean array stays the same.

 

got any idea on how to solve this problem?

 

the actual reason why i convert the xy graph to a 2D boolean array is to fill the figure with equidistant points.

i've found no method to do this in a xy graph.

 

here's the actual code + floodfill.zip:

lv4.png

 

many many thanks in advance!! you guys are so much help 🙂

0 Kudos
Message 8 of 11
(4,835 Views)
You simply need to map the values into a sufficiently large range of integers. Then set x0 and dx of the graph accordingly.
0 Kudos
Message 9 of 11
(4,810 Views)

you mean by multiplying the xy values by the amount of decimal places?

and then channeling them into the array subset function?

 

0 Kudos
Message 10 of 11
(4,797 Views)