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

A VolumeLoader that computes each frame on the fly via a callable. More...

#include <inviwo/core/datastructures/volume/temporalvolume.h>

+ Inheritance diagram for inviwo::ProceduralLoader:

Public Types

using Generator
 

Public Member Functions

virtual std::shared_ptr< Volume > load (size_t index, std::shared_ptr< Volume > reuse, std::stop_token stop) const override
 
 ProceduralLoader (size_t count, std::vector< Seconds > times, VolumeConfig prototype, Generator generator)
 
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 computes each frame on the fly via a callable.

Useful for procedural data, simulations, or testing.

Member Typedef Documentation

◆ Generator

Initial value:
std::function<std::shared_ptr<Volume>(
size_t index, Seconds time, std::shared_ptr<Volume> reuse, std::stop_token stop)>
virtual Seconds time(size_t index) const override
std::chrono::duration< double > Seconds
Physical time value of a TemporalVolume frame, seconds stored as a double.
Definition temporalvolume.h:62

Signature of the generator callable, given a frame index, its time value, an optional reuse volume whose storage may be reused (may be null), and a stop token.

See also
TemporalVolumeLoader::load

Constructor & Destructor Documentation

◆ ProceduralLoader()

inviwo::ProceduralLoader::ProceduralLoader ( size_t count,
std::vector< Seconds > times,
VolumeConfig prototype,
Generator generator )
Parameters
countnumber of frames
timesphysical time values, either empty or of size count
prototypemetadata-only prototype config
generatorcallable producing the volume for a given index/time

Member Function Documentation

◆ load()

virtual std::shared_ptr< Volume > inviwo::ProceduralLoader::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::ProceduralLoader::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::ProceduralLoader::size ( ) const
overridevirtual

Total number of frames.

Implements inviwo::TemporalVolumeLoader.

◆ time()

virtual Seconds inviwo::ProceduralLoader::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: