HDF5 image creation in h5py

407 views
Skip to first unread message

Wendell Mendell

unread,
Feb 12, 2013, 12:27:23 PM2/12/13
to h5...@googlegroups.com
Does h5py have commands to make HDF5 images via the H5IM API?  If so, how can I find the equivalent of create_image, make_palette, etc?  Without those commands, I assume that one must manually create a dataset that meets the Image Specification.  I want to make false color maps of remote sensing data sets.

Andrew Collette

unread,
Feb 12, 2013, 1:17:43 PM2/12/13
to h5...@googlegroups.com
Hi Wendell,
No, h5py does not include access to the H5IM API. I have often though
that we should have a plugin system for this sort of thing, but at the
moment you are correct that you'll have to do it manually.

Andrew

pi...@delmic.com

unread,
Feb 15, 2013, 5:21:43 AM2/15/13
to h5...@googlegroups.com


Op dinsdag 12 februari 2013 18:27:23 UTC+1 schreef Wendell Mendell het volgende:
Does h5py have commands to make HDF5 images via the H5IM API?  If so, how can I find the equivalent of create_image, make_palette, etc?  Without those commands, I assume that one must manually create a dataset that meets the Image Specification.  I want to make false color maps of remote sensing data sets.

Hi,
It's a funny coincidence, I've just opened an issue on this:
 https://github.com/h5py/h5py/issues/268

It contains a basic implementation to create an image dataset. However it only supports truecolor and greyscale images (i.e., the easy ones). Anyway, it might be a basis for you :-)

See you,
Éric

Wendell Mendell

unread,
Mar 3, 2013, 2:40:19 PM3/3/13
to h5...@googlegroups.com
Éric,

I want to use your command to create a Truecolor image from an array of values.  I am a novice at h5py and need a little help. I can create an HDF5 file (MyFile) and I can create group in that file (group1). I have a 350x450 array in memory (arr). The values in arr will be the data set.  I can create a data set within group1 from arr (arrset).  Now I want to use your command to produce an image. The value of the first argument is <group1>. The value of the second argument is <arrset>. The 3rd argument seems to be the name of an image within group1. Is the value of the 3rd argument just a name that will be attached the new image within group1?

I have already created images using the PIL module, but the process requires definition of an RGB color palette and the construction of a new array from the data where the data values have been mapped onto the values of the palette via a histogram process. It is not difficult but does require choice of colors in the palette and some decision as to how the data values will be binned into palette color categories. 

Wendell Mendell

Sent from my iPad
--
You received this message because you are subscribed to the Google Groups "h5py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h5py+uns...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

pi...@delmic.com

unread,
Mar 14, 2013, 10:55:07 AM3/14/13
to h5...@googlegroups.com
Hi Wendell

(Sorry for the late reply, apparently I was not subscribed to this thread)

The usage of create_image_dataset() should be similar to create_dataset(). So the second argument is the name of the dataset (image) in the group. It should not yet exist, or the function will complain. The third argument is the data itself (an array or numpy array). The other arguments are optional settings (e.g., compression type) Typically I call it like this:
ids = create_image_dataset(group1, "Image", arr)
ids is the new dataset.

Best,
Éric
Reply all
Reply to author
Forward
0 new messages