Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::FileSequenceLoader Class Reference

A VolumeLoader that loads one Volume file per time step (frame). More...

#include <modules/base/io/filesequenceloader.h>

+ Inheritance diagram for inviwo::FileSequenceLoader:

Public Member Functions

 FileSequenceLoader (std::vector< std::filesystem::path > paths, std::vector< Seconds > times, DataReaderFactory *factory, FileExtension extension={})
 
virtual std::shared_ptr< Volume > load (size_t index, std::shared_ptr< Volume > reuse, std::stop_token stop) const override
 
virtual VolumeConfig prototype () const override
 
virtual size_t size () const override
 Total number of frames.
 
virtual Seconds time (size_t index) const override
 
- Public Member Functions inherited from inviwo::TemporalVolumeLoader
TemporalVolumeLoader & operator= (const TemporalVolumeLoader &)=default
 
TemporalVolumeLoader & operator= (TemporalVolumeLoader &&)=default
 
 TemporalVolumeLoader (const TemporalVolumeLoader &)=default
 
 TemporalVolumeLoader (TemporalVolumeLoader &&)=default
 

Detailed Description

A VolumeLoader that loads one Volume file per time step (frame).

Each frame corresponds to a single file. Files are read on demand using Inviwo's DataReaderFactory, so any registered Volume reader can be used. The prototype is obtained by loading metadata from the first file once at construction time.

Note
load() may be called concurrently from a background thread. A fresh DataReader is created for each load call, guarded by an internal mutex, so the loader is safe to use with TemporalVolume's prefetch mechanism.
See also
TemporalVolume, VolumeLoader

Constructor & Destructor Documentation

◆ FileSequenceLoader()

inviwo::FileSequenceLoader::FileSequenceLoader ( std::vector< std::filesystem::path > paths,
std::vector< Seconds > times,
DataReaderFactory * factory,
FileExtension extension = {} )
Parameters
pathsone file per frame, must be non-empty
timesphysical time value per frame; either empty (use 0,1,2,…) or same size as paths
factorythe data reader factory used to create Volume readers, must not be null
extensionoptional file extension used to select the reader, otherwise inferred from the file path
Exceptions
Exceptionif paths is empty, factory is null, or times has a mismatching size
DataReaderExceptionif no reader is found for the first file or it fails to load

Member Function Documentation

◆ load()

virtual std::shared_ptr< Volume > inviwo::FileSequenceLoader::load ( size_t index,
std::shared_ptr< Volume > reuse,
std::stop_token stop ) const
overridevirtual

Load the volume at the given index. May be called from a background thread, hence implementations must be re-entrant and thread-safe.

Parameters
reusean optional volume whose storage may be reused to avoid reallocation. It may be null and must be ignored if its format or dimensions do not match the frame.
stopcancellation token. Implementations should poll stop.stop_requested() at natural checkpoints and return nullptr as soon as a stop is requested. A partially written reuse volume is discarded by the caller.
Returns
the loaded volume, or nullptr if the load was cancelled.

Implements inviwo::TemporalVolumeLoader.

◆ prototype()

virtual VolumeConfig inviwo::FileSequenceLoader::prototype ( ) const
overridevirtual

A prototype VolumeConfig describing dimensions, format, basis, dataMap, and axes — but no voxel data. Used by downstream consumers that need metadata without triggering a load.

Implements inviwo::TemporalVolumeLoader.

◆ size()

virtual size_t inviwo::FileSequenceLoader::size ( ) const
overridevirtual

Total number of frames.

Implements inviwo::TemporalVolumeLoader.

◆ time()

virtual Seconds inviwo::FileSequenceLoader::time ( size_t index) const
overridevirtual

Physical time value for frame index. The values are expected to be sorted in ascending order.

Implements inviwo::TemporalVolumeLoader.


The documentation for this class was generated from the following file: