LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change representation of array elements? (typecast?)

There must be a better way to convert an array of U16 (from an
unflattened picture object I loaded from a BMP file) to a floating
point array than what I've come up with: unwrapping the array,
converting each element, then building a new array! I also tried
array->cluster -> cluster convert U16 ToFloat -> array.

I can't find information on typecast - is this what I want? Where is
the "enum" definition that tells which constant to wire up to "type"?
It's not in the online help, it seems. And I couldn't find any array
conversion VI's that just change the base representation of each
element.

My ultimate goal is to load an image from disk, then display it in
various 3D ways (like a 3D graph, or contou
r, or wireframe, etc) and
apparently need the image data to be a float array to do this.

ANY advice appreciated in advance.

NO SPAM, PLEASE PLEASE!!!
Helen K

PS I have the IMAQ Vision package, the picture-control package, LabView
v6i

--

"I love deadlines. I like the whooshing sound as they fly by." - Douglas
Adams
0 Kudos
Message 1 of 6
(3,762 Views)
"Helen E. Kourous" schrieb im Newsbeitrag
news:39EDA934.C3D4427D@erim-int.com...
> There must be a better way to convert an array of U16 (from an
> unflattened picture object I loaded from a BMP file) to a floating
> point array than what I've come up with: unwrapping the array,
> converting each element, then building a new array! I also tried
> array->cluster -> cluster convert U16 ToFloat -> array.

Why so complicated?

Wire the array into the function "To Double Pecision Float". You
can find it in the function palette Numeric->Conversion.

> I can't find information on typecast - is this what I want?
You can also use typecast but that's not what you really should
use in this case.

>Where is
> the "enum" definition that tells which const
ant to wire up to "type"?
> It's not in the online help, it seems. And I couldn't find any array
> conversion VI's that just change the base representation of each
> element.
Typecast has a type input, so connect the type you need with the type
input.

> My ultimate goal is to load an image from disk, then display it in
> various 3D ways (like a 3D graph, or contour, or wireframe, etc) and
> apparently need the image data to be a float array to do this.
I don't understand why you need a conversion into floating point.


Martin


Martin Henz Systemtechnik
Dipl. Ing. (FH) Martin Henz
Walchensee Str. 3
70378 Stuttgart
Tel. ++49-711-5302605
Fax ++49-711-5058649
http://www.mhst.de
0 Kudos
Message 2 of 6
(3,762 Views)
In the "Numeric" palette there is a sub palette "Conversion". These
conversion function can be used with arrays too. So where is the
problem?

"Helen E. Kourous" schrieb:
>
> There must be a better way to convert an array of U16 (from an
> unflattened picture object I loaded from a BMP file) to a floating
> point array than what I've come up with: unwrapping the array,
> converting each element, then building a new array! I also tried
> array->cluster -> cluster convert U16 ToFloat -> array.
>
> I can't find information on typecast - is this what I want? Where is
> the "enum" definition that tells which constant to wire up to "type"?
> It's not in the online help, it seems. And I couldn't find any array
> conversion VI's that just change the base representati
on of each
> element.
>
> My ultimate goal is to load an image from disk, then display it in
> various 3D ways (like a 3D graph, or contour, or wireframe, etc) and
> apparently need the image data to be a float array to do this.
>
> ANY advice appreciated in advance.
>
> NO SPAM, PLEASE PLEASE!!!
> Helen K
>
> PS I have the IMAQ Vision package, the picture-control package, LabView
> v6i
>
> --
>
> "I love deadlines. I like the whooshing sound as they fly by." - Douglas
> Adams

--
Torsten Levin Tel.: ++49-(0)89-72495-451
Kayser-Threde GmbH Fax: ++49-(0)89-72495-291
Perchtinger Str. 3 mailto:TL@kayser-threde.de
D-81379 München http://www.kayser-threde.de
0 Kudos
Message 3 of 6
(3,762 Views)
d'oh! Aha! I just wrongheadedly didn't realize that the conversion vi's under
"numeric" could be used on arrays. I was hunting around in the "arrays"
palette. See, I knew there was a better way! Thanks! (Duh)


(and, doesn't the 3D graph need a float array input? Can one change that? the
help on the vi shows it as float array...?)

Torsten Levin wrote:

> In the "Numeric" palette there is a sub palette "Conversion". These
> conversion function can be used with arrays too. So where is the
> problem?
>
> "Helen E. Kourous" schrieb:
> >
> > There must be a better way to convert an array of U16 (from an
> > unflattened picture object I loaded from a BMP file) to a floating
> > point array than what I've come up with: unwrapping the array,
> > converting
each element, then building a new array! I also tried
> > array->cluster -> cluster convert U16 ToFloat -> array.
> >
> > I can't find information on typecast - is this what I want? Where is
> > the "enum" definition that tells which constant to wire up to "type"?
> > It's not in the online help, it seems. And I couldn't find any array
> > conversion VI's that just change the base representation of each
> > element.
> >
> > My ultimate goal is to load an image from disk, then display it in
> > various 3D ways (like a 3D graph, or contour, or wireframe, etc) and
> > apparently need the image data to be a float array to do this.
> >
> > ANY advice appreciated in advance.
> >
> -
> Torsten Levin Tel.: ++49-(0)89-72495-451
> Kayser-Threde GmbH Fax: ++49-(0)89-72495-291
> Perchtinger Str. 3 mailto:TL@kayser-threde.de
> D-81379 München http://www.kayser-threde.de

--

Helen E. Kourous

"I love deadlines. I like the whooshing sound as they fly by." - Do
uglas Adams
0 Kudos
Message 4 of 6
(3,762 Views)
Helen E. Kourous wrote in message
news:39EDB583.693A26BF@erim-int.com...
> d'oh! Aha! I just wrongheadedly didn't realize that the conversion vi's
under
> "numeric" could be used on arrays. I was hunting around in the "arrays"
> palette. See, I knew there was a better way! Thanks! (Duh)
>
>
> (and, doesn't the 3D graph need a float array input? Can one change that?
the
> help on the vi shows it as float array...?)

Many of the polymorphic inputs to Labview functions are not listed as type
POLY on the help- if in doubt just wire it and see. Many functions take
datatypes- including complex datatypes- that aren't immediately apparent.

I think though that the 3D graphs are accessed via a series of non-poly
subVIs (unless they
've been rejigged to be poly in v6) so you'll get the
"typecast" blob when you wire a U16 array to the 3D inputs.
0 Kudos
Message 6 of 6
(3,762 Views)
Is this just a plain 2D array of U16?

I've just created such an array, fed it through a "To Double Precision
Float" found under the "Numeric" palette and created a DBL indicator from
it, and as expected it looks like it works- certainly there's no broken
wires and I'm doing the operation on the entire array. You're obviously
aware of the conversion functions because you appear to be using them to
work element by element, so what am I missing here?

Helen E. Kourous wrote in message
news:39EDA934.C3D4427D@erim-int.com...
> There must be a better way to convert an array of U16 (from an
> unflattened picture object I loaded from a BMP file) to a floating
> point array than what I've come up with: unwrapping the array,
> converting each elemen
t, then building a new array! I also tried
> array->cluster -> cluster convert U16 ToFloat -> array.
0 Kudos
Message 5 of 6
(3,762 Views)