48 m_dataset( ( (obj.m_dataset)?new
H5::DataSet(*(obj.m_dataset)):0 ) ),
49 m_datasetName(obj.m_datasetName),
50 m_scalar(obj.m_scalar),
53 m_samples(obj.m_samples),
54 m_validRect(obj.m_validRect),
96 const std::string& datasetName )
109 std::vector<ossim_uint32> extents;
111 if ( extents.size() >= 2 )
115 if ( extents.size() >= 3 )
218 static const char MODULE[] =
"ossimH5ImageDataset::getTileBuf";
236 H5::DataSpace imageDataSpace =
m_dataset->getSpace();
239 const ossim_int32 IN_DIM_COUNT = imageDataSpace.getSimpleExtentNdims();
242 H5::DataType dataType =
m_dataset->getDataType();
244 std::vector<hsize_t> inputCount(IN_DIM_COUNT);
245 std::vector<hsize_t> inputOffset(IN_DIM_COUNT);
247 if ( IN_DIM_COUNT == 2 )
249 inputOffset[0] = irect.
ul().
y;
250 inputOffset[1] = irect.
ul().
x;
252 inputCount[0] = irect.
height();
253 inputCount[1] = irect.
width();
257 inputOffset[0] = band;
258 inputOffset[1] = irect.
ul().
y;
259 inputOffset[2] = irect.
ul().
x;
262 inputCount[1] = irect.
height();
263 inputCount[2] = irect.
width();
267 imageDataSpace.selectHyperslab( H5S_SELECT_SET,
269 &inputOffset.front() );
273 std::vector<hsize_t> outputCount(OUT_DIM_COUNT);
275 outputCount[1] = irect.
height();
276 outputCount[2] = irect.
width();
279 std::vector<hsize_t> outputOffset(OUT_DIM_COUNT);
285 H5::DataSpace bufferDataSpace( OUT_DIM_COUNT, &outputCount.front());
286 bufferDataSpace.selectHyperslab( H5S_SELECT_SET,
287 &outputCount.front(),
288 &outputOffset.front() );
291 m_dataset->read( buffer, dataType, bufferDataSpace, imageDataSpace );
300 bufferDataSpace.close();
302 imageDataSpace.close();
308 catch(
const H5::FileIException& error )
311 << MODULE <<
" caught H5::FileIException!" << std::endl;
316 catch(
const H5::DataSetIException& error )
319 << MODULE <<
" caught H5::DataSetIException!" << std::endl;
324 catch(
const H5::DataSpaceIException& error )
327 << MODULE <<
" caught H5::DataSpaceIException!" << std::endl;
332 catch(
const H5::DataTypeIException& error )
335 << MODULE <<
" caught H5::DataTypeIException!" << std::endl;
341 << MODULE <<
" caught unknown exception !" << std::endl;
351 out <<
"ossimH5ImageDataset: " 359 <<
"\nswap_flage: " << (
m_endian?
"true":
"false")
366 return obj.
print( out );
std::string m_datasetName
void close()
Calls H5::DataSet::close then deletes data set.
const ossimH5ImageDataset & operator=(const ossimH5ImageDataset &rhs)
ossimH5ImageDataset()
default constructor
virtual ossimString getEntryString(ossim_int32 entry_number) const
ossim_uint32 height() const
ossimScalarType getScalarType(const H5::DataSet *dataset)
void getTileBuf(void *buffer, const ossimIrect &rect, ossim_uint32 band)
Method to grab a tile(rectangle) from image.
const ossimIpt & ul() const
OSSIM_DLL ossimByteOrder byteOrder()
ossim_uint32 getNumberOfLines() const
const H5::DataSet * getDataset() const
Get const pointer to dataset.
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
std::ostream & operator<<(std::ostream &out, const ossimH5ImageDataset &obj)
ossim_uint32 getNumberOfBands() const
std::ostream & print(std::ostream &out) const
print method.
unsigned int ossim_uint32
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
ossim_uint32 width() const
ossimByteOrder getByteOrder(const H5::AbstractDs *dataset)
ossimScalarType getScalarType() const
bool getValidBoundingRect(H5::DataSet &dataset, const std::string &name, ossimIrect &rect)
Gets the valid bounding rect of the dataset excluding nulls on front and back.
ossim_uint32 getNumberOfSamples() const
void getExtents(const H5::DataSet *dataset, std::vector< ossim_uint32 > &extents)
const ossimIpt & getSubImageOffset() const
ossim_uint32 area() const
~ossimH5ImageDataset()
destructor
const ossimIrect & getValidImageRect() const
Class encapsulates a HDF5 Data set that can be loaded as an image.
bool initialize(const H5::DataSet &dataset, const std::string &datasetName)
Opens datasetName and initializes all data members on success.
const std::string & getName() const
ossimIrect m_validRect
Zero based image rect:
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.