Public Member Functions
morphio::Collection Class Reference

Public Member Functions

 Collection (std::shared_ptr< CollectionImpl > collection)
 
 Collection (std::string collection_path, std::vector< std::string > extensions=std::vector< std::string >{".h5", ".H5", ".asc", ".ASC", ".swc", ".SWC"})
 
template<class M >
enable_if_mutable< M, M >::type load (const std::string &morph_name, unsigned int options=NO_MODIFIER, std::shared_ptr< WarningHandler > warning_handler=nullptr) const
 
template<class M >
enable_if_immutable< M, M >::type load (const std::string &morph_name, unsigned int options=NO_MODIFIER, std::shared_ptr< WarningHandler > warning_handler=nullptr) const
 
template<class M >
LoadUnordered< M > load_unordered (std::vector< std::string > morphology_names, unsigned int options=NO_MODIFIER, std::shared_ptr< WarningHandler > warning_handler=nullptr) const
 
std::vector< size_t > argsort (const std::vector< std::string > &morphology_names) const
 
void close ()
 

Constructor & Destructor Documentation

◆ Collection()

morphio::Collection::Collection ( std::string  collection_path,
std::vector< std::string >  extensions = std::vector< std::string >{".h5", ".H5", ".asc", ".ASC", ".swc", ".SWC"} 
)

Create a collection from the given path.

If collection_path points to an HDF5 file, then that file must be a container. Otherwise the collection_path should point to the directory containing the morphology files.

If the collection path is a directory, the extension of the morphology file must be guessed. The optional argument extensions specifies which and in which order the morphologies are searched.

Member Function Documentation

◆ argsort()

std::vector<size_t> morphio::Collection::argsort ( const std::vector< std::string > &  morphology_names) const

Returns the reordered loop indices.

This is the suggested order in which one should load the morphologies to minimize seeking within the file.

Note: This API is 'experimental', meaning it might change in the future.

◆ close()

void morphio::Collection::close ( )

Close the collection.

Note that morphio::Collection uses RAII. Therefore, the usual scoping rules should suffice. However, there are cases where one wants to close the collection explicitly, causing all resources held by the collection to be release. In the case of containers it ensures that the file is closed.

The object should not be used after calling close.

◆ load() [1/2]

template<class M >
enable_if_mutable<M, M>::type morphio::Collection::load ( const std::string &  morph_name,
unsigned int  options = NO_MODIFIER,
std::shared_ptr< WarningHandler warning_handler = nullptr 
) const

Load the morphology as an immutable morphology.

◆ load() [2/2]

template<class M >
enable_if_immutable<M, M>::type morphio::Collection::load ( const std::string &  morph_name,
unsigned int  options = NO_MODIFIER,
std::shared_ptr< WarningHandler warning_handler = nullptr 
) const

Load the morphology as a mutable morphology.

◆ load_unordered()

template<class M >
template LoadUnordered< Morphology > morphio::Collection::load_unordered< Morphology > ( std::vector< std::string >  morphology_names,
unsigned int  options = NO_MODIFIER,
std::shared_ptr< WarningHandler warning_handler = nullptr 
) const

Returns an iterable of loop index, morphology pairs.

See LoadUnordered for details.