本文整理汇总了C++中h5::DataSet::getStorageSize方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSet::getStorageSize方法的具体用法?C++ DataSet::getStorageSize怎么用?C++ DataSet::getStorageSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类h5::DataSet
的用法示例。
在下文中一共展示了DataSet::getStorageSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadStackHDF5
bool loadStackHDF5( const char* fileName, Image4DSimple& img )
{
#ifdef USE_HDF5
H5::Exception::dontPrint();
H5::H5File file( fileName, H5F_ACC_RDONLY );
for ( size_t i = 0; i < file.getObjCount(); i++ )
{
H5std_string name = file.getObjnameByIdx( i );
if ( name == "Channels" )
{
H5::Group channels = file.openGroup( name );
// Grab the attributes
H5::Attribute attr = channels.openAttribute( "width" );
H5::DataType type = attr.getDataType();
long width, height;
attr.read( type, &width );
attr.close();
attr = channels.openAttribute( "height" );
attr.read( type, &height );
attr.close();
int num_channels = 0;
// Count the number of channels
for ( size_t obj = 0; obj < channels.getNumObjs(); obj++ )
if ( channels.getObjTypeByIdx( obj ) == H5G_DATASET )
num_channels++;
int channel_idx = 0;
for ( size_t obj = 0; obj < channels.getNumObjs(); obj++ )
{
if ( channels.getObjTypeByIdx( obj ) == H5G_DATASET )
{
H5std_string ds_name = channels.getObjnameByIdx( obj );
H5::DataSet data = channels.openDataSet( ds_name );
uint8_t* buffer = new uint8_t[ data.getStorageSize() ];
data.read( buffer, data.getDataType() );
QByteArray qbarray( ( const char* )buffer, data.getStorageSize() );
data.close();
if ( !loadIndexedStackFFMpeg( &qbarray, img, channel_idx++, num_channels,
width, height ) )
{
v3d_msg( "Error happened in HDF file reading. Stop. \n", false );
return false;
}
delete [] buffer;
}
}
}
}
#endif
return true;
}