comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Reading various HDF files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Reading various HDF files [message #46198] Wed, 09 November 2005 05:35 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nicola writes:


> Actually for the moment I've tried only to read each sds and then to
> extract the let's call 0-zplane. I did not tried for the moment start
> and count which will be me reading just one plane and so I can divided
> for 8 the computational time. I will try..and also I will try mpeg_put
> (although I was not succesfully in creating mpeg file with IDL up to
> now :-( )

Is that because you haven't asked for the free MPEG license? :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Reading various HDF files [message #46199 is a reply to message #46198] Wed, 09 November 2005 05:19 Go to previous messageGo to next message
Nicola is currently offline  Nicola
Messages: 21
Registered: November 2005
Junior Member
Actually for the moment I've tried only to read each sds and then to
extract the let's call 0-zplane. I did not tried for the moment start
and count which will be me reading just one plane and so I can divided
for 8 the computational time. I will try..and also I will try mpeg_put
(although I was not succesfully in creating mpeg file with IDL up to
now :-( )
thank's a lot
n
Re: Reading various HDF files [message #46200 is a reply to message #46199] Wed, 09 November 2005 05:11 Go to previous messageGo to next message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Hi Nicola,

well, it's all there, then. Haven't you used the SDS, START and COUNT
keywords to sds_read yet?

In your case, I'd loop over the files with a command like

sds_read, files[i], $
sds = "the_field_you_want_to_extrasct", $
start = [0, 0, 8], $
count = [64,128, 0], $
data

Then data should be just the field's plane you need for further
processing with e.g. MPEG_PUT.

Cheers,

Peter
Re: Reading various HDF files [message #46201 is a reply to message #46200] Wed, 09 November 2005 04:35 Go to previous messageGo to next message
Nicola is currently offline  Nicola
Messages: 21
Registered: November 2005
Junior Member
Hi Peter
thank you for your reply. I forgot to mention that the data are save in
HDF4 format. Normally I used the routine sds_read (from Liam Gumley)
but of course if there are some other methods I can use them.
hear your soon
Nicola
Re: Reading various HDF files [message #46202 is a reply to message #46201] Wed, 09 November 2005 03:37 Go to previous messageGo to next message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Hi Nicola,

first of all we need to know whether the files are in HDF4 or HDF5, as
the data structure and thus the routines for reading differ berween the
two. I guess you can't avoid looping over all the files, but of course
you don't have to read each file completely. For HDF4 and HDF5 there
are options to read only individual datasets. In therory it should also
be possible to extract just the one plane, but I never did that.

Cheers,

Peter
Re: Reading various HDF files [message #46277 is a reply to message #46199] Thu, 10 November 2005 11:46 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
I don't want to complicate things but forget about MPEG. MPEG is most
often a lousy format for scientific animations. I would suggest writing
all of your frames to disk as individual .png files then using another
program to create the animation.

For 8-bit animations, it's tough to beat the FLI/FLC format. Rich
Signell has a page with all you need to know to get started with FLI/FLC
format at: http://woodshole.er.usgs.gov/operations/modeling/flc.html

For 24-bit animations it is a bit more complicated as there are a number
of encoder/decoders out there. I would be happy to advise further if
you want to go this route.

If you just want to stick with MPEG, understand that most MPEG players
only support certain frame sizes and bit rates so to ensure
compatibility you need to stick to them. For frames sizes, I would
stick with D1 (704x480 or 720x480), half D1 (352x480), and quarter D1
(352x240). MPEG-2 will give you better overall quality vs file size but
not all media players play MPEG-2 content (for example, Windows Media
Player requires a special plug-in). MPEG-1 is widely compatible but you
are limited in maximum bit-rate (1856 kbps) and quality vs file size
isn't as good as MPEG-2.

-Rick

Nicola wrote:
> Actually for the moment I've tried only to read each sds and then to
> extract the let's call 0-zplane. I did not tried for the moment start
> and count which will be me reading just one plane and so I can divided
> for 8 the computational time. I will try..and also I will try mpeg_put
> (although I was not succesfully in creating mpeg file with IDL up to
> now :-( )
> thank's a lot
> n
>
Re: Reading various HDF files [message #46297 is a reply to message #46199] Wed, 09 November 2005 05:36 Go to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Well, it took me a while to create MPEGs, too, but here is my recipe:
First of all, I let mpeg_put read the individual frames from a direct
graphics window. So you have to subsequently display each frame in a
window.

; In order to get the dimensions right, I'd suggest to display the
first image e.g. like

window, 1, xsize = 600, ysize = 400
tv, data

; First, open the mpeg_file:

mpegID = mpeg_open( $
[!d.x_size, !d.y_s
filename = filename
motion_vec_length = 1, $
iframe_gap = 3, $
quality = 75 $
)

; With the images I wanted to put together, simply specifying
; QUALITY brought horrible results full of
; jpeg artefacts. With MOTION_VEC_LENGTH and
; IFRAME_GAP, everything is just fine. Increasing
; IFRAME_GAP gives better results, but you pay with longer processing
time.

; O.k., now for the individual frames, assuming that you have some code
for
; reading the i-th dataset

for i = 0, n do begin
data = read_the_data(i)
tv, data
mpeg_put, mpegID, $
window = !d.window, $
/color, $
frame = i, $
/order
endfor

; After all this, you have to close the file and let IDL do a lot of
compression:

mpeg_save, mpegID
mpeg_close, mpegID





That's it. In case you have only a small number of images to show, the
MPEG file will be short, given a framerate of 24 frames per second. In
that case you can just repeatedly add one and the same frame with a
second loop, but make sure to correctly count the frame number as
provided via FRAME = i. (i.e. use something like

for j = 0, nframes-1 do begin
f = i * (nframes) + j
...
... FRAMES = f, $
...
endfor


Cheers,

Peter

)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL 6.2 IDLgrImage SUB_RECT and TILING
Next Topic: Partial implementation of XML-RPC

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:27:41 PDT 2025

Total time taken to generate the page: 0.00499 seconds