I tried this and get the same results. Any other ideas? >-----Original Message----- >From: [email protected] [mailto:hdf-forum- >[email protected]] On Behalf Of Peter Cao >Sent: Friday, December 04, 2009 3:16 PM >To: [email protected] >Subject: Re: [Hdf-forum] Java HDF : unable to select frame in 3D array > > >Try this. > >public int[] getFrame(Dataset dataset, int frameNum) { > > dataset.init(); > > // Select the desired frame > > long[] startDims = dataset.getStartDims(); > > int[] idx = getSelectedIndex(); // idx[0]=hight, idx[1]=width, > idx[2]=depth > > > // if you want to look through the first dimension, uncomment out the > follwing line > //idx[0]=1; idx[1]=2; idx[2] = 0 > > > startDims[idx[2]] = frameNum; > > // Grab the frame data > > int[] rawdata = (*int*[])dataset.getData(); > > return rawdata; > >} > > > > >Shane, Hugh A. wrote: >> >> An HDF newbie here... >> >> I'm attempting to use the HDF Object Package 1.6.0_12 to read a >> previously created HDF5 formatted file that contains, among other >> things, a Dataset containing a 3-dimensional array of integers, row x >> column x frame. I want to operate on the data one frame at a time but >> am unable to select the frame that I want. The Dataset object seems to >> always default to frame 0 and won't budge from there. In the code >> fragment below, the returned frame is the same regardless of the value >> of frameNum. What am I doing wrong? >> >> public int[] getFrame(Dataset dataset, int frameNum) { >> >> dataset.init(); >> >> // Select the desired frame >> >> long[] startDims = dataset.getStartDims(); >> >> startDims[0] = frameNum; >> >> // Grab the frame data >> >> int[] rawdata = (*int*[])dataset.getData(); >> >> return rawdata; >> >> } >> >> ---------------------------------------------------------------------- >-- >> >> _______________________________________________ >> 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
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
