Richard, There is no such functionality in HDF5.
Said this, you may wish to look at point selection in HDF5 http://www.hdfgroup.org/HDF5/Tutor/selectc.html and HDF5 region references http://www.hdfgroup.org/HDF5/Tutor/reftoreg.html. Some examples are also available from http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/api18-c.html. What you can do is to define a point selection that corresponds to all "1" in a dataset with the mask values. Then use this selection to read data from a dataset assuming that a dataset with mask values and the dataset to be read have the same dimensionality (rank and dimension sizes) . Elena On Aug 12, 2010, at 12:53 PM, Richard Strub wrote: > Do I have to loop through every pixel when I want to mask one 2D Dataset with > another? > > float[] dataRead = (float[]) data.read(); > float[] maskRead = (float[]) mask.read(); > > for (int i = 0; i < dims[0] * dims[1] ; ++i) { > if (maskRead[i] == 1) { > /* 1 * dataRead[i] */ > } > else { > dataRead[i] = fillvalue; > /* ...or 0 * dataRead[i] */ > } > } > data.write(dataRead); > > Or is there some sort of function/technique which will multiply all of the > corresponding pixels together? > > > > > _______________________________________________ > Hdf-forum is for HDF software users discussion. > [email protected] > http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
