![]() |
Inviwo 0.9.12-pre
Inviwo documentation
|
Specialized data column representing categorical values, i.e. strings. Categorical values are internally mapped to a number representation. More...
#include <inviwo/dataframe/datastructures/column.h>
Public Types | |
| using | ConstIterator |
| using | type = std::uint32_t |
Public Member Functions | |
| virtual void | add (std::string_view value) override |
| std::uint32_t | addCategory (std::string_view cat) |
Add a category cat. It will not be added if the category already exists. | |
| AddMany | addMany () |
| virtual void | append (const Column &col) override |
| and builds a union of all categorical values | |
| void | append (const std::vector< std::string > &data) |
Append the categorical values given in data. | |
| CategoricalColumn (CategoricalColumn &&rhs)=default | |
| CategoricalColumn (const CategoricalColumn &rhs) | |
| CategoricalColumn (const CategoricalColumn &rhs, std::span< const std::uint32_t > rowSelection) | |
| CategoricalColumn (std::string_view header, const std::vector< std::string > &values={}, Unit unit=Unit{}, std::optional< dvec2 > range=std::nullopt) | |
| CategoricalColumn (std::string_view header, std::vector< type > data, std::vector< std::string > lookup, Unit unit=Unit{}, std::optional< dvec2 > range=std::nullopt) | |
| virtual CategoricalColumn * | clone () const override |
| virtual CategoricalColumn * | clone (std::span< const std::uint32_t > rowSelection) const override |
| const std::vector< std::string > & | getCategories () const |
| virtual ColumnType | getColumnType () const override |
| virtual std::optional< dvec2 > | getCustomRange () const override |
| virtual dvec2 | getDataRange () const override |
| virtual const std::string & | getHeader () const override |
| virtual dvec2 | getRange () const override |
| virtual size_t | getSize () const override |
| virtual Unit | getUnit () const override |
| std::vector< std::string > | getValues () const |
| Returns column contents as list of categorical values. | |
| CategoricalColumn & | operator= (CategoricalColumn &&rhs) |
| CategoricalColumn & | operator= (const CategoricalColumn &rhs) |
| void | set (size_t idx, std::string_view str) |
| void | set (size_t idx, std::uint32_t id) |
| virtual void | setCustomRange (std::optional< dvec2 > range) override |
| void | setHeader (std::string_view header) override |
| virtual void | setUnit (Unit unit) override |
| util::iter_range< ConstIterator > | values () const |
| Public Member Functions inherited from inviwo::Column | |
| template<typename T> | |
| const std::vector< T > & | getContainer () const |
| template<typename T> | |
| std::vector< T > & | getEditableContainer () |
| BufferRAM * | getEditableRAMRepresentation () |
| template<typename T> | |
| T * | getEditableRepresentation () |
| const BufferRAM * | getRAMRepresentation () const |
| template<typename T> | |
| const T * | getRepresentation () const |
| Public Member Functions inherited from inviwo::MetaDataOwner | |
| void | copyMetaDataFrom (const MetaDataOwner &src) |
| void | copyMetaDataTo (MetaDataOwner &dst) |
| template<typename T> | |
| T * | createMetaData (std::string_view key) |
| void | deserialize (Deserializer &d) |
| template<typename T> | |
| T * | getMetaData (std::string_view key) |
| template<typename T> | |
| const T * | getMetaData (std::string_view key) const |
| template<typename T, typename U> | |
| U | getMetaData (std::string_view key, U val) const |
| MetaDataMap * | getMetaDataMap () |
| const MetaDataMap * | getMetaDataMap () const |
| template<typename T> | |
| bool | hasMetaData (std::string_view key) const |
| bool | hasMetaData (std::string_view key) const |
| MetaDataOwner (const MetaDataOwner &rhs)=default | |
| MetaDataOwner (MetaDataOwner &rhs)=default | |
| MetaDataOwner & | operator= (const MetaDataOwner &rhs)=default |
| MetaDataOwner & | operator= (MetaDataOwner &)=default |
| void | serialize (Serializer &s) const |
| template<typename T, typename U> | |
| void | setMetaData (std::string_view key, U value) |
| template<typename T> | |
| bool | unsetMetaData (std::string_view key) |
| unset, i.e. remove the metadata entry matching the given key and type | |
| const std::string & | get (size_t idx) const |
| virtual std::string | getAsString (size_t idx) const override |
| std::uint32_t | getId (size_t idx) const |
| virtual double | getAsDouble (size_t idx) const override |
| ConstIterator | begin () const |
| ConstIterator | end () const |
| virtual std::shared_ptr< BufferBase > | getBuffer () override |
| virtual std::shared_ptr< const BufferBase > | getBuffer () const override |
| std::shared_ptr< Buffer< std::uint32_t > > | getTypedBuffer () |
| std::shared_ptr< const Buffer< std::uint32_t > > | getTypedBuffer () const |
Additional Inherited Members | |
| Protected Member Functions inherited from inviwo::Column | |
| Column (Column &&)=default | |
| Column (const Column &)=default | |
| Column & | operator= (Column &&)=default |
| Column & | operator= (const Column &)=default |
| Protected Attributes inherited from inviwo::MetaDataOwner | |
| MetaDataMap | metaData_ |
Specialized data column representing categorical values, i.e. strings. Categorical values are internally mapped to a number representation.
For example: The data column "blue", "blue", "red", "yellow" might internally be represented by 0, 0, 1, 2. The original string values can be accessed using CategoricalColumn::get(index, true)
| using inviwo::CategoricalColumn::ConstIterator |
|
overridevirtual |
Implements inviwo::Column.
| std::uint32_t inviwo::CategoricalColumn::addCategory | ( | std::string_view | cat | ) |
Add a category cat. It will not be added if the category already exists.
|
overridevirtual |
and builds a union of all categorical values
| col |
| Exception | if data format does not match |
Implements inviwo::Column.
| void inviwo::CategoricalColumn::append | ( | const std::vector< std::string > & | data | ) |
Append the categorical values given in data.
| data | categorical values |
| ConstIterator inviwo::CategoricalColumn::begin | ( | ) | const |
Returns a const iterator over all rows of the column holding the corresponding categorical values as const std::string&.
|
overridevirtual |
Implements inviwo::Column.
|
overridevirtual |
Implements inviwo::Column.
| ConstIterator inviwo::CategoricalColumn::end | ( | ) | const |
Returns a const iterator over all rows of the column holding the corresponding categorical values as const std::string&.
| const std::string & inviwo::CategoricalColumn::get | ( | size_t | idx | ) | const |
Return the categorical value in row idx.
|
overridevirtual |
Return the numerical id of the category in row idx.
Implements inviwo::Column.
|
overridevirtual |
Return the categorical value in row idx.
Implements inviwo::Column.
|
overridevirtual |
Return the buffer holding the internal representations (std::uint32_t) of the categorical values for the entire column.
Implements inviwo::Column.
|
overridevirtual |
Return the buffer holding the internal representations (std::uint32_t) of the categorical values for the entire column.
Implements inviwo::Column.
|
inline |
Returns the unique set of categorical values.
|
overridevirtual |
Implements inviwo::Column.
|
overridevirtual |
Returns the custom column range. If no range has been set previously, the return value will be std::nullopt.
Implements inviwo::Column.
|
overridevirtual |
Returns the range (i.e. the min/max) of the data, ignoring any custom range
Implements inviwo::Column.
|
overridevirtual |
Implements inviwo::Column.
| std::uint32_t inviwo::CategoricalColumn::getId | ( | size_t | idx | ) | const |
Return the numerical id of the category in row idx.
|
overridevirtual |
Returns the custom range if set or else the range (i.e. the min/max) of the data
Implements inviwo::Column.
|
overridevirtual |
Implements inviwo::Column.
| std::shared_ptr< Buffer< std::uint32_t > > inviwo::CategoricalColumn::getTypedBuffer | ( | ) |
Return the buffer holding the internal representations (std::uint32_t) of the categorical values for the entire column.
| std::shared_ptr< const Buffer< std::uint32_t > > inviwo::CategoricalColumn::getTypedBuffer | ( | ) | const |
Return the buffer holding the internal representations (std::uint32_t) of the categorical values for the entire column.
|
overridevirtual |
Implements inviwo::Column.
| std::vector< std::string > inviwo::CategoricalColumn::getValues | ( | ) | const |
Returns column contents as list of categorical values.
| void inviwo::CategoricalColumn::set | ( | size_t | idx, |
| std::string_view | str ) |
Set the value of row idx to str.
| void inviwo::CategoricalColumn::set | ( | size_t | idx, |
| std::uint32_t | id ) |
Set the value of row idx by using the numerical id of a category.
| RangeException | if id does not correspond to a registered category |
|
overridevirtual |
Set a custom range for the column which can be used for normalization, plotting, color mapping, etc.
Implements inviwo::Column.
|
overridevirtual |
Implements inviwo::Column.
|
overridevirtual |
Implements inviwo::Column.
| util::iter_range< ConstIterator > inviwo::CategoricalColumn::values | ( | ) | const |
Returns a const iterator range over all rows of the column holding the corresponding categorical values as const std::string&.
Example: