def hdfgroup_to_nifti1image(h5group):
try:<EOL><INDENT>data   = h5group['<STR_LIT:data>'][:]<EOL>affine = h5group['<STR_LIT>'][:]<EOL>extra = None<EOL>if '<STR_LIT>' in h5group:<EOL><INDENT>extra = h5group['<STR_LIT>'][:]<EOL><DEDENT>header = get_nifti1hdr_from_h5attrs(h5group['<STR_LIT:data>'].attrs)<EOL>img = nib.Nifti1Image(data, affine, header=header, extra=extra)<EOL>return img<EOL><DEDENT>except KeyError as ke:<EOL><INDENT>raise Exception('<STR_LIT>' + h5group.name) from ke<EOL><DEDENT>
Returns a nibabel Nifti1Image from a HDF5 group datasets

    Parameters
    ----------
    h5group: h5py.Group
        HDF5 group

    Returns
    -------
    nibabel Nifti1Image