Hi Marco, 

In casacore a hyperslab is read from a dataset in the following way. 
It is part of a class HDF5DataSet; other functions set up the dataspace
and datatype hid_t. 
The code can be seen in detail at
http://code.google.com/p/casacore/source/browse/#svn/trunk/casa/HDF5


Note that Block is a std::vector-like class that already existed before
STL was there. 

I hope it helps. 
Cheers, 
Ger 

  void HDF5DataSet::get (const Slicer& section, void* buf) 
  { 
    // Define the data set selection. 
    Block<hsize_t> offset = fromShape(section.start()); 
    Block<hsize_t> count  = fromShape(section.length()); 
    Block<hsize_t> stride = fromShape(section.stride()); 
    if (H5Sselect_hyperslab (itsDSid, H5S_SELECT_SET, offset.storage(),

     stride.storage(), count.storage(), NULL) < 0) { 
      throw HDF5Error("invalid data set array selection"); 
    } 
    // Define a data space for the memory buffer. 
    HDF5HidDataSpace memspace (H5Screate_simple (count.size(), 
 count.storage(), NULL)); 
    // Define memory selection. 
    offset = 0;   // set all offsets to 0 
    if (H5Sselect_hyperslab (memspace, H5S_SELECT_SET,
offset.storage(), 
     NULL, count.storage(), NULL) < 0) { 
      throw HDF5Error("setting slab of memory buffer"); 
    } 
    // Read the data. 
    if (H5Dread (getHid(), itsDataType.getHidMem(), memspace, itsDSid,

 H5P_DEFAULT, buf) < 0) { 
      throw HDF5Error("reading slab from data set array"); 
    } 
  } 


>>> marcocamma <[email protected]> 6/10/2010 6:13 AM >>>

Hi Binh-Minh, 

I have read them but I didn't manage, 

marco 




On 9 June 2010 18:42, Binh-Minh Ribler [via hdf-forum] <[hidden email]
( /user/SendEmail.jtp?type=node&node=884545&i=0 )> wrote:



Hi Marco,

You might want to take a look at the examples at
http://www.hdfgroup.org/HDF5/doc/cpplus_RM/examples.html,
if you haven't. Â They might give you some ideas.

Binh-Minh


 


View this message in context: Re: Reading Array of images (
http://hdf-forum.184993.n3.nabble.com/Reading-Array-of-images-tp883969p884545.html
)
Sent from the hdf-forum mailing list archive (
http://hdf-forum.184993.n3.nabble.com/ ) at Nabble.com.
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to