LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Draw 1D Array

Hello, I have 1D array of image data to display.

 

I think I should use Draw Flattened Pixmap to display it. (If there is a better way I'm listening!)

 

However, I need to convert my 1D array to a Labview image data cluster (along with the other data required for this cluster).

 

I can't find a library function to bundle the data into this cluster / typedef, nor can I find an example that shows me the "syntax".

 

Stuck!! How do I proceed? Anyone know an example to follow?

 

Thanks again for your help.

 

Gunter

 

0 Kudos
Message 1 of 9
(3,269 Views)

First you need to know the format of the 1D array of image data.  Is it a string array, a boolean array, a numeric array of some kind, or an array o clusters of some kind?  What does each array element represent?  Where are you getting the array of image data?  I need to know what your trying to convert FROM before I can even try to give you an idea of how to do the conversion.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 2 of 9
(3,253 Views)

First you need to know the format of the 1D array of image data.  Is it a string array, a boolean array, a numeric array of some kind, or an array o clusters of some kind?  What does each array element represent?  Where are you getting the array of image data?  I need to know what your trying to convert FROM before I can even try to give you an idea of how to do the conversion.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 3 of 9
(3,252 Views)

What is the format of the data? Is it actually 2D data stored in a 1D array?

 

You may want to work through some LabVIEW tutorials to get the basics. To bundle the image into a cluster, you should use the "bundle by name" or "bundle" functions in the cluster palette. You can right-click the Image Data terminal of Draw Flattened Pixmap to get a cluster constant of the correct type. Wire that to the middle terminal of Bundle By Name, and then wire your array and other data to the cluster elements. If your image is actually 2D, you can use reshape array to convert it to 2D. The LabVIEW help may be useful.

0 Kudos
Message 4 of 9
(3,244 Views)

Hello again Nathan and Hello Kelly, 

 

The image data comes from a DLL, via Labview's MoveBlock() function.

 

Its a 2D image packed in a 1D array of length width*height length; its 32bit integers of packed 8:8:8 RGB data. The MSB is zero'ed. IIRC from my reading Friday Labview knows this packing so at least I don't need to unpack.

 

I've been through tutorials and understand Labview clusters.

 

What I can't find any information about is how to cluster raw data into a predefined labview typedef, in this case "imagedata". For example if I use "cluster by name" and make all the inputs to the block those required by imagedata, will Labview magically know that this is an imagedata typedef? (If so where can I find the exact names required for the typedef?)

 

(or maybe there's a better way)

 

Thanks again for everyone's help.

 

Gunter

0 Kudos
Message 5 of 9
(3,206 Views)

Hi Gunter,

 

To address your final question in your last post - if you right click the terminal and 'create -> constant' this will create a cluster with the correct typedef (even if it is a LabVIEW built-in typedef or otherwise) - which is basically what nathand suggested (having read it after posting!). You can then use that as the input to the 'bundle by name' node and wire in your elements to that.

 

See image below:

 

30-09-2013 15-58-49.png


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 9
(3,186 Views)

gmhgmh wrote:

What I can't find any information about is how to cluster raw data into a predefined labview typedef, in this case "imagedata". For example if I use "cluster by name" and make all the inputs to the block those required by imagedata, will Labview magically know that this is an imagedata typedef? (If so where can I find the exact names required for the typedef?)


The approach demonstrated by Sam_Sharp is easiest. However, for the sake of completeness: you can wire clusters containing compatible data together. You don't need to match the names of the cluster elements; all that needs to match is the data types and order. If LabVIEW can coerce the data to the correct format, then it will let you wire the cluster to the terminal, although it might show a small dot (a "coercion dot") indicating that the types do not match precisely. Normally you can ignore that dot, especially when it's just coercing a non-typedef to a typedef that are otherwise identical. If LabVIEW cannot coerce the data, then you get a broken wire. LabVIEW don't need to "magically know" that it's image data, it just needs data that matches the expected type.

0 Kudos
Message 7 of 9
(3,178 Views)

Thanks again everyone.

 

Is there some order in which I have to draw the blocks as shown by Sam_Sharp? No matter what I try I get unconnected wire errors.

 

(But I have things working with draw unflattened pixmap which didn't need a structure.)

 

Thanks again,

 

Gunter

 

 

 

0 Kudos
Message 8 of 9
(3,148 Views)

If you just have bits of a wire dangling off somewhere unconnected but everything else is right, delete that unnecessary wire section (I'm not quite sure why LabVIEW doesn't do this automatically). It shouldn't matter what order you do the operations in, although you need to put the Draw Flattened Pixmap in place first in order to be able to create a constant from one of its terminals. If you show a screenshot of your specific problem it will be easier to explain the error.

0 Kudos
Message 9 of 9
(3,126 Views)