ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save HDF image in LabVIEW

Solved!
Go to solution

Hi,

would like to store some image data from a 2D-Picture control to an HDF file using the marvelous Live HDF5 package. However, I was not able to save the data in such a way that HDFView recognizes them as "Image" datatype. I tried writing the attributes CLASS, IMAGE_VERSION, IMAGE_SUBCLASS etc along the 2D array of data but still it is only considered as a table in HDFView. How can I set the data type to be "Image"?

 

Thanks a lot

 

Peter

0 Kudos
Message 1 of 8
(4,925 Views)

The Picture data is a 2D array of something, right?  Simply "wrap" it in whatever the HDF5 format requires (or hand it to a routine that will do this wrapping for you) and you'll be done.  If you do a Web search for HDF5 LabVIEW, you might find some examples that purport to do this wrapping ...

 

Bob Schor

0 Kudos
Message 2 of 8
(4,876 Views)

I am not familiar with the HDF5 package you are using since I rolled my own a long time ago, but it does work with LV images pretty easily.  As long Live HDF5 includes both hdf5.dll and hdf5-hl.dll then just find the wrappers for the following functions.

 

Create24bitImageDataset.pngHDFView.png

Otherwise post your attempt at an HDF5 file and I will try to find what is missing.  You'll probably have to zip it.

Message 3 of 8
(4,862 Views)

Thanks a lot. I tried to store the data as you suggested but the H5IMmake_... function always returns the -1 error. Attached you find my VI and the created hdf5 file. Any clue what I'm doing wrong?

Peter

Download All
0 Kudos
Message 4 of 8
(4,847 Views)

My HDF5 code is in LV15, please save your VI for that version.

 

Also, post one of the files that HDFView shows as a table.

0 Kudos
Message 5 of 8
(4,837 Views)

I attached the LabVIEW-VI saved for LV15. Might it be that you are using an other version of the hdf5 dll set?

Peter

0 Kudos
Message 6 of 8
(4,823 Views)
Solution
Accepted by topic author pegli

As I suspected, just a couple of quick datatype tweaks on the CLFN, the width and height are U64 and the image data is [U8].

 

hdfview.png

Message 7 of 8
(4,818 Views)

Darin, thank you so much for the fixed VI. It works perfectly!

Now, I changed the VI in such a way that it integrates with the file open/close stuff from Live HDF5 by UPVI and attached it to this post. Might be, that somebody wants to use it in conjunction with this specific HDF5 package as I do.

Peter

0 Kudos
Message 8 of 8
(4,800 Views)