Skip to contents

Close connections or release resources associated with an object. This generic is used for objects that manage external resources like HDF5 file handles.

This method manually closes the HDF5 file handle stored within the H5NeuroVec object. It uses the safe_h5_close helper.

This method manually closes the HDF5 file handle stored within the H5NeuroVol object. It uses the safe_h5_close helper.

This method manually closes the HDF5 file handle stored within the LabeledVolumeSet object. It uses the \codesafe_h5_close helper to ensure the handle is valid before attempting to close. After closing, the internal handle reference is nulled to prevent accidental reuse.

Usage

close(con, ...)

# S4 method for class 'H5ParcellatedMultiScan'
close(con, ...)

# S4 method for class 'H5NeuroVec'
close(con, ...)

# S4 method for class 'H5NeuroVecSeq'
close(con, ...)

# S4 method for class 'H5NeuroVol'
close(con, ...)

# S4 method for class 'LabeledVolumeSet'
close(con, ...)

Arguments

con

A \codeLabeledVolumeSet object.

...

Additional arguments (ignored).

Value

Usually returns NULL invisibly

NULL invisibly

Invisibly returns NULL.

Invisibly returns NULL.

Invisibly returns \codeNULL.

Details

**Important:** If this LabeledVolumeSet object was created from a file path using read_labeled_vec, the user is responsible for calling this close method when finished with the object to release the file handle. Failure to do so will leave the file open until the R session ends. If the object was created using an existing H5File handle, closing remains the responsibility of the code that originally opened the handle.

Examples

if (FALSE) { # \dontrun{
# Example with LabeledVolumeSet
if (!is.null(fmristore:::create_minimal_h5_for_LabeledVolumeSet)) {
  temp_file <- fmristore:::create_minimal_h5_for_LabeledVolumeSet()
  lvs <- read_labeled_vec(temp_file)
  # Use the object...
  close(lvs) # Close the HDF5 file handle
  unlink(temp_file)
}
} # }