OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
WCsvConverter Class Reference

Converts the csv data to points and fibers. More...

#include <WCsvConverter.h>

+ Collaboration diagram for WCsvConverter:

Public Types

typedef std::shared_ptr< std::vector< float > > SPFloatVector
 represents a std::shared_ptr to a vector containing a vector of floats. More...
 
typedef std::shared_ptr< std::vector< size_t > > SPSizeVector
 represents a std::shared_ptr to a vector containing a vector of size_t. More...
 

Public Member Functions

 WCsvConverter (WProtonData::SPtr protonData, std::shared_ptr< WPropertyStatus > propertyStatus, WModule::SPtr colorBar)
 Initializes the vectors, indices and transfer function color bar Calls setOutputFromCSV. More...
 
std::shared_ptr< WDataSetFibersgetFibers ()
 Getter. More...
 
std::shared_ptr< WDataSetPointsgetPoints ()
 Getter. More...
 
std::shared_ptr< WDataSetSinglegetTransferFunction ()
 Getter. More...
 
std::shared_ptr< WDataSetPointsgetPointsAndData ()
 Getter. More...
 

Private Member Functions

std::shared_ptr< std::vector< unsigned char > > sampleTransferFunction ()
 Computes gradient vector from transfer function specified in visualization properties. More...
 
void normalizeEdeps (SPFloatVector edeps, SPFloatVector colorArray, float maxEdep, float minEdep)
 Normalize energy deposition values to use as RGB values. More...
 
bool checkConditionToPass (WDataSetCSV::Content::iterator dataRow)
 checks whether the requirements are fulfilled. More...
 
void addVertex (WDataSetCSV::Content::iterator dataRow)
 Create vertex for point/fiber renderer. More...
 
void addColor (WColor plainColor)
 Create color for point/Fiber renderer. More...
 
void addEdepAndSize (WDataSetCSV::Content::iterator dataRow, float *maxEdep, float *minEdep)
 Create edep and sizes for point/fiber renderer. More...
 
void addEventID (WDataSetCSV::Content::iterator dataRow)
 Create eventID for Fiber renderer. More...
 
void calculateFibers ()
 calculate the property of WDataSetFiber (index, length, verticesReverse) More...
 
void createOutputFibers ()
 Create the fibers for fiber renderer. More...
 
void createOutputPoints ()
 Create the points for points renderer. More...
 
void createOutputPointsAndData ()
 Create the points and selected data for Point Connector. More...
 
void setOutputFromCSV ()
 Create outputs, so it can be displayed by the fiber display and the point renderer. More...
 
void setTransferFunction (std::shared_ptr< std::vector< unsigned char > > data)
 Creates output for transfer function. More...
 
bool checkIfOutputIsNull ()
 the cast value from string to float More...
 
float getClusterSize (float edep)
 Computes the cluster size. More...
 
float stringToDouble (std::string str)
 checks whether the string is a number (double)
More...
 
int stringToInt (std::string str)
 checks whether the string is a number (int) More...
 

Private Attributes

WProtonData::SPtr m_protonData
 Stores information form csv content. More...
 
WModule::SPtr m_colorBar
 Stores reference to the given transfer function color bar module. More...
 
std::shared_ptr< WDataSetFibersm_fibers
 Stores information for the fiber display. More...
 
std::shared_ptr< WDataSetPointsm_points
 Stores information for the point renderer. More...
 
std::shared_ptr< WDataSetPointsm_pointsAndData
 Stores information for the point Conncetor. More...
 
std::shared_ptr< WDataSetSinglem_transferFunction
 Stores the currently mapped transfer function. More...
 
WConverterVectors::SPtr m_vectors
 Stores points for point and fiber renderer. More...
 
WConverterIndexes::SPtr m_indexes
 Stores indexes for fiber renderer. More...
 
WPropertyStatus::SPtr m_propertyStatus
 includes all property groups More...
 

Friends

class WCsvConverterTest
 only test classes may be friend More...
 

Detailed Description

Converts the csv data to points and fibers.

Definition at line 53 of file WCsvConverter.h.

Member Typedef Documentation

◆ SPFloatVector

typedef std::shared_ptr< std::vector< float > > WCsvConverter::SPFloatVector

represents a std::shared_ptr to a vector containing a vector of floats.

Definition at line 72 of file WCsvConverter.h.

◆ SPSizeVector

typedef std::shared_ptr< std::vector< size_t > > WCsvConverter::SPSizeVector

represents a std::shared_ptr to a vector containing a vector of size_t.

Definition at line 77 of file WCsvConverter.h.

Constructor & Destructor Documentation

◆ WCsvConverter()

WCsvConverter::WCsvConverter ( WProtonData::SPtr  protonData,
std::shared_ptr< WPropertyStatus propertyStatus,
WModule::SPtr  colorBar 
)

Initializes the vectors, indices and transfer function color bar Calls setOutputFromCSV.

Parameters
protonDataThe proton data to use.
propertyStatusThe status of the properties.
colorBarReference to the transfer function color bar module

Definition at line 36 of file WCsvConverter.cpp.

References m_colorBar, m_indexes, m_propertyStatus, m_protonData, m_vectors, and setOutputFromCSV().

+ Here is the call graph for this function:

Member Function Documentation

◆ addColor()

void WCsvConverter::addColor ( WColor  plainColor)
private

Create color for point/Fiber renderer.

Parameters
plainColorThe color to create

Definition at line 250 of file WCsvConverter.cpp.

References WSingleSelectorName::getEdep(), m_propertyStatus, m_protonData, and m_vectors.

Referenced by setOutputFromCSV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addEdepAndSize()

void WCsvConverter::addEdepAndSize ( WDataSetCSV::Content::iterator  dataRow,
float *  maxEdep,
float *  minEdep 
)
private

Create edep and sizes for point/fiber renderer.

Parameters
dataRoweach row of the csv file (content of row)
maxEdepa pointer to the current maximum of the edep
minEdepa pointer to the current minimum of the edep

Definition at line 262 of file WCsvConverter.cpp.

References WSingleSelectorName::getEdep(), m_indexes, m_protonData, m_vectors, and stringToDouble().

Referenced by setOutputFromCSV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addEventID()

void WCsvConverter::addEventID ( WDataSetCSV::Content::iterator  dataRow)
private

Create eventID for Fiber renderer.

Parameters
dataRoweach row of the csv file (content of row)

Definition at line 420 of file WCsvConverter.cpp.

References WSingleSelectorName::getEventId(), m_indexes, m_protonData, m_vectors, and stringToInt().

Referenced by setOutputFromCSV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addVertex()

void WCsvConverter::addVertex ( WDataSetCSV::Content::iterator  dataRow)
private

Create vertex for point/fiber renderer.

Parameters
dataRoweach row of the csv file (content of row)

Definition at line 243 of file WCsvConverter.cpp.

References m_indexes, m_vectors, and stringToDouble().

Referenced by setOutputFromCSV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateFibers()

void WCsvConverter::calculateFibers ( )
private

calculate the property of WDataSetFiber (index, length, verticesReverse)

Definition at line 283 of file WCsvConverter.cpp.

References m_fibers, m_vectors, and wlog::warn().

Referenced by createOutputFibers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkConditionToPass()

bool WCsvConverter::checkConditionToPass ( WDataSetCSV::Content::iterator  dataRow)
private

checks whether the requirements are fulfilled.

Parameters
dataRowthe row to check.
Returns
true The row can be displayed.
false The row can not be displayed.

Definition at line 194 of file WCsvConverter.cpp.

References WSingleSelectorName::getEventId(), WSingleSelectorName::getParentId(), WSingleSelectorName::getPDG(), m_indexes, m_propertyStatus, m_protonData, stringToDouble(), and stringToInt().

Referenced by setOutputFromCSV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkIfOutputIsNull()

bool WCsvConverter::checkIfOutputIsNull ( )
private

the cast value from string to float

Returns
returns the cast value from string to float

Definition at line 444 of file WCsvConverter.cpp.

References m_fibers, m_points, m_pointsAndData, and m_vectors.

Referenced by setOutputFromCSV().

+ Here is the caller graph for this function:

◆ createOutputFibers()

void WCsvConverter::createOutputFibers ( )
private

Create the fibers for fiber renderer.

Definition at line 376 of file WCsvConverter.cpp.

References calculateFibers(), WSingleSelectorName::getEventId(), m_fibers, and m_protonData.

Referenced by setOutputFromCSV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createOutputPoints()

void WCsvConverter::createOutputPoints ( )
private

Create the points for points renderer.

Definition at line 352 of file WCsvConverter.cpp.

References WSingleSelectorName::getEdep(), m_points, m_propertyStatus, m_protonData, and m_vectors.

Referenced by setOutputFromCSV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createOutputPointsAndData()

void WCsvConverter::createOutputPointsAndData ( )
private

Create the points and selected data for Point Connector.

Definition at line 395 of file WCsvConverter.cpp.

References WSingleSelectorName::getEdep(), WSingleSelectorName::getEventId(), m_pointsAndData, m_propertyStatus, m_protonData, and m_vectors.

Referenced by setOutputFromCSV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getClusterSize()

float WCsvConverter::getClusterSize ( float  edep)
private

Computes the cluster size.

Parameters
edepenergy deposition
Returns
float cluster size

Definition at line 456 of file WCsvConverter.cpp.

Referenced by normalizeEdeps(), setOutputFromCSV(), and WCsvConverterTest::testGetClusterSize().

+ Here is the caller graph for this function:

◆ getFibers()

std::shared_ptr< WDataSetFibers > WCsvConverter::getFibers ( )

Getter.

Returns
shared_ptr of generated fibers from the CSV file

Definition at line 53 of file WCsvConverter.cpp.

References m_fibers.

◆ getPoints()

std::shared_ptr< WDataSetPoints > WCsvConverter::getPoints ( )

Getter.

Returns
shared_ptr of generated Points from the CSV file

Definition at line 58 of file WCsvConverter.cpp.

References m_points.

◆ getPointsAndData()

std::shared_ptr< WDataSetPoints > WCsvConverter::getPointsAndData ( )

Getter.

Returns
shared_ptr of generated selected event ID

Definition at line 63 of file WCsvConverter.cpp.

References m_pointsAndData.

◆ getTransferFunction()

std::shared_ptr< WDataSetSingle > WCsvConverter::getTransferFunction ( )

Getter.

Returns
shared_ptr of generated transfer function

Definition at line 123 of file WCsvConverter.cpp.

References m_transferFunction.

◆ normalizeEdeps()

void WCsvConverter::normalizeEdeps ( SPFloatVector  edeps,
SPFloatVector  colorArray,
float  maxEdep,
float  minEdep 
)
private

Normalize energy deposition values to use as RGB values.

Parameters
edepsvector containing energy deposition values
colorArrayvector containing colors per vertex
maxEdepmaximum energy deposition
minEdepminimum energy deposition

Definition at line 139 of file WCsvConverter.cpp.

References getClusterSize(), WSingleSelectorName::getEdep(), m_colorBar, m_indexes, m_propertyStatus, m_protonData, m_vectors, sampleTransferFunction(), and setTransferFunction().

Referenced by setOutputFromCSV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sampleTransferFunction()

std::shared_ptr< std::vector< unsigned char > > WCsvConverter::sampleTransferFunction ( )
private

Computes gradient vector from transfer function specified in visualization properties.

Returns
shared_ptr of mapped gradim_plainColorent from transfer function in RGBA format

Definition at line 128 of file WCsvConverter.cpp.

References m_propertyStatus, and WTransferFunction::sample1DTransferFunction().

Referenced by normalizeEdeps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOutputFromCSV()

void WCsvConverter::setOutputFromCSV ( )
private

◆ setTransferFunction()

void WCsvConverter::setTransferFunction ( std::shared_ptr< std::vector< unsigned char > >  data)
private

Creates output for transfer function.

Parameters
datashared_ptr of mapped gradient from transfer function in RGBA format

Definition at line 433 of file WCsvConverter.cpp.

Referenced by normalizeEdeps().

+ Here is the caller graph for this function:

◆ stringToDouble()

float WCsvConverter::stringToDouble ( std::string  str)
private

checks whether the string is a number (double)

Parameters
strThe string to cast
Returns
return the casted double value

Definition at line 461 of file WCsvConverter.cpp.

Referenced by addEdepAndSize(), addVertex(), checkConditionToPass(), setOutputFromCSV(), stringToInt(), and WCsvConverterTest::testStringToDouble().

+ Here is the caller graph for this function:

◆ stringToInt()

int WCsvConverter::stringToInt ( std::string  str)
private

checks whether the string is a number (int)

Parameters
strThe string to cast
Returns
return the casted int value

Definition at line 477 of file WCsvConverter.cpp.

References stringToDouble().

Referenced by addEventID(), checkConditionToPass(), and WCsvConverterTest::testStringToInt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ WCsvConverterTest

friend class WCsvConverterTest
friend

only test classes may be friend

Definition at line 58 of file WCsvConverter.h.

Member Data Documentation

◆ m_colorBar

WModule::SPtr WCsvConverter::m_colorBar
private

Stores reference to the given transfer function color bar module.

Definition at line 114 of file WCsvConverter.h.

Referenced by normalizeEdeps(), and WCsvConverter().

◆ m_fibers

std::shared_ptr< WDataSetFibers > WCsvConverter::m_fibers
private

Stores information for the fiber display.

Definition at line 119 of file WCsvConverter.h.

Referenced by calculateFibers(), checkIfOutputIsNull(), createOutputFibers(), and getFibers().

◆ m_indexes

WConverterIndexes::SPtr WCsvConverter::m_indexes
private

Stores indexes for fiber renderer.

Definition at line 144 of file WCsvConverter.h.

Referenced by addEdepAndSize(), addEventID(), addVertex(), checkConditionToPass(), normalizeEdeps(), setOutputFromCSV(), and WCsvConverter().

◆ m_points

std::shared_ptr< WDataSetPoints > WCsvConverter::m_points
private

Stores information for the point renderer.

Definition at line 124 of file WCsvConverter.h.

Referenced by checkIfOutputIsNull(), createOutputPoints(), and getPoints().

◆ m_pointsAndData

std::shared_ptr< WDataSetPoints > WCsvConverter::m_pointsAndData
private

Stores information for the point Conncetor.

Definition at line 129 of file WCsvConverter.h.

Referenced by checkIfOutputIsNull(), createOutputPointsAndData(), and getPointsAndData().

◆ m_propertyStatus

WPropertyStatus::SPtr WCsvConverter::m_propertyStatus
private

◆ m_protonData

WProtonData::SPtr WCsvConverter::m_protonData
private

Stores information form csv content.

Content object containing data

Definition at line 109 of file WCsvConverter.h.

Referenced by addColor(), addEdepAndSize(), addEventID(), checkConditionToPass(), createOutputFibers(), createOutputPoints(), createOutputPointsAndData(), normalizeEdeps(), setOutputFromCSV(), and WCsvConverter().

◆ m_transferFunction

std::shared_ptr< WDataSetSingle > WCsvConverter::m_transferFunction
private

Stores the currently mapped transfer function.

Definition at line 134 of file WCsvConverter.h.

Referenced by getTransferFunction().

◆ m_vectors

WConverterVectors::SPtr WCsvConverter::m_vectors
private

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