Inviwo  0.9.10.1
Inviwo documentation
inviwo::util Namespace Reference

Classes

struct  BufferDispatcher
 
struct  BuildInfo
 Provides information on build time and date as well as git hashes. More...
 
class  Camera2D
 
struct  cameratype
 
struct  cameratype< 2 >
 
struct  cameratype< 3 >
 
class  cloneable_ptr
 
struct  DefaultColorRepresentation
 
struct  DefaultColorRepresentation< ivec3 >
 
struct  DefaultColorRepresentation< ivec4 >
 
struct  extent
 
struct  extent< const T, N >
 
struct  extent< glm::mat< C, R, T, Q >, 0 >
 
struct  extent< glm::mat< C, R, T, Q >, 1 >
 
struct  extent< glm::tquat< T, Q >, 0 >
 
struct  extent< glm::vec< L, T, Q >, 0 >
 
struct  flat_extent
 
struct  for_each_type
 
struct  for_each_type< std::tuple< T > >
 
struct  for_each_type< std::tuple< T, Types... > >
 
struct  for_each_type_pair
 
struct  for_each_type_pair< std::tuple< ATypes... >, std::tuple< BTypes... > >
 
struct  glmtype
 
struct  glmtype< T, 1, 1, P >
 
struct  glmtype< T, L, 1, P >
 
struct  GridPos
 
class  HasClassIdentifier
 
class  HasClassIdentifierLower
 
class  HasClassIdentifierUpper
 
class  HasColorCode
 
class  HasColorCodeLower
 
class  HasColorCodeUpper
 
struct  HasDataFormat
 
class  HasDataInfo
 
class  HasDataName
 
struct  HasEnumName
 
class  HasInfo
 
class  IdentifiedDeserializer
 
class  IndexedDeserializer
 
struct  IndexMapper
 
struct  IndexMapper< 2, IndexType >
 
struct  IndexMapper< 3, IndexType >
 
struct  IndirectIterator
 
struct  is_constructible
 
class  is_container
 
struct  is_dereferenceable
 
struct  is_dereferenceable< T, void_t< decltype(*std::declval< T >())> >
 
struct  is_floating_point
 
struct  is_floating_point< half_float::half >
 
class  is_stream_insertable
 
struct  is_string
 
struct  iter_range
 
class  KeepTrueWhileInScope
 sets the given bool variable to true and restores its state when leaving the scope More...
 
class  MapDeserializer
 
class  MemoryFileHandle
 RAII class for providing a FILE stream handle to a buffer in memory. This class will open a file handle to /dev/null and use a dedicated buffer for buffering. As long as less bytes than getBufferSize() bytes are written/read, its status is well defined. However, after writing more than buffer size bytes, the buffer contents will be flushed, i.e. are no longer accessible. More...
 
class  MetaDataToProperty
 
class  NotificationBlocker
 
class  OnScopeExit
 calls the given function when leaving the current scope More...
 
class  ostream_joiner
 
struct  overloaded
 
struct  PropertyDistanceSorter
 
struct  rank
 
struct  rank< const T >
 
struct  rank< glm::mat< C, R, T, Q > >
 
struct  rank< glm::tquat< T, Q > >
 
struct  rank< glm::vec< L, T, Q > >
 
struct  rank< half_float::half >
 
struct  same_extent
 
struct  same_extent< glm::mat< C, R, T, Q >, U >
 
struct  same_extent< glm::tquat< T, Q >, U >
 
struct  same_extent< glm::vec< L, T, Q >, U >
 
struct  sequence
 
class  TempFileHandle
 RAII interface for providing a file handle and file name to a temporary file. More...
 
class  TextureAtlas
 Texture atlas for a number of strings rendered with the TextRenderer. More...
 
class  TFPropertyConcept
 property interface used by the TF dialog to support different TF properties More...
 
class  TFPropertyModel
 
struct  TransformIterator
 
struct  value_type
 
struct  value_type< glm::mat< C, R, T, Q > >
 
struct  value_type< glm::tquat< T, Q > >
 
struct  value_type< glm::vec< L, T, Q > >
 

Typedefs

template<typename T >
using PrecisionType = typename std::remove_pointer< typename std::remove_const< T >::type >::type
 
template<typename T >
using PrecsionType = typename std::remove_pointer< typename std::remove_const< T >::type >::type
 
template<typename T >
using PrecisionValueType = typename PrecisionType< T >::type
 
template<typename T >
using PrecsionValueType = typename PrecisionType< T >::type
 
using IndexMapper2D = IndexMapper< 2, size_t >
 
using IndexMapper3D = IndexMapper< 3, size_t >
 
template<class... >
using void_t = void
 
template<typename F , typename... Args>
using is_invocable = std::is_invocable< F, Args... >
 
template<typename R , typename F , typename... Args>
using is_invocable_r = std::is_invocable_r< F, Args... >
 
template<typename F , typename... Args>
using is_callable = std::is_invocable< F, Args... >
 

Enumerations

enum  TraversalDirection { Up, Down }
 
enum  VisitPattern { Pre, Post }
 
enum  VolumeLaplacianPostProcessing { None, Normalized, SignNormalized, Scaled }
 

Functions

IVW_CORE_API mat4 boundingBox (const Mesh &mesh)
 
IVW_CORE_API mat4 boundingBox (const std::vector< std::shared_ptr< const Mesh >> &meshes)
 
IVW_CORE_API mat4 boundingBox (const Volume &volume)
 
IVW_CORE_API mat4 boundingBox (const std::vector< std::shared_ptr< Volume >> &volumes)
 
IVW_CORE_API InviwoApplicationgetInviwoApplication (ProcessorNetwork *)
 
IVW_CORE_API InviwoApplicationgetInviwoApplication (Processor *)
 
IVW_CORE_API InviwoApplicationgetInviwoApplication (PropertyOwner *)
 
IVW_CORE_API InviwoApplicationgetInviwoApplication (Property *)
 
IVW_CORE_API InviwoApplicationgetInviwoApplication ()
 
std::shared_ptr< IndexBuffermakeIndexBuffer (std::vector< std::uint32_t > &&data)
 
template<typename T = vec3, BufferUsage U = BufferUsage::Static, BufferTarget Target = BufferTarget::Data>
std::shared_ptr< Buffer< T, Target > > makeBuffer (std::vector< T > &&data)
 
IVW_CORE_API uvec3 getDataFormatColor (NumericType t, size_t comp, size_t size)
 
IVW_CORE_API std::string appendIfNotEmpty (const std::string &a, const std::string &b)
 
IVW_CORE_API void registerCoreRepresentations (InviwoModule &obj)
 
IVW_CORE_API void registerCoreRepresentations (RepresentationFactoryManager &obj)
 
template<typename T >
HistogramContainer calculateVolumeHistogram (const T *data, size3_t dimensions, dvec2 dataRange, const bool &stop=false, size_t bins=2048, size3_t sampleRate=size3_t(1))
 
template<typename... Args>
void printEvent (std::ostream &os, const std::string &event, Args... args)
 
void IVW_CORE_API readBytesIntoBuffer (const std::string &file, size_t offset, size_t bytes, bool littleEndian, size_t elementSize, void *dest)
 
IVW_CORE_API void saveLayer (const Layer &layer, const std::string &path, const FileExtension &extension=FileExtension())
 
IVW_CORE_API void saveLayer (const Layer &layer)
 
IVW_CORE_API std::string formatSerializationError (const std::string &name, const std::string &src, const std::string &dst, const std::string &err)
 
IVW_CORE_API void renamePort (Deserializer &d, std::vector< std::pair< const Port *, std::string >> rules)
 
IVW_CORE_API void renameProperty (Deserializer &d, std::vector< std::pair< const Property *, std::string >> rules, std::string path="Properties")
 
IVW_CORE_API void changePropertyType (Deserializer &d, std::vector< std::pair< const Property *, std::string >> rules)
 
IVW_CORE_API std::unordered_set< Processor * > getDirectPredecessors (Processor *processor)
 
IVW_CORE_API std::unordered_set< Processor * > getDirectSuccessors (Processor *processor)
 
IVW_CORE_API std::unordered_set< Processor * > getPredecessors (Processor *processor)
 
IVW_CORE_API std::unordered_set< Processor * > getSuccessors (Processor *processor)
 
template<TraversalDirection D, VisitPattern V, typename Func >
void traverseNetwork (std::unordered_set< Processor * > &state, Processor *processor, Func f)
 
IVW_CORE_API std::vector< Processor * > topologicalSort (ProcessorNetwork *network)
 
IVW_CORE_API std::vector< ivec2 > getPositions (const std::vector< Processor * > &processors)
 
IVW_CORE_API std::vector< ivec2 > getPositions (ProcessorNetwork *network)
 
IVW_CORE_API ivec2 getCenterPosition (const std::vector< Processor * > &processors)
 
IVW_CORE_API ivec2 getCenterPosition (ProcessorNetwork *network)
 
IVW_CORE_API std::pair< ivec2, ivec2 > getBoundingBox (const std::vector< Processor * > &processors)
 
IVW_CORE_API std::pair< ivec2, ivec2 > getBoundingBox (ProcessorNetwork *network)
 
IVW_CORE_API void offsetPosition (const std::vector< Processor * > &processors, ivec2 offset)
 
IVW_CORE_API void setSelected (const std::vector< Processor * > &processors, bool selected)
 
IVW_CORE_API void serializeSelected (ProcessorNetwork *network, std::ostream &os, const std::string &refPath)
 
IVW_CORE_API std::vector< Processor * > appendDeserialized (ProcessorNetwork *network, std::istream &is, const std::string &refPath, InviwoApplication *app)
 
IVW_CORE_API bool addProcessorOnConnection (ProcessorNetwork *network, std::unique_ptr< Processor > processor, PortConnection connection)
 
IVW_CORE_API void replaceProcessor (ProcessorNetwork *network, std::unique_ptr< Processor > newProcessor, Processor *oldProcessor)
 
void IVW_CORE_API updateWorkspaces (InviwoApplication *app)
 
void IVW_CORE_API updateRegressionWorkspaces (InviwoApplication *app)
 
void IVW_CORE_API updateWorkspaces (InviwoApplication *app, const std::string &path)
 
IVW_CORE_API void replaceSelectionWithCompositeProcessor (ProcessorNetwork &network)
 
IVW_CORE_API void expandCompositeProcessorIntoNetwork (CompositeProcessor &composite)
 
Tags IVW_CORE_API getPlatformTags (const Tags &t)
 
IVW_CORE_API const ProcessorMetaDatagetMetaData (const Processor *processor)
 
IVW_CORE_API ProcessorMetaDatagetMetaData (Processor *processor)
 
IVW_CORE_API ivec2 getPosition (const Processor *processor)
 
IVW_CORE_API void setPosition (Processor *processor, ivec2 pos)
 
IVW_CORE_API bool isSelected (const Processor *processor)
 
IVW_CORE_API void setSelected (Processor *processor, bool selected)
 
template<typename T , typename... Args>
std::unique_ptr< T > makeProcessor (ivec2 pos, Args &&... args)
 
IVW_CORE_API void debugBreak ()
 
IVW_CORE_API void reverse (BufferBase &b)
 
BuildInfo IVW_CORE_API getBuildInfo ()
 Accesses build information via an INI file or compile-time definitions. More...
 
template<size_t len>
constexpr uint64_t constexpr_hash (const char(&str)[len])
 
template<typename T , typename std::enable_if< HasEnumName< T >::value, std::size_t >::type = 0>
std::string enumName ()
 
template<typename Iterable , typename Callback >
void forEach (const Iterable &iterable, Callback &&callback)
 
template<typename Iterable , typename Callback , typename OnDoneCallback >
std::vector< std::future< void > > forEachParallelAsync (const Iterable &iterable, Callback &&callback, size_t jobs, OnDoneCallback &&onTaskDone)
 
template<typename Iterable , typename Callback >
std::vector< std::future< void > > forEachParallelAsync (const Iterable &iterable, Callback &&callback, size_t jobs=0)
 
template<typename Iterable , typename Callback >
void forEachParallel (const Iterable &iterable, Callback &&callback, size_t jobs=0)
 
template<class F , class... Args>
auto for_each_argument (F &&f, Args &&... args)
 
template<typename F , typename TupleType >
void for_each_in_tuple (F &&f, TupleType &&t)
 
template<typename F , typename TupleType1 , typename TupleType2 >
void for_each_in_tuple (F &&f, TupleType1 &&t1, TupleType2 &&t2)
 
IVW_CORE_API glm::u64 bytes_to_kilobytes (glm::u64 bytes)
 
IVW_CORE_API glm::u64 bytes_to_megabytes (glm::u64 bytes)
 
IVW_CORE_API glm::u64 kilobytes_to_bytes (glm::u64 bytes)
 
IVW_CORE_API glm::u64 megabytes_to_bytes (glm::u64 bytes)
 
IVW_CORE_API std::string formatBytesToString (glm::u64 bytes)
 
template<typename T >
constexpr NumericType getNumericType ()
 
template<typename T >
bool isfinite (const T &v)
 
template<glm::length_t L, typename T , glm::qualifier Q>
glm::vec< L, bool, Q > isfinite (const glm::vec< L, T, Q > &x)
 
template<>
IVW_CORE_API bool isfinite (const half_float::half &v)
 
template<typename T >
bool isnan (const T &v)
 
template<glm::length_t L, typename T , glm::qualifier Q>
glm::vec< L, bool, Q > isnan (const glm::vec< L, T, Q > &x)
 
template<>
IVW_CORE_API bool isnan (const half_float::half &v)
 
template<class U , class T , class BinaryOperation >
accumulate (T x, U init, BinaryOperation op)
 
template<glm::length_t L, class U , glm::qualifier Q, template< glm::length_t, typename, glm::qualifier > class vecType, class BinaryOperation >
std::enable_if< util::rank< vecType< L, U, Q > >::value==1, U >::type accumulate (vecType< L, U, Q > const &x, U init, BinaryOperation op)
 
template<glm::length_t C, glm::length_t R, class U , glm::qualifier Q, template< glm::length_t, glm::length_t, typename, glm::qualifier > class vecType, class BinaryOperation >
std::enable_if< util::rank< vecType< C, R, U, Q > >::value==2, U >::type accumulate (vecType< C, R, U, Q > const &x, U init, BinaryOperation op)
 
template<typename To = double, typename From , typename std::enable_if< util::rank< From >::value==0 &&util::rank< To >::value==0, int >::type = 0>
To glm_convert (From x)
 
template<typename To = double, typename From , typename std::enable_if< std::is_same< To, From >::value, int >::type = 0>
To glm_convert_normalized (From x)
 
template<typename T , typename std::enable_if< util::rank< T >::value==0, int >::type = 0>
constexpr auto glmcomp (T &elem, size_t) -> T &
 
template<typename T , typename std::enable_if< util::rank< T >::value==2, int >::type = 0>
constexpr auto glmcomp (const T &elem, size_t i) -> const typename T::value_type &
 
template<typename T , typename std::enable_if< util::rank< T >::value==0, int >::type = 0>
constexpr auto glmcomp (T &elem, size_t i, size_t j) -> T &
 
template<typename T , typename std::enable_if< util::rank< T >::value==2, int >::type = 0>
constexpr auto glmcomp (const T &elem, size_t i, size_t j) -> const typename T::value_type &
 
template<typename Type1 , typename Type2 >
Type1 invertY (Type1 vec, Type2 dim)
 
template<typename T >
bool all (const T &t)
 
template<>
bool all (const bool &t)
 
template<typename T >
bool any (const T &t)
 
template<>
bool any (const bool &t)
 
template<typename M , typename T = typename M::value_type>
filled (T v)
 
template<typename T >
epsilon ()
 
template<typename T >
bool almostEqual (const T &x, const T &y, int ulp=2)
 
template<class T >
constexpr void hash_combine (std::size_t &seed, const T &v) noexcept
 
template<typename C >
void forEachPixel (const LayerRAM &layer, C callback)
 
template<typename C >
void forEachPixelParallel (const LayerRAM &layer, C callback, size_t jobs=0)
 
IVW_CORE_API std::shared_ptr< ImagereadImageFromDisk (std::string filename)
 
template<size_t N, typename IndexType = size_t>
auto makeIndexMapper (const Vector< N, IndexType > &dim)
 
template<bool PropagateConst = true, typename Iter >
IndirectIterator< Iter, PropagateConst > makeIndirectIterator (Iter &&iter)
 
template<typename T , typename std::enable_if< HasClassIdentifierUpper< T >::value, std::size_t >::type = 0>
std::string classIdentifier ()
 
template<typename T , typename std::enable_if< HasDataName< T >::value, std::size_t >::type = 0>
std::string dataName ()
 
template<typename T , typename std::enable_if< HasColorCodeUpper< T >::value, std::size_t >::type = 0>
uvec3 colorCode ()
 
template<typename T , typename std::enable_if< HasDataInfo< T >::value, std::size_t >::type = 0>
std::string data_info (const T *data)
 
template<typename T , typename std::enable_if<!HasInfo< T >::value &&HasDataInfo< T >::value, std::size_t >::type = 0>
Document info (const T &data)
 
IVW_CORE_API void log (ExceptionContext context, std::string message, LogLevel level=LogLevel::Info, LogAudience audience=LogAudience::Developer)
 
IVW_CORE_API void log (Logger *logger, ExceptionContext context, std::string message, LogLevel level=LogLevel::Info, LogAudience audience=LogAudience::Developer)
 
template<class charT , class traits , class DelimT >
ostream_joiner< std::decay_t< DelimT >, charT, traits > make_ostream_joiner (std::basic_ostream< charT, traits > &os, DelimT &&delimiter)
 
template<typename T >
void SetValue (T &t, T value)
 
template<typename T >
OnScopeExit::ExitAction RevertValue (T &t)
 
IVW_CORE_API std::vector< std::string > getLibrarySearchPaths ()
 Returns paths to search for module libraries. All platforms: executable directory and application modules directory (AppData/Inviwo/modules on windows). Platform dependent search directories: OSX: DYLD_LIBRARY_PATH UNIX: LD_LIBRARY_PATH/LD_RUN_PATH, RPATH and "executable directory /../../lib". More...
 
IVW_CORE_API bool hasAddLibrarySearchDirsFunction ()
 
IVW_CORE_API std::vector< void * > addLibrarySearchDirs (const std::vector< std::string > &dirs)
 
IVW_CORE_API void removeLibrarySearchDirs (const std::vector< void * > &dirs)
 
IVW_CORE_API std::vector< std::string > getLoadedLibraries ()
 
template<class T , class... Args>
std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type make_unique (Args &&... args)
 
template<class T >
std::enable_if< std::is_array< T >::value, std::unique_ptr< T > >::type make_unique (std::size_t n)
 
template<typename Derived , typename Base , typename Del >
std::unique_ptr< Derived, Del > static_unique_ptr_cast (std::unique_ptr< Base, Del > &&p)
 
template<typename Derived , typename Base , typename Del >
std::unique_ptr< Derived, Del > dynamic_unique_ptr_cast (std::unique_ptr< Base, Del > &&p)
 
template<typename Derived , typename Base >
std::unique_ptr< Derived > dynamic_unique_ptr_cast (std::unique_ptr< Base, std::default_delete< Base >> &&p)
 
template<std::size_t N, typename Index = size_t, typename Functor >
auto make_array (Functor &&func) -> std::array< decltype(func(std::declval< Index >())), N >
 
template<typename T , typename std::enable_if<!std::is_abstract< T >::value &&std::is_default_constructible< T >::value, int >::type = 0>
T * defaultConstructType ()
 
template<class... Ts>
 overloaded (Ts...) -> overloaded< Ts... >
 
template<typename T , typename V >
auto erase_remove (T &cont, const V &elem) -> decltype(std::distance(std::declval< T >().begin(), std::declval< T >().end()))
 
template<typename T , typename Pred >
auto erase_remove_if (T &cont, Pred pred) -> decltype(std::distance(std::declval< T >().begin(), std::declval< T >().end()))
 
template<typename T >
void reverse_erase (T &cont)
 
template<typename T , typename Pred >
void reverse_erase_if (T &cont, Pred pred)
 
template<typename T , typename Pred >
size_t map_erase_remove_if (T &cont, Pred pred)
 
template<typename T >
bool push_back_unique (T &cont, typename T::value_type elem)
 
template<typename Dst , typename... Srcs>
Dst & append (Dst &dest, Srcs &&... sources)
 
template<typename T , typename V >
auto find (T &cont, const V &elem)
 
template<typename T , typename Pred >
auto find_if (T &cont, Pred pred) -> typename T::iterator
 
template<typename T , typename Pred >
auto find_if (const T &cont, Pred pred) -> typename T::const_iterator
 
template<typename T , typename V >
bool contains (T &cont, const V &elem)
 
template<typename T , typename Pred >
bool contains_if (T &cont, Pred pred)
 
template<typename T , typename V >
bool contains (const T &cont, const V &elem)
 
template<typename T , typename Pred >
bool contains_if (const T &cont, Pred pred)
 
template<typename T , typename P >
auto find_if_or_null (T &cont, P pred) -> typename T::value_type
 
template<typename T , typename V >
auto find_or_null (T &cont, const V &elem) -> typename T::value_type
 
template<typename T , typename V , typename Callable >
auto find_or_null (T &cont, const V &elem, Callable f) -> typename T::value_type
 
template<typename T >
bool has_key (T &map, const typename T::key_type &key)
 
template<typename T >
bool insert_unique (T &map, const typename T::key_type &key, typename T::mapped_type &value)
 
template<typename T , typename V >
auto map_find_or_null (T &cont, const V &elem) -> typename T::mapped_type
 
template<typename T , typename V , typename Callable >
auto map_find_or_null (T &cont, const V &elem, Callable f) -> typename std::result_of< Callable(typename T::mapped_type)>::type
 
template<typename T , typename UnaryPredicate >
bool all_of (const T &cont, UnaryPredicate pred)
 
template<typename T , typename UnaryPredicate >
bool any_of (const T &cont, UnaryPredicate pred)
 
template<typename T , typename UnaryPredicate >
bool none_of (const T &cont, UnaryPredicate pred)
 
template<class Iter >
iter_range< Iter > as_range (Iter begin, Iter end)
 
template<class Iter >
iter_range< Iter > as_range (std::pair< Iter, Iter > const &x)
 
template<class Container >
iter_range< typename Container::iterator > as_range (Container &c)
 
template<class Container >
iter_range< typename Container::const_iterator > as_range (const Container &c)
 
template<typename T , typename OutIt , typename P >
OutIt copy_if (const T &cont, OutIt out, P pred)
 
template<typename T , typename P >
auto copy_if (const T &cont, P pred) -> std::vector< typename T::value_type >
 
template<typename T , typename UnaryOperation >
auto transform (const T &cont, UnaryOperation op) -> std::vector< typename std::result_of< UnaryOperation(typename T::value_type)>::type >
 
template<typename T , typename Pred >
auto ordering (T &cont, Pred pred) -> std::vector< size_t >
 
template<typename T >
auto ordering (T &cont) -> std::vector< size_t >
 
template<typename Generator >
auto table (Generator gen, int start, int end, int step=1) -> std::vector< decltype(gen(std::declval< int >()))>
 
template<typename T >
bool is_future_ready (const std::future< T > &future)
 
template<typename... A, typename F >
constexpr bool is_callable_with (F &&)
 
std::wstring toWstring (const std::string &str)
 convert the given std::string to std::wstring. On Windows, MultiByteToWideChar is used for this conversion assuming utf8 encoding. Otherwise, std::mbsrtowcs is used. More...
 
IVW_CORE_API TimerThreadgetDefaultTimerThread ()
 
template<typename Transform , typename Iter >
auto makeTransformIterator (Transform &&transform, Iter iter)
 
IVW_CORE_API void saveNetwork (ProcessorNetwork *network, std::string filename)
 
IVW_CORE_API void saveAllCanvases (ProcessorNetwork *network, const std::string &dir, const std::string &name="UPN", const std::string &ext=".png", bool onlyActiveCanvases=false)
 
IVW_CORE_API bool isValidIdentifierCharacter (char c, const std::string &extra="")
 
IVW_CORE_API void validateIdentifier (const std::string &identifier, const std::string &type, ExceptionContext context, const std::string &extra="")
 
IVW_CORE_API std::string findUniqueIdentifier (const std::string &identifier, std::function< bool(const std::string &)> isUnique, const std::string &sep=" ")
 
IVW_CORE_API std::string cleanIdentifier (const std::string &identifier, const std::string &extra="")
 
IVW_CORE_API std::string stripModuleFileNameDecoration (std::string filePath)
 Removes inviwo-module from module library file name. Turns "/path/to/inviwo-module-yourmodule.dll" into "yourmodule". Returns filename without extension if inviwo-module was not found. More...
 
IVW_CORE_API std::string stripIdentifier (std::string identifier)
 
template<typename... Args>
void show (Args &&... args)
 
template<typename... Args>
void hide (Args &&... args)
 
template<typename C >
void forEachVoxel (const VolumeRAM &v, C callback)
 
template<typename C >
void forEachVoxelParallel (const VolumeRAM &v, C callback, size_t jobs=0)
 
bool IVW_CORE_API hasTimestamps (const VolumeSequence &seq, bool checkfirstonly=true)
 
std::pair< double, double > IVW_CORE_API getTimestampRange (const VolumeSequence &seq, bool sorted=true)
 
bool IVW_CORE_API isSorted (const VolumeSequence &seq)
 
VolumeSequence IVW_CORE_API sortSequence (const VolumeSequence &seq)
 
std::pair< SharedVolume, SharedVolume > IVW_CORE_API getVolumesForTimestep (const VolumeSequence &seq, double t, bool sorted=true)
 
bool IVW_CORE_API hasTimestamp (SharedVolume vol)
 
double IVW_CORE_API getTimestamp (SharedVolume vol)
 
bool IVW_CORE_API hasMargins (const std::shared_ptr< const Volume > &volume)
 
bool IVW_CORE_API isBricked (const std::shared_ptr< const Volume > &volume)
 
size3_t IVW_CORE_API getBrickDimensions (const std::shared_ptr< const Volume > &volume)
 
std::pair< vec3, vec3 > IVW_CORE_API getVolumeMargins (const std::shared_ptr< const Volume > &volume)
 return the margins of a volume, in normalized texture coordinates [0,1] More...
 
size3_t IVW_CORE_API getVolumeDimensions (const std::shared_ptr< const Volume > &volume)
 returns the true volume dimensions considering volume margins and bricking More...
 
double IVW_CORE_API voxelVolume (const Volume &volume)
 calculates the volume of a single voxel, taking the basis and the dimensions into account The units of the result is in the unit as the basis vectors ^3 More...
 
template<typename... T>
auto zip (T &&... args) -> detailzip::zipper< T... >
 
template<typename T >
auto make_sequence (const T &begin, const T &end, const T &inc) -> sequence< T >
 
template<typename T , typename... Ts>
auto enumerate (T &&cont, Ts &&... conts)
 
void IVW_QTEDITOR_API insertNetworkForData (const std::string &dataFile, ProcessorNetwork *net, bool alwaysFirst=false, bool onlySource=false)
 
template<>
bool isfinite (const half_float::half &v)
 
template<>
bool isnan (const half_float::half &v)
 
template<class T , typename std::enable_if< util::rank< T >::value==1 &&util::extent< T >::value==2, int >::type = 0>
bool isConvex (const std::vector< T > &polygon)
 check whether the given polygon is convex More...
 
template<class T , typename std::enable_if< util::rank< T >::value==1 &&util::extent< T >::value==2, int >::type = 0>
bool isInside (const std::vector< T > &hull, const T &p)
 check whether a given point lies within the convex hull More...
 
template<class T , typename std::enable_if< util::rank< T >::value==1 &&util::extent< T >::value==2, int >::type = 0>
double getArea (const std::vector< T > &polygon)
 compute the area of a convex polygon More...
 
template<class T , typename std::enable_if< util::rank< T >::value==1 &&util::extent< T >::value==2, int >::type = 0>
std::vector< T > convexHull (const std::vector< T > &points)
 compute the complex hull from a given set of 2D points using the Monotone Chain algorithm, i.e. Andrew's convex hull algorithm More...
 
std::shared_ptr< Mesh > IVW_MODULE_BASE_API convertHullToMesh (const std::vector< vec2 > &hull, bool useIndices=false)
 
IVW_MODULE_BASE_API std::pair< dvec4, dvec4 > volumeMinMax (const VolumeRAM *volume, IgnoreSpecialValues ignore=IgnoreSpecialValues::No)
 
IVW_MODULE_BASE_API std::pair< dvec4, dvec4 > layerMinMax (const LayerRAM *layer, IgnoreSpecialValues ignore=IgnoreSpecialValues::No)
 
IVW_MODULE_BASE_API std::pair< dvec4, dvec4 > bufferMinMax (const BufferRAM *layer, IgnoreSpecialValues ignore=IgnoreSpecialValues::No)
 
IVW_MODULE_BASE_API std::pair< dvec4, dvec4 > volumeMinMax (const Volume *volume, IgnoreSpecialValues ignore=IgnoreSpecialValues::No)
 
IVW_MODULE_BASE_API std::pair< dvec4, dvec4 > layerMinMax (const Layer *layer, IgnoreSpecialValues ignore=IgnoreSpecialValues::No)
 
IVW_MODULE_BASE_API std::pair< dvec4, dvec4 > bufferMinMax (const BufferBase *buffer, IgnoreSpecialValues ignore=IgnoreSpecialValues::No)
 
template<typename ValueType >
std::pair< dvec4, dvec4 > dataMinMax (const ValueType *data, size_t size, IgnoreSpecialValues ignore=IgnoreSpecialValues::No)
 
template<typename T , typename U , typename Predicate , typename ValueTransform , typename ProgressCallback >
void layerRAMDistanceTransform (const LayerRAMPrecision< T > *inLayer, LayerRAMPrecision< U > *outDistanceField, const Matrix< 2, U > basis, const size2_t upsample, Predicate predicate, ValueTransform valueTransform, ProgressCallback callback)
 
template<typename T , typename U >
void layerRAMDistanceTransform (const LayerRAMPrecision< T > *inVolume, LayerRAMPrecision< U > *outDistanceField, const Matrix< 2, U > basis, const size2_t upsample)
 
template<typename U , typename Predicate , typename ValueTransform , typename ProgressCallback >
void layerDistanceTransform (const Layer *inLayer, LayerRAMPrecision< U > *outDistanceField, const size2_t upsample, Predicate predicate, ValueTransform valueTransform, ProgressCallback callback)
 
template<typename U , typename ProgressCallback >
void layerDistanceTransform (const Layer *inLayer, LayerRAMPrecision< U > *outDistanceField, const size2_t upsample, double threshold, bool normalize, bool flip, bool square, double scale, ProgressCallback callback)
 
template<typename U >
void layerDistanceTransform (const Layer *inLayer, LayerRAMPrecision< U > *outDistanceField, const size2_t upsample, double threshold, bool normalize, bool flip, bool square, double scale)
 
IVW_MODULE_BASE_API std::shared_ptr< LayerRAMlayerSubSet (const Layer *in, ivec2 offset, size2_t extent, bool clampBorderOutsideImage=false)
 extracts a subregion from a layer and returns it as a new layer More...
 
template<typename T >
std::vector< T > haltonSequence (size_t base, size_t numberOfPoints)
 
template<typename T >
std::shared_ptr< ImagehaltonSequence (size2_t dims, size_t numberOfPoints, size_t baseX=2, size_t baseY=3)
 
template<typename T >
std::shared_ptr< VolumehaltonSequence (size3_t dims, size_t numberOfPoints, size_t baseX=2, size_t baseY=3, size_t baseZ=5)
 
template<typename T , typename Rand = std::mt19937, typename Dist = typename std::conditional<std::is_integral<T>::value, std::uniform_int_distribution<T>, std::uniform_real_distribution<T>>::type>
void randomSequence (T *data, size_t numberOfElements, Rand &randomNumberGenerator=Rand(), Dist &distribution=Dist(0, 1))
 
template<typename T , typename Rand = std::mt19937, typename Dist = typename std::conditional<std::is_integral<T>::value, std::uniform_int_distribution<T>, std::uniform_real_distribution<T>>::type>
std::shared_ptr< ImagerandomImage (size2_t dims, Rand &randomNumberGenerator=Rand(), Dist &distribution=Dist(0, 1))
 
template<typename T , typename Rand = std::mt19937, typename Dist = typename std::conditional<std::is_integral<T>::value, std::uniform_int_distribution<T>, std::uniform_real_distribution<T>>::type>
std::shared_ptr< VolumerandomVolume (size3_t dims, Rand &randomNumberGenerator=Rand(), Dist &distribution=Dist(0, 1))
 
template<typename Rand = std::mt19937>
std::shared_ptr< ImageperlinNoise (size2_t dims, float persistence, size_t startLevel, size_t endLevel, Rand &randomNumberGenerator=Rand())
 
template<typename Rand = std::mt19937>
std::shared_ptr< ImagepoissonDisk (size2_t dims, size_t poissonDotsAlongX, size_t maxPoints, Rand &randomNumberGenerator=Rand())
 
IVW_MODULE_BASE_API std::shared_ptr< Meshmarchingcubes (std::shared_ptr< const Volume > volume, double iso, const vec4 &color, bool invert, bool enclose, std::function< void(float)> progressCallback=std::function< void(float)>(), std::function< bool(const size3_t &)> maskingCallback=[](const size3_t &) { return true;})
 
IVW_MODULE_BASE_API std::shared_ptr< MeshmarchingCubesOpt (std::shared_ptr< const Volume > volume, double iso, const vec4 &color, bool invert, bool enclose, std::function< void(float)> progressCallback=nullptr, std::function< bool(const size3_t &)> maskingCallback=nullptr)
 
std::shared_ptr< Meshmarchingtetrahedron (std::shared_ptr< const Volume > volume, double iso, const vec4 &color=vec4(1.0f), bool invert=false, bool enclose=true, std::function< void(float)> progressCallback=std::function< void(float)>(), std::function< bool(const size3_t &)> maskingCallback=[](const size3_t &) { return true;})
 
IVW_MODULE_BASE_API std::unique_ptr< VolumecurlVolume (std::shared_ptr< const Volume > volume)
 
IVW_MODULE_BASE_API std::unique_ptr< VolumecurlVolume (const Volume &volume)
 
IVW_MODULE_BASE_API std::unique_ptr< VolumedivergenceVolume (const Volume &volume)
 
IVW_MODULE_BASE_API std::unique_ptr< VolumedivergenceVolume (std::shared_ptr< const Volume > volume)
 
template<typename Functor >
std::unique_ptr< VolumegenerateVolume (const size3_t &dimensions, const mat3 &basis, Functor &&function)
 
template<typename T = float>
std::unique_ptr< VolumemakeSingleVoxelVolume (const size3_t &size)
 
template<typename T = float>
std::unique_ptr< VolumemakeSphericalVolume (const size3_t &size)
 
template<typename T = float>
std::unique_ptr< VolumemakeRippleVolume (const size3_t &size)
 
template<typename T = float>
std::unique_ptr< VolumemakeMarchingCubeVolume (const size_t &index)
 
IVW_MODULE_BASE_API std::shared_ptr< VolumegradientVolume (std::shared_ptr< const Volume > volume, int channel)
 
IVW_MODULE_BASE_API std::shared_ptr< VolumevolumeLaplacian (std::shared_ptr< const Volume > volume, VolumeLaplacianPostProcessing postProcessing, double scale)
 
template<typename T , typename U , typename Predicate , typename ValueTransform , typename ProgressCallback >
void volumeRAMDistanceTransform (const VolumeRAMPrecision< T > *inVolume, VolumeRAMPrecision< U > *outDistanceField, const Matrix< 3, U > basis, const size3_t upsample, Predicate predicate, ValueTransform valueTransform, ProgressCallback callback)
 
template<typename T , typename U >
void volumeRAMDistanceTransform (const VolumeRAMPrecision< T > *inVolume, VolumeRAMPrecision< U > *outDistanceField, const Matrix< 3, U > basis, const size3_t upsample)
 
template<typename U , typename Predicate , typename ValueTransform , typename ProgressCallback >
void volumeDistanceTransform (const Volume *inVolume, VolumeRAMPrecision< U > *outDistanceField, const size3_t upsample, Predicate predicate, ValueTransform valueTransform, ProgressCallback callback)
 
template<typename U , typename ProgressCallback >
void volumeDistanceTransform (const Volume *inVolume, VolumeRAMPrecision< U > *outDistanceField, const size3_t upsample, double threshold, bool normalize, bool flip, bool square, double scale, ProgressCallback callback)
 
template<typename U >
void volumeDistanceTransform (const Volume *inVolume, VolumeRAMPrecision< U > *outDistanceField, const size3_t upsample, double threshold, bool normalize, bool flip, bool square, double scale)
 
IVW_MODULE_BASE_API std::shared_ptr< VolumeRAMvolumeSubSample (const VolumeRAM *in, size3_t factors)
 
IVW_MODULE_BASE_API size_t volumeSignificantVoxels (const VolumeRAM *volume, IgnoreSpecialValues ignore=IgnoreSpecialValues::No)
 
IVW_MODULE_BASE_API std::string writeIvfVolumeSequence (const VolumeSequence &volumes, std::string name, std::string path, std::string reltivePathToElements="", bool overwrite=true)
 Writes a volume sequence to disk. More...
 
void updateReaderFromFile (const FileProperty &file, TemplateOptionProperty< FileExtension > &reader)
 
template<typename... Types>
void updateFilenameFilters (const DataReaderFactory &rf, FileProperty &file, TemplateOptionProperty< FileExtension > &reader)
 
MeshDrawerGL::DrawMode getDrawMode (LineRenderer::LineDrawMode drawMode, bool useAdjacency)
 
IVW_MODULE_QTWIDGETS_API IvwKey mapKeyFromQt (const QKeyEvent *keyevent)
 
IVW_MODULE_QTWIDGETS_API void importFromFile (TFPrimitiveSet &primitiveSet, QWidget *parent=nullptr)
 Shows an InviwoFileDialog to import a TFPrimitiveSet from a file. Depending on the underlying type of primitiveSet, either TF primitives or isovalues are imported. More...
 
IVW_MODULE_QTWIDGETS_API void exportToFile (const TFPrimitiveSet &primitiveSet, QWidget *parent=nullptr)
 Shows an InviwoFileDialog to export a TFPrimitiveSet to a file. Depending on the underlying type of primitiveSet, either TF primitives or isovalues are exported. More...
 
IVW_MODULE_QTWIDGETS_API QMenu * addTFPresetsMenu (QWidget *parent, QMenu *menu, TransferFunctionProperty *property)
 create a submenu containing entries for TF presets of all transfer functions found in the path PathType::TransferFunctions. Upon selecting a menu entry, the respective preset will be loaded by property. The submenu will be disabled if property is read-only. More...
 
template<typename T , typename std::enable_if< util::rank< T >::value==1, int >::type = 0>
auto glm2eigen (const T &elem) -> Eigen::Matrix< typename T::value_type, util::extent< T, 0 >::value, 1 >
 
template<typename T , unsigned Rows, unsigned Cols, typename std::enable_if<(Rows > = 2 && Rows <= 4 && Cols >= 2 && Cols <= 4>
auto eigen2glm (const Eigen::Matrix< T, Rows, Cols > &m)
 
template<typename T , unsigned Rows, unsigned Cols, typename std::enable_if<(Cols > = 2 && Cols <= 4 && Rows == 1>
auto eigen2glm (const Eigen::Matrix< T, Cols, Cols > &m)
 
template<typename T >
std::shared_ptr< ImageeigenMatToImage (const T &m, bool flipY=false, std::string name="")
 
IVW_MODULE_FONTRENDERING_API TextTextureObject createTextTextureObject (TextRenderer &textRenderer, std::string text, vec4 fontColor, std::shared_ptr< Texture2D > tex=nullptr)
 Creates a texture with rendered text for a given string including its bounding box. More...
 
IVW_MODULE_FONTRENDERING_API std::shared_ptr< Texture2DcreateTextTexture (TextRenderer &textRenderer, std::string text, vec4 fontColor, std::shared_ptr< Texture2D > tex=nullptr)
 Creates a texture with rendered text for a given string. More...
 
std::vector< std::pair< std::string, std::string > > IVW_MODULE_FONTRENDERING_API getAvailableFonts (const std::string &fontPath=std::string())
 returns a list of all fonts found in the given directory, font directory of the fontrendering module More...
 
std::string IVW_MODULE_FONTRENDERING_API getDefaultFontPath ()
 returns the default font directory of Inviwo More...
 
IVW_MODULE_VECTORFIELDVISUALIZATION_API IntegralLine curvature (const IntegralLine &line, dmat4 toWorld)
 
IVW_MODULE_VECTORFIELDVISUALIZATION_API IntegralLineSet curvature (const IntegralLineSet &lines)
 
IVW_MODULE_VECTORFIELDVISUALIZATION_API void curvature (IntegralLine &line, dmat4 toWorld)
 
IVW_MODULE_VECTORFIELDVISUALIZATION_API void curvature (IntegralLineSet &lines)
 
IVW_MODULE_VECTORFIELDVISUALIZATION_API IntegralLine tortuosity (const IntegralLine &line, dmat4 toWorld)
 
IVW_MODULE_VECTORFIELDVISUALIZATION_API IntegralLineSet tortuosity (const IntegralLineSet &lines)
 
IVW_MODULE_VECTORFIELDVISUALIZATION_API void tortuosity (IntegralLine &line, dmat4 toWorld)
 
IVW_MODULE_VECTORFIELDVISUALIZATION_API void tortuosity (IntegralLineSet &lines)
 
IVW_CORE_API std::function< std::optional< mat4 >)> boundingBox (const DataInport< Mesh > &mesh)
 
IVW_CORE_API std::function< std::optional< mat4 >)> boundingBox (const DataInport< Mesh, 0 > &meshes)
 
IVW_CORE_API std::function< std::optional< mat4 >)> boundingBox (const DataInport< Mesh, 0, true > &meshes)
 
IVW_CORE_API std::function< std::optional< mat4 >)> boundingBox (const DataOutport< Mesh > &mesh)
 
IVW_CORE_API std::function< std::optional< mat4 >)> boundingBox (const DataInport< Volume > &volume)
 
IVW_CORE_API std::function< std::optional< mat4 >)> boundingBox (const DataInport< std::vector< std::shared_ptr< Volume >>> &volumes)
 
IVW_CORE_API std::function< std::optional< mat4 >)> boundingBox (const DataOutport< Volume > &volume)
 
IVW_CORE_API std::function< std::optional< mat4 >)> boundingBox (const DataOutport< std::vector< std::shared_ptr< Volume >>> &volumes)
 

Variables

template class IVW_CORE_TMPL_EXP TFPropertyModel< TransferFunctionProperty * >
 
template class IVW_CORE_TMPL_EXP TFPropertyModel< IsoValueProperty * >
 
template class IVW_CORE_TMPL_EXP TFPropertyModel< IsoTFProperty * >
 

Detailed Description

util

Typedef Documentation

◆ PrecisionType

template<typename T >
using inviwo::util::PrecisionType = typedef typename std::remove_pointer<typename std::remove_const<T>::type>::type

Utility for retrieving the type of a (Buffer/Layer/Volume)RamPrecision pointer variable. Example usage:

VolumeRam* volumeram = ...; // of some glm vector type.
auto count = volumeram->dispatch<size_t, dispatching::filter::Vecs>([](auto vrprecision) {
using VolumeType = util::PrecisionType<decltype(vrprecision)>;
....

VolumeType will then be for example VolumeRamPrecision<vec3>

◆ PrecisionValueType

template<typename T >
using inviwo::util::PrecisionValueType = typedef typename PrecisionType<T>::type

Utility for retrieving the type of a (Buffer/Layer/Volume)RamPrecision pointer variable. Example usage:

VolumeRam* volumeram = ...; // of some glm vector type.
auto count = volumeram->dispatch<size_t, dispatching::filter::Vecs>([](auto vrprecision) {
using ValueType = util::PrecisionValueType<decltype(vrprecision)>;
....

ValueType will then be for example vec3

Function Documentation

◆ addTFPresetsMenu()

QMenu * inviwo::util::addTFPresetsMenu ( QWidget *  parent,
QMenu *  menu,
TransferFunctionProperty property 
)

create a submenu containing entries for TF presets of all transfer functions found in the path PathType::TransferFunctions. Upon selecting a menu entry, the respective preset will be loaded by property. The submenu will be disabled if property is read-only.

Parameters
parentparent widget
menuparent menu to which the TF preset submenu should be added
propertythis property will load the TF presets once the menu entries are triggered
Returns
newly created submenu, which is owned by parent

◆ appendIfNotEmpty()

std::string inviwo::util::appendIfNotEmpty ( const std::string &  a,
const std::string &  b 
)

Appends b to a if a is not empty and returns a. Useful if an empty a is considered an error and we want to propagate that error.

◆ boundingBox() [1/5]

mat4 inviwo::util::boundingBox ( const Mesh mesh)

Calculate a bounding box of the position buffer of the mesh in world space. The bounding box is represented using a mat4, where all positions is between `bbox * (x,y,z,1) where x, y, and z are between 0 and 1.

◆ boundingBox() [2/5]

mat4 inviwo::util::boundingBox ( const std::vector< std::shared_ptr< const Mesh >> &  meshes)

Calculate a bounding box of the position buffers of all the meshs in world space. The bounding box is represented using a mat4, where all positions is between `bbox * (x,y,z,1) where x, y, and z are between 0 and 1.

◆ boundingBox() [3/5]

mat4 inviwo::util::boundingBox ( const Volume volume)

Calculate a bounding box of the volume in world space. The bounding box is represented using a mat4, where all positions is between `bbox * (x,y,z,1) where x, y, and z are between 0 and 1.

◆ boundingBox() [4/5]

mat4 inviwo::util::boundingBox ( const std::vector< std::shared_ptr< Volume >> &  volumes)

Calculate a bounding box of all the volumes in world space. The bounding box is represented using a mat4, where all positions is between `bbox * (x,y,z,1) where x, y, and z are between 0 and 1.

◆ boundingBox() [5/5]

std::function< std::optional< mat4 >)> inviwo::util::boundingBox ( const DataInport< Mesh > &  mesh)

Construct function the returns the bounding box of the data in the port. I the port is empty the function should return std::nullopt;

◆ convexHull()

template<class T , typename std::enable_if< util::rank< T >::value==1 &&util::extent< T >::value==2, int >::type = 0>
std::vector< T > inviwo::util::convexHull ( const std::vector< T > &  points)

compute the complex hull from a given set of 2D points using the Monotone Chain algorithm, i.e. Andrew's convex hull algorithm

See also
https://en.wikipedia.org/wiki/Convex_hull_algorithms#Algorithms
Parameters
pointsset of 2D points
Returns
complex hull of input points

◆ createTextTexture()

std::shared_ptr< Texture2D > inviwo::util::createTextTexture ( TextRenderer textRenderer,
std::string  text,
vec4  fontColor,
std::shared_ptr< Texture2D tex = nullptr 
)

Creates a texture with rendered text for a given string.

Creates a texture with a text string using the specified renderer and color. May take an additional variable tex of an existing texture that can be reused to reduce the number of times we need to allocating new textures.

The size of the texture will be the smallest possible for the given text and the pixels containing no text will have zero alpha.

For correct alignment of the baseline, the position of where this texture will be rendered must be adjusted by pos + computeBoundingBox(text).glyphsOrigin. See also TextOverlayGL::process() as an example.

Parameters
textRendererThe renderer that will be used to render the text
texttext to be rendered
fontColorthe final color of the text
texoptional cache texture which will be reused if possible
Returns
texture containing the text

◆ createTextTextureObject()

TextTextureObject inviwo::util::createTextTextureObject ( TextRenderer textRenderer,
std::string  text,
vec4  fontColor,
std::shared_ptr< Texture2D tex = nullptr 
)

Creates a texture with rendered text for a given string including its bounding box.

Creates a texture with rendered text for a string using the specified renderer and color. May take an additional variable tex of an existing texture that can be reused to reduce the number of times we need to allocating new textures. The resulting texture is returned along with the respective bounding box.

The size of the texture will be the smallest possible for the given text. All pixels containing no text will have zero alpha.

For correct alignment of the baseline, the position of where this texture will be rendered must be adjusted by pos + TextTextureObject.glyphsOrigin. See also TextOverlayGL::process() as an example.

Parameters
textRendererThe renderer that will be used to render the text
textstring to be rendered
fontColorthe final color of the text
texoptional cache texture which will be reused if possible (same texture will be returned)
Returns
text texture object referring to both texture and corresponding bounding box

◆ dataMinMax()

template<typename ValueType >
std::pair<dvec4, dvec4> inviwo::util::dataMinMax ( const ValueType *  data,
size_t  size,
IgnoreSpecialValues  ignore = IgnoreSpecialValues::No 
)

Compute component-wise minimum and maximum values scalar and glm::vec types.

Parameters
datapointer to values
sizeof data
ignoreinfinite and NaN
Returns
minimum and maximum values of each component and zero for non-existing components

◆ enumerate()

template<typename T , typename... Ts>
auto inviwo::util::enumerate ( T &&  cont,
Ts &&...  conts 
)

Enumerate element in a container. Example use case: std::vector<int> vec(10); for (auto&& item : util::enumerate(vec)) { auto&& ind = item.first(); auto&& elem = item.second(); // alternatively, get<0>(item) and get<1>(item) can be used }

with C++17 structured bindings for (auto&& [ind, elem] : util::enumerate(vec)) {

}

◆ expandCompositeProcessorIntoNetwork()

void inviwo::util::expandCompositeProcessorIntoNetwork ( CompositeProcessor composite)

Expand a composite processors sub network into its network. Effectively reversing the actions of replaceSelectionWithCompositeProcessor. All processor except for composite sink and composite source processors are moved from the sub network into the network of the composite processor. Connections and links are the reestablished. Sources and sinks are discarded.

◆ exportToFile()

void inviwo::util::exportToFile ( const TFPrimitiveSet primitiveSet,
QWidget *  parent = nullptr 
)

Shows an InviwoFileDialog to export a TFPrimitiveSet to a file. Depending on the underlying type of primitiveSet, either TF primitives or isovalues are exported.

Parameters
primitiveSetprimitive set to be exported (either TF or isovalues)
parentparent widget of the file dialog

◆ filled()

template<typename M , typename T = typename M::value_type>
M inviwo::util::filled ( v)

Utility function to create a matrix filled with a constant. For example:

auto m = util::filled<mat3>(3.16);
// | 3.16 3.16 3.16 |
// | 3.16 3.16 3.16 |
// | 3.16 3.16 3.16 |

◆ findUniqueIdentifier()

std::string inviwo::util::findUniqueIdentifier ( const std::string &  identifier,
std::function< bool(const std::string &)>  isUnique,
const std::string &  sep = " " 
)

Utility to augment an identifier with a number to make it unique. Will add an increasing number to the end of the given identifier until the isUnique test returns true. Example for a processor identifier: auto uniqueIdentifier = util::findUniqueIdentifier( startIdentifier, [&](const std::string& id) { return processorNetwork->getProcessorByIdentifier(id) == nullptr; }, "" );

◆ forEach()

template<typename Iterable , typename Callback >
void inviwo::util::forEach ( const Iterable &  iterable,
Callback &&  callback 
)

Utility function to iterate over all element in an iterable data structure (such as std::vector).

Parameters
iterablethe data structure to iterate over
callbackto call for each element, can be either [](auto &a){} or [](auto &a, size_t id){} where a is an data item from the iterable data structure and id is the index in the data structure

◆ forEachParallel()

template<typename Iterable , typename Callback >
void inviwo::util::forEachParallel ( const Iterable &  iterable,
Callback &&  callback,
size_t  jobs = 0 
)

Use multiple threads to iterate over all elements in an iterable data structure (such as std::vector). If the Inviwo pool size is zero it will be executed directly in the same thread as the caller. The function will return once all jobs as has finished processing.

Parameters
iterablethe data structure to iterate over
callbackto call for each element, can be either [](auto &a){} or [](auto &a, size_t id){} where a is an data item from the iterable data structure and id is the index in the data structure
jobsoptional parameter specifying how many jobs to create, if jobs==0 (default) it will create pool size * 4 jobs

◆ forEachParallelAsync()

template<typename Iterable , typename Callback , typename OnDoneCallback >
std::vector<std::future<void> > inviwo::util::forEachParallelAsync ( const Iterable &  iterable,
Callback &&  callback,
size_t  jobs,
OnDoneCallback &&  onTaskDone 
)

Use multiple threads to iterate over all elements in an iterable data structure (such as std::vector). If the Inviwo pool size is zero it will be executed directly in the same thread as the caller. The function will return once all jobs as has been created and queued.

Parameters
iterablethe data structure to iterate over
callbackto call for each element, can be either [](auto &a){} or [](auto &a, size_t id){} where a is an data item from the iterable data structure and id is the index in the data structure
jobsoptional parameter specifying how many jobs to create, if jobs==0 (default) it will create pool size * 4 jobs
onTaskDonecallback that will be called when each job is done
Returns
a vector of futures, one for each job created.

◆ generateVolume()

template<typename Functor >
std::unique_ptr<Volume> inviwo::util::generateVolume ( const size3_t &  dimensions,
const mat3 &  basis,
Functor &&  function 
)

Convenience function for generating volumes

Parameters
dimensionsVolume grid dimensions
basisVolume basis, offset automatically set to center the volume around origo
functionFunctor called for each volume voxel. T(const size3_t& ind).

◆ getArea()

template<class T , typename std::enable_if< util::rank< T >::value==1 &&util::extent< T >::value==2, int >::type = 0>
double inviwo::util::getArea ( const std::vector< T > &  polygon)

compute the area of a convex polygon

Parameters
polygonpoints ordered counter-clockwise
Returns
area of polygon

◆ getAvailableFonts()

std::vector< std::pair< std::string, std::string > > inviwo::util::getAvailableFonts ( const std::string &  fontPath = std::string())

returns a list of all fonts found in the given directory, font directory of the fontrendering module

Parameters
fontPathpath to fonts. If empty, the directory returned by getDefaultPath() will be used.
Returns
font list containing pairs for all available fonts. Each pair holds the font name and the full path. Fonts are sorted alphabetically

◆ getBoundingBox() [1/2]

std::pair< ivec2, ivec2 > inviwo::util::getBoundingBox ( const std::vector< Processor * > &  processors)

Retrieve bounding box of the processors in the list. The return value is pair of the min x,y and the max x,y

◆ getBoundingBox() [2/2]

std::pair< ivec2, ivec2 > inviwo::util::getBoundingBox ( ProcessorNetwork network)

Retrieve bounding box of the processors in the network. The return value is pair of the min x,y and the max x,y

◆ getBuildInfo()

BuildInfo inviwo::util::getBuildInfo ( )

Accesses build information via an INI file or compile-time definitions.

Returns
build information

◆ getCenterPosition() [1/2]

ivec2 inviwo::util::getCenterPosition ( const std::vector< Processor * > &  processors)

Retrieve the mean position of the processors in the list.

◆ getCenterPosition() [2/2]

ivec2 inviwo::util::getCenterPosition ( ProcessorNetwork network)

Retrieve the mean position of the processors in the network.

◆ getDefaultFontPath()

std::string inviwo::util::getDefaultFontPath ( )

returns the default font directory of Inviwo

Returns
default path containing fonts shipped with Inviwo. Corresponds to the font directory located in the font rendering module directory.

◆ getDefaultTimerThread()

TimerThread & inviwo::util::getDefaultTimerThread ( )

Utility function to get the default TimerThread from the app.

◆ getInviwoApplication() [1/5]

InviwoApplication * inviwo::util::getInviwoApplication ( ProcessorNetwork network)

Utility function to get the InviwoApplication from a ProcessorNetwork

◆ getInviwoApplication() [2/5]

InviwoApplication * inviwo::util::getInviwoApplication ( Processor processor)

Utility function to get the InviwoApplication from a Processor

◆ getInviwoApplication() [3/5]

InviwoApplication * inviwo::util::getInviwoApplication ( PropertyOwner owner)

Utility function to get the InviwoApplication from a PropertyOwner

◆ getInviwoApplication() [4/5]

InviwoApplication * inviwo::util::getInviwoApplication ( Property property)

Utility function to get the InviwoApplication from a Property

◆ getInviwoApplication() [5/5]

InviwoApplication * inviwo::util::getInviwoApplication ( )

Utility function to get the InviwoApplication

◆ getLibrarySearchPaths()

std::vector< std::string > inviwo::util::getLibrarySearchPaths ( )

Returns paths to search for module libraries. All platforms: executable directory and application modules directory (AppData/Inviwo/modules on windows). Platform dependent search directories: OSX: DYLD_LIBRARY_PATH UNIX: LD_LIBRARY_PATH/LD_RUN_PATH, RPATH and "executable directory /../../lib".

Returns
List of paths to directories

◆ getMetaData() [1/2]

const ProcessorMetaData * inviwo::util::getMetaData ( const Processor processor)

Retrieve the meta data of the processor.

◆ getMetaData() [2/2]

ProcessorMetaData * inviwo::util::getMetaData ( Processor processor)

Retrieve the meta data of the processor.

◆ getPosition()

ivec2 inviwo::util::getPosition ( const Processor processor)

Retrieve the position of the processor.

◆ getPositions() [1/2]

std::vector< ivec2 > inviwo::util::getPositions ( const std::vector< Processor * > &  processors)

Retrieve the positions of the processors in the list.

◆ getPositions() [2/2]

std::vector< ivec2 > inviwo::util::getPositions ( ProcessorNetwork network)

Retrieve the positions of the processors in the network.

◆ getVolumeDimensions()

size3_t inviwo::util::getVolumeDimensions ( const std::shared_ptr< const Volume > &  volume)

returns the true volume dimensions considering volume margins and bricking

Returns
true volume dimensions

◆ getVolumeMargins()

std::pair< vec3, vec3 > inviwo::util::getVolumeMargins ( const std::shared_ptr< const Volume > &  volume)

return the margins of a volume, in normalized texture coordinates [0,1]

Returns
pair of margins from the bottom left corner and the top right corner

◆ haltonSequence() [1/3]

template<typename T >
std::vector<T> inviwo::util::haltonSequence ( size_t  base,
size_t  numberOfPoints 
)

Generate a sequence of length numberOfPoints of pseduo-random numbers on the open range (0 1).

See also
https://en.wikipedia.org/wiki/Halton_sequence
Parameters
basewhat base to use to generate fractions
numberOfPointsamount of points to generate

◆ haltonSequence() [2/3]

template<typename T >
std::shared_ptr<Image> inviwo::util::haltonSequence ( size2_t  dims,
size_t  numberOfPoints,
size_t  baseX = 2,
size_t  baseY = 3 
)

Generate an Image with sparse noise based on a pair of two Halton Sequences.

See also
haltonSequence(size_t base, size_t numberOfPoints)
https://en.wikipedia.org/wiki/Halton_sequence
Parameters
dimssize of the resulting image.
numberOfPointsnumber of points to generate
baseXbase used for the fractions to generate the x-values
baseYbase used for the fractions to generate the y-values

◆ haltonSequence() [3/3]

template<typename T >
std::shared_ptr<Volume> inviwo::util::haltonSequence ( size3_t  dims,
size_t  numberOfPoints,
size_t  baseX = 2,
size_t  baseY = 3,
size_t  baseZ = 5 
)

Generate an Volume with sparse noise based on a three Halton Sequences.

See also
haltonSequence(size_t base, size_t numberOfPoints)
https://en.wikipedia.org/wiki/Halton_sequence
Parameters
dimssize of the resulting Volume.
numberOfPointsnumber of points to generate
baseXbase used for the fractions to generate the x-values
baseYbase used for the fractions to generate the y-values
baseZbase used for the fractions to generate the z-values

◆ hash_combine()

template<class T >
constexpr void inviwo::util::hash_combine ( std::size_t &  seed,
const T &  v 
)
noexcept

◆ importFromFile()

void inviwo::util::importFromFile ( TFPrimitiveSet primitiveSet,
QWidget *  parent = nullptr 
)

Shows an InviwoFileDialog to import a TFPrimitiveSet from a file. Depending on the underlying type of primitiveSet, either TF primitives or isovalues are imported.

Parameters
primitiveSettarget primitive set which might either be a TF or isovalues
parentparent widget of the file dialog

◆ is_callable_with()

template<typename... A, typename F >
constexpr bool inviwo::util::is_callable_with ( F &&  )

A type trait to determine if type "callback" cann be called with certain arguments. Example: util::is_callable_with<float>(callback) where callback = [](float){} -> true callback = [](std::string){} -> false

◆ isConvex()

template<class T , typename std::enable_if< util::rank< T >::value==1 &&util::extent< T >::value==2, int >::type = 0>
bool inviwo::util::isConvex ( const std::vector< T > &  polygon)

check whether the given polygon is convex

Parameters
polygonpolygon consisting of points
Returns
true if the polygon is convex, false otherwise

◆ isInside()

template<class T , typename std::enable_if< util::rank< T >::value==1 &&util::extent< T >::value==2, int >::type = 0>
bool inviwo::util::isInside ( const std::vector< T > &  hull,
const T &  p 
)

check whether a given point lies within the convex hull

Parameters
hullconvex hull
ppoint
Returns
true if the point lies inside the convex hull

◆ isSelected()

bool inviwo::util::isSelected ( const Processor processor)

Retrieve the selection state of processor.

◆ layerRAMDistanceTransform()

template<typename T , typename U , typename Predicate , typename ValueTransform , typename ProgressCallback >
void inviwo::util::layerRAMDistanceTransform ( const LayerRAMPrecision< T > *  inLayer,
LayerRAMPrecision< U > *  outDistanceField,
const Matrix< 2, U >  basis,
const size2_t  upsample,
Predicate  predicate,
ValueTransform  valueTransform,
ProgressCallback  callback 
)

Implementation of Euclidean Distance Transform according to Saito's algorithm: T. Saito and J.I. Toriwaki. New algorithms for Euclidean distance transformations of an n-dimensional digitized picture with applications. Pattern Recognition, 27(11). pp. 1551-1565, 1994. http://www.cs.jhu.edu/~misha/ReadingSeminar/Papers/Saito94.pdf

Calculates the distance in base mat space

  • Predicate is a function of type (const T &value) -> bool to deside if a value in the input is a "feature".
  • ValueTransform is a function of type (const U& squaredDist) -> U that is appiled to all squared distance values at the end of the calculation.
  • ProcessCallback is a function of type (double progress) -> void that is called with a value from 0 to 1 to indicate the progress of the calculation.

◆ layerSubSet()

std::shared_ptr< LayerRAM > inviwo::util::layerSubSet ( const Layer in,
ivec2  offset,
size2_t  extent,
bool  clampBorderOutsideImage = false 
)

extracts a subregion from a layer and returns it as a new layer

extracts a subregion from a layer and converts it into a new layer

This function extracts a subregion given by offset and extent from the input layer. If border clamping is enabled, the output region will be clamped to lie completely within the source layer. Otherwise (default), the areas outside the source layer will be filled with zeros.

Parameters
ininput layer
offsetsubregion offset in input layer
extentextent (width and height) of subregion
clampBorderOutsideImageif true, the output region is clamped to the layer boundaries
Returns
std::shared_ptr<LayerRAM>

This function extracts a subregion given by offset and extent from the input layer. The values will be converted to type T using util::glm_convert_normalized. If border clamping is enabled, the output region will be clamped to lie completely within the source layer. Otherwise (default), the areas outside the source layer will be filled with zeros.

Parameters
ininput layer
offsetsubregion offset in input layer
extentextent (width and height) of subregion
clampBorderOutsideImageif true, the output region is clamped to the layer boundaries
Returns
std::shared_ptr<LayerRAMPrecision<T>>

◆ make_sequence()

template<typename T >
auto inviwo::util::make_sequence ( const T &  begin,
const T &  end,
const T &  inc 
) -> sequence<T>

Convenvience function for creating a sequence. Use case example:

auto inc = 2; auto end = 3;
for (auto&& i : util::make_sequence(0, end, inc)) {
// Iterates over 0 and 2
}

◆ makeIndirectIterator()

template<bool PropagateConst = true, typename Iter >
IndirectIterator<Iter, PropagateConst> inviwo::util::makeIndirectIterator ( Iter &&  iter)

◆ makeMarchingCubeVolume()

template<typename T = float>
std::unique_ptr<Volume> inviwo::util::makeMarchingCubeVolume ( const size_t &  index)

A 2x2x2 volume corresponding to a marching cube case

◆ makeProcessor()

template<typename T , typename... Args>
std::unique_ptr<T> inviwo::util::makeProcessor ( ivec2  pos,
Args &&...  args 
)

A utility function to create a processor and set identifier, display name, and position

Parameters
posSets the position meta data of the Processor
argsAny extra arguments to supply to the Processor constructor

◆ makeRippleVolume()

template<typename T = float>
std::unique_ptr<Volume> inviwo::util::makeRippleVolume ( const size3_t &  size)

A quickly oscillating density between 0 and 1

◆ makeSingleVoxelVolume()

template<typename T = float>
std::unique_ptr<Volume> inviwo::util::makeSingleVoxelVolume ( const size3_t &  size)

Center voxel equal to 1 all other 0

◆ makeSphericalVolume()

template<typename T = float>
std::unique_ptr<Volume> inviwo::util::makeSphericalVolume ( const size3_t &  size)

Spherically symmetric density centered in the volume decaying radially with the distance from the center

◆ marchingcubes()

std::shared_ptr< Mesh > inviwo::util::marchingcubes ( std::shared_ptr< const Volume volume,
double  iso,
const vec4 &  color,
bool  invert,
bool  enclose,
std::function< void(float)>  progressCallback = std::function<void(float)>(),
std::function< bool(const size3_t &)>  maskingCallback = [](const size3_t &) { return true; } 
)

Extracts an isosurface from a volume using the Marching Cubes algorithm

Note: Share interface with util::marchingtetrahedron

Parameters
volumethe scalar volume
isoiso-value for the extracted surface
colorthe color of the resulting surface
invertflips the normals of the surface normals (useful when values greater than the iso-value is 'outside' of the surface)
enclosewhether to create surface where the isosurface intersects the volume boundaries
progressCallbackif set, will be called will executing with the current progress in the interval [0,1], usefull for progressbars
maskingCallbackoptional callback to test whether current cell should be evaluated or not (return true to include current cell)

◆ marchingCubesOpt()

std::shared_ptr< Mesh > inviwo::util::marchingCubesOpt ( std::shared_ptr< const Volume volume,
double  iso,
const vec4 &  color,
bool  invert,
bool  enclose,
std::function< void(float)>  progressCallback = nullptr,
std::function< bool(const size3_t &)>  maskingCallback = nullptr 
)

Extracts an iso surface from a volume using the Marching Cubes algorithm

Note: Shares interface with util::marchingcbes and util::marchingtetrahedron This is an optimized version of util::marchingcubes

Parameters
volumethe scalar volume
isoiso-value for the extracted surface
colorthe color of the resulting surface
invertflips the normals of the surface normals (useful when values greater than the iso-value is 'outside' of the surface)
enclosewhether to create surface where the iso surface intersects the volume boundaries
progressCallbackif set, will be called will executing with the current progress in the interval [0,1], useful for progress bars
maskingCallbackoptional callback to test whether current cell should be evaluated or not (return true to include current cell)

◆ marchingtetrahedron()

std::shared_ptr< Mesh > inviwo::util::marchingtetrahedron ( std::shared_ptr< const Volume volume,
double  iso,
const vec4 &  color = vec4(1.0f),
bool  invert = false,
bool  enclose = true,
std::function< void(float)>  progressCallback = std::function<void(float)>(),
std::function< bool(const size3_t &)>  maskingCallback = [](const size3_t &) { return true; } 
)

Extracts an isosurface from a volume using the Marching Tetrahedron algorithm

Note: Share interface with util::marchingcubes

Parameters
volumethe scalar volume
isoiso-value for the extracted surface
colorthe color of the resulting surface
invertflips the normals of the surface normals (useful when values greater than the iso-value is 'outside' of the surface)
enclosewhether to create surface where the isosurface intersects the volume boundaries
progressCallbackif set, will be called will executing with the current progress in the interval [0,1], usefull for progressbars
maskingCallbackoptional callback to test whether current cell should be evaluated or not (return true to include current cell)

◆ offsetPosition()

void inviwo::util::offsetPosition ( const std::vector< Processor * > &  processors,
ivec2  offset 
)

Offset all the positions of the processors in the list by offset

◆ perlinNoise()

template<typename Rand = std::mt19937>
std::shared_ptr<Image> inviwo::util::perlinNoise ( size2_t  dims,
float  persistence,
size_t  startLevel,
size_t  endLevel,
Rand &  randomNumberGenerator = Rand() 
)

Generate an Image with perlin noise, a cloud like noise using the sum of several white noise images with different frequencies

Parameters
dimsSize of the output image
persistencecontrols the amplitude used in the different frequencies
startLevelcontrols the min level used. The level is determining the frequency to use in each white noise image as 2^level
endLevelcontrolsthe max level used.
randomNumberGeneratorthe Random number generator to use, defaults to the Mersenne Twister engine (std::mt19937)

◆ poissonDisk()

template<typename Rand = std::mt19937>
std::shared_ptr<Image> inviwo::util::poissonDisk ( size2_t  dims,
size_t  poissonDotsAlongX,
size_t  maxPoints,
Rand &  randomNumberGenerator = Rand() 
)

Generate an Image with sparse noise based on the perlin noise algorith.

See also
http://devmag.org.za/2009/05/03/poisson-disk-sampling/
Parameters
dimsSize of the output image
poissonDotsAlongXcontrolls the amount on points there is on average per line, set the minimum distance between points
maxPointsa fallback variable to prevent generating to many points
randomNumberGeneratorthe Random number generator to use, defaults to the Mersenne Twister engine (std::mt19937)

◆ randomImage()

template<typename T , typename Rand = std::mt19937, typename Dist = typename std::conditional<std::is_integral<T>::value, std::uniform_int_distribution<T>, std::uniform_real_distribution<T>>::type>
std::shared_ptr<Image> inviwo::util::randomImage ( size2_t  dims,
Rand &  randomNumberGenerator = Rand(),
Dist &  distribution = Dist(0, 1) 
)

Generate an Image with white noise based using C++ a given random number generator and distribution.

Parameters
dimsSize of the output image
randomNumberGeneratorthe Random number generator to use, defaults to the Mersenne Twister engine (std::mt19937)
distributionthe distribution to use for the random numbers, defaults to std::uniform_int/real_distribution between zero and one

◆ randomSequence()

template<typename T , typename Rand = std::mt19937, typename Dist = typename std::conditional<std::is_integral<T>::value, std::uniform_int_distribution<T>, std::uniform_real_distribution<T>>::type>
void inviwo::util::randomSequence ( T *  data,
size_t  numberOfElements,
Rand &  randomNumberGenerator = Rand(),
Dist &  distribution = Dist(0, 1) 
)

Fills a data container of type T with numberOfElements random numbers using the given random number generator and distribution

◆ randomVolume()

template<typename T , typename Rand = std::mt19937, typename Dist = typename std::conditional<std::is_integral<T>::value, std::uniform_int_distribution<T>, std::uniform_real_distribution<T>>::type>
std::shared_ptr<Volume> inviwo::util::randomVolume ( size3_t  dims,
Rand &  randomNumberGenerator = Rand(),
Dist &  distribution = Dist(0, 1) 
)

Generate an Volume with white noise based using C++ a given random number generator and distribution.

Parameters
dimsSize of the output Volume
randomNumberGeneratorthe Random number generator to use, defaults to the Mersenne Twister engine (std::mt19937)
distributionthe distribution to use for the random numbers, defaults to std::uniform_int/real_distribution between zero and one

◆ replaceSelectionWithCompositeProcessor()

void inviwo::util::replaceSelectionWithCompositeProcessor ( ProcessorNetwork network)

Create a CompositeProcessor out of the currently selected processors and replace them with the composite processors. The selected processors are moved from the current network into the sub network of the composite processor. For each port connection between a selected and unselected processor a composite sink or composite source processor is added to the sub network and connections are made from the selected processor to the sink/source and from the composite processor to the unselected processor. For each link between a selected and unselected processor, a super property is added to the composite processor and the link added to it.

◆ reverse()

void inviwo::util::reverse ( BufferBase b)

Utility function to reverse the orders of the elements in a buffer.

Parameters
bthe buffer to reverse

◆ setPosition()

void inviwo::util::setPosition ( Processor processor,
ivec2  pos 
)

Set the position of processor to pos

◆ setSelected() [1/2]

void inviwo::util::setSelected ( Processor processor,
bool  selected 
)

Set the selection state of processor

◆ setSelected() [2/2]

void inviwo::util::setSelected ( const std::vector< Processor * > &  processors,
bool  selected 
)

Set the listed processors as selected or unSelected.

◆ stripModuleFileNameDecoration()

std::string inviwo::util::stripModuleFileNameDecoration ( std::string  filePath)

Removes inviwo-module from module library file name. Turns "/path/to/inviwo-module-yourmodule.dll" into "yourmodule". Returns filename without extension if inviwo-module was not found.

Parameters
filePathPath to module file
Returns
name of the module

◆ toWstring()

std::wstring inviwo::util::toWstring ( const std::string &  str)

convert the given std::string to std::wstring. On Windows, MultiByteToWideChar is used for this conversion assuming utf8 encoding. Otherwise, std::mbsrtowcs is used.

Parameters
strmultibyte character string
Returns
input converted to std::wstring

◆ volumeRAMDistanceTransform()

template<typename T , typename U , typename Predicate , typename ValueTransform , typename ProgressCallback >
void inviwo::util::volumeRAMDistanceTransform ( const VolumeRAMPrecision< T > *  inVolume,
VolumeRAMPrecision< U > *  outDistanceField,
const Matrix< 3, U >  basis,
const size3_t  upsample,
Predicate  predicate,
ValueTransform  valueTransform,
ProgressCallback  callback 
)

Implementation of Euclidean Distance Transform according to Saito's algorithm: T. Saito and J.I. Toriwaki. New algorithms for Euclidean distance transformations of an n-dimensional digitized picture with applications. Pattern Recognition, 27(11). pp. 1551-1565, 1994. http://www.cs.jhu.edu/~misha/ReadingSeminar/Papers/Saito94.pdf

Calculates the distance in grid index space

  • Predicate is a function of type (const T &value) -> bool to deside if a value in the input is a "feature".
  • ValueTransform is a function of type (const U& squaredDist) -> U that is appiled to all squared distance values at the end of the calculation.
  • ProcessCallback is a function of type (double progress) -> void that is called with a value from 0 to 1 to indicate the progress of the calculation.

◆ voxelVolume()

double inviwo::util::voxelVolume ( const Volume volume)

calculates the volume of a single voxel, taking the basis and the dimensions into account The units of the result is in the unit as the basis vectors ^3

Returns
volume of one voxel

◆ writeIvfVolumeSequence()

std::string inviwo::util::writeIvfVolumeSequence ( const VolumeSequence &  volumes,
std::string  name,
std::string  path,
std::string  reltivePathToElements = "",
bool  overwrite = true 
)

Writes a volume sequence to disk.

Writes a volume sequence to disk. Will create one main file ([name].ivfs) and a series of ivf volumes ([name]xx.ivf), one for each element in the sequence.

Parameters
volumesThe volume sequence to export
namethe name of the dataset, will be used for to name the output files [name].ivfs and [name]xx.ivf
pathpath to the folder to put the main file
reltivePathToElementsrelative path (from the path to the main file) to where the sequence elements will be written
overwritewhether or not to overwrite existing files.
Returns
path to the created main-file
See also
inviwo::IvfSequenceVolumeWriter
inviwo::IvfSequenceVolumeReader

◆ zip()

template<typename... T>
auto inviwo::util::zip ( T &&...  args) -> detailzip::zipper<T...>

Iterate over containers in sync. Example use case 1:

std::vector<int> a(10);
std::vector<int> b(10);
for (auto&& i : util::zip(a, b)) {
std::cout << i.first() << " " << i.second() << std::endl;
// alternatively, get<0>(i) and get<1>(i) can be used
}

with C++17 structured bindings:

for (auto&& [i, j] : util::enumerate(vec)) {
std::cout << i << " " << j << std::endl;
}