Skip to contents

Reads an HDF5 file, typically one previously created by write_labeled_vec (now deprecated), and constructs a LabeledVolumeSet-class object. The HDF5 file is opened in read-only mode.

Usage

read_labeled_vec(file_path)

Arguments

file_path

Character string: path to the HDF5 file.

Value

A LabeledVolumeSet-class object with an open HDF5 file handle.

Details

This function is the primary way to load data into a LabeledVolumeSet from its HDF5 disk representation. The structure of the HDF5 file is expected to follow the specification laid out by write_labeled_vec.

Lifecycle Management

When a LabeledVolumeSet object is created by this function, it opens the specified HDF5 file and the returned object takes ownership of this open file handle. **It is the user's responsibility to explicitly close this handle** when the object is no longer needed to release system resources. This can be done by calling close(your_labeled_volume_set_object).

Failure to close the handle may lead to issues such as reaching file handle limits or problems with subsequent access to the file.

See also

write_labeled_vec for the (deprecated) writing function, LabeledVolumeSet-class for details on the object structure, close for closing the file handle.

Examples

if (FALSE) { # \dontrun{
# Assuming "my_labeled_set.h5" is a valid HDF5 file for LabeledVolumeSet
lvs <- read_labeled_vec("my_labeled_set.h5")
# ... perform operations with lvs ...
print(dim(lvs))
print(labels(lvs))
# Important: Close the handle when done
close(lvs)
} # }