Commit 209b4bb0 authored by Joshua Santana's avatar Joshua Santana
Browse files

Merge branch 'top2021s4/#142_correct_clustersize' into 'sprint_6'

[MERGE #147] ignore rows with specified condition

See merge request top/21s/sivert-vis/sivert-vis-project!98
parents 8b1b4fc1 bb70ff25
......@@ -76,6 +76,7 @@ void WCsvConverter::setOutputFromCSV( )
m_indexes->update( m_protonData );
float maxEdep = 0.0;
float minEdep = 1.0;
for( WDataSetCSV::Content::iterator dataRow = data->begin(); dataRow < data->end(); dataRow++ )
{
......@@ -84,9 +85,16 @@ void WCsvConverter::setOutputFromCSV( )
continue;
}
float edep = stringToDouble( dataRow->at( m_indexes->getEdep() ) );
if( getClusterSize( edep ) < 1.0 || getClusterSize( edep ) > 35.0 )
{
continue;
}
addVertex( dataRow );
addColor( plainColor );
addEdepAndSize( dataRow, &maxEdep );
addEdepAndSize( dataRow, &maxEdep, &minEdep );
addEventID( dataRow );
}
......@@ -95,7 +103,7 @@ void WCsvConverter::setOutputFromCSV( )
return;
}
normalizeEdeps( m_vectors->getEdeps(), m_vectors->getColors(), maxEdep );
normalizeEdeps( m_vectors->getEdeps(), m_vectors->getColors(), maxEdep, minEdep );
createOutputPoints();
createOutputFibers();
......@@ -118,7 +126,7 @@ boost::shared_ptr< std::vector<unsigned char> > WCsvConverter::sampleTransferFun
return data;
}
void WCsvConverter::normalizeEdeps( SPFloatVector edeps, SPFloatVector colorArray, float maxEdep )
void WCsvConverter::normalizeEdeps( SPFloatVector edeps, SPFloatVector colorArray, float maxEdep, float minEdep )
{
if( m_protonData->isColumnAvailable( WSingleSelectorName::getEdep() ) )
{
......@@ -127,6 +135,7 @@ void WCsvConverter::normalizeEdeps( SPFloatVector edeps, SPFloatVector colorArra
setTransferFunction( data );
float maxClusterSize = getClusterSize( maxEdep );
float minClusterSize = getClusterSize( minEdep );
for( std::vector< float >::iterator currentEdep = edeps->begin();
currentEdep != edeps->end();
......@@ -149,6 +158,7 @@ void WCsvConverter::normalizeEdeps( SPFloatVector edeps, SPFloatVector colorArra
m_colorBar->getProperties()->getProperty( "Max scale value" )->set( 0.0 );
m_colorBar->getProperties()->getProperty( "Max scale value" )->set( maxClusterSize );
m_colorBar->getProperties()->getProperty( "Min scale value" )->set( minClusterSize );
m_colorBar->getProperties()->getProperty( "Description" )->set( std::string( "Clustersize " ) );
bool activated = m_propertyStatus->getVisualizationPropertyHandler()->getColorFromEdep()->get();
......@@ -224,7 +234,7 @@ void WCsvConverter::addColor( WColor plainColor )
}
}
void WCsvConverter::addEdepAndSize( WDataSetCSV::Content::iterator dataRow, float* maxEdep )
void WCsvConverter::addEdepAndSize( WDataSetCSV::Content::iterator dataRow, float* maxEdep, float* minEdep )
{
if( !m_protonData->isColumnAvailable( WSingleSelectorName::getEdep() ) )
{
......@@ -237,6 +247,11 @@ void WCsvConverter::addEdepAndSize( WDataSetCSV::Content::iterator dataRow, floa
*maxEdep = edep;
}
if( edep < *minEdep )
{
*minEdep = edep;
}
m_vectors->getEdeps()->push_back( edep );
}
......
......@@ -156,8 +156,9 @@ private:
* \param edeps vector containing energy deposition values
* \param colorArray vector containing colors per vertex
* \param maxEdep maximum energy deposition
* \param minEdep minimum energy deposition
*/
void normalizeEdeps( SPFloatVector edeps, SPFloatVector colorArray, float maxEdep );
void normalizeEdeps( SPFloatVector edeps, SPFloatVector colorArray, float maxEdep, float minEdep );
/**
......@@ -187,8 +188,9 @@ private:
*
* \param dataRow each row of the csv file (content of row)
* \param maxEdep a pointer to the current maximum of the edep
* \param minEdep a pointer to the current minimum of the edep
*/
void addEdepAndSize( WDataSetCSV::Content::iterator dataRow, float* maxEdep );
void addEdepAndSize( WDataSetCSV::Content::iterator dataRow, float* maxEdep, float* minEdep );
/**
* Create eventID for Fiber renderer
......
......@@ -99,6 +99,7 @@ void WMTransferFunctionColorBar::properties()
m_colorBarLabels->setMin( 0 );
m_colorBarLabels->setMax( 55 );
m_minScaleValue = m_properties->addProperty( "Min scale value", "Minimum scale value in dataset", 0.0, true );
m_maxScaleValue = m_properties->addProperty( "Max scale value", "Maximum scale value in dataset", 1.0, true );
m_colorBarDescription = m_properties->addProperty( "Description", "Description of current transfer function",
std::string( "TransferFunction" ), true ),
......@@ -250,7 +251,7 @@ void WMTransferFunctionColorBar::moduleMain()
matrix->addChild( labels );
m_barProjection->addChild( matrix );
m_valueMin = 0.0; // dataSet->getTexture()->minimum()->get();
m_valueMin = m_minScaleValue->get(); // dataSet->getTexture()->minimum()->get();
m_valueScale = m_maxScaleValue->get(); // dataSet->getTexture()->scale()->get();
// add
......
......@@ -152,6 +152,11 @@ private:
*/
WPropDouble m_maxScaleValue;
/**
* Minimum scaling factor of the current dataset.
*/
WPropDouble m_minScaleValue;
/**
* Description of the color bar.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment