Commit 73f2d896 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[ADD] infrastructure for VisiTrace algorithm

Optimitzation itself not implemented yet
parent ec591f7e
......@@ -47,6 +47,7 @@
#include "WMPickingDVR.h"
#include "WMPickingDVRHelper.h"
#include "WVisiTrace.h"
//Module Defines
#define WMPICKINGDVR_MAX_INT "Picking - Maximum Intensity"
......@@ -263,7 +264,7 @@ void WMPickingDVR::moduleMain()
}
}
}
else
else if( selectionType == 1)
{
bool pickingSuccessful = false;
const WPosition posPicking = getPickedDVRPosition( pickingMode, &pickingSuccessful );
......@@ -287,6 +288,35 @@ void WMPickingDVR::moduleMain()
m_curve3D.clear(); // Start a new line for the next line selection
}
}
else if( selectionType == 2)
{
bool pickingSuccessful = false;
const WPosition posPicking = getPickedDVRPosition( pickingMode, &pickingSuccessful );
#warning need to call actual relvant function here
//m_visiTrace.addCandidatesForRay
if( m_continuousDrawing->get()
|| !m_pickInProgress )
{
m_curve3D = m_visiTrace.getLine();
updateCurveRendering();
}
if( m_pickInProgress )
{
m_moduleState.notify(); // Make sure that main loop is excuted until picking stopped
}
else
{
m_visiTrace.reset();
m_curve3D.clear(); // Start a new line for the next line selection
}
}
else
{
WAssert( false, "This should not happen. Internal module error." );
}
}
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->remove( m_rootNode );
......
......@@ -31,6 +31,8 @@
#include "core/kernel/WModule.h"
#include "WVisiTrace.h"
// forward declarations to reduce compile dependencies
template< class T > class WModuleInputData;
class WDataSetScalar;
......@@ -207,6 +209,8 @@ private:
bool m_pickInProgress; //!< Indicates whether continouos picking is still in progress.
std::vector<WPosition> m_curve3D; //!< Positions representing the from VisiTrace selection mode.
WVisiTrace m_visiTrace; //!< Class providing VisiTrace optimization.
};
#endif // WMPICKINGDVR_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2017 OpenWalnut Community
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <vector>
#include "core/common/math/linearAlgebra/WPosition.h"
#include "core/common/WAssert.h"
#include "WVisiTrace.h"
WVisiTrace::WVisiTrace():
m_candidatePositions(),
m_candidateJumps(),
m_curve3D(),
m_dataChanged( false )
{
}
std::vector<WPosition> WVisiTrace::getLine()
{
if( m_dataChanged )
{
performVisiTrace();
m_dataChanged = false;
}
return m_curve3D;
}
void WVisiTrace::addCandidatesForRay( const std::vector< WPosition >& positions,
const std::vector< double >& opacityJumps )
{
WAssert( positions.size() == opacityJumps.size(),
"Each cndidate position needs to have an opacity jump value." );
m_candidatePositions.push_back( positions );
m_candidateJumps.push_back( opacityJumps );
m_dataChanged = true;
}
void WVisiTrace::performVisiTrace()
{
assert( false && "Not yet implemented" );
}
void WVisiTrace::reset()
{
m_candidatePositions.clear();
m_candidateJumps.clear();
m_dataChanged = true;
m_curve3D.clear(); // not really needed because m_dataChanged is true.
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2017 OpenWalnut Community
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WVISITRACE_H
#define WVISITRACE_H
/**
* Class performing graph computations for VisiTrace algorithm.
* The algorithm has been published here:
* http://dx.doi.org/10.2312/PE.EuroVisShort.EuroVisShort2013.091-095
*
* The aim is to draw smooth lines on top visible structures in direct volume
* renderings.
*/
#include <vector>
class WVisiTrace
{
public:
/**
* Simple constructor performing initializations
*/
WVisiTrace();
/**
* Get the final 3D line a vector of \ref WPosition.
* If data has changed since last call a recomputation will be triggered.
*
* \return 3D line computed by visitrace.
*/
std::vector<WPosition> getLine();
/**
* Add candidate positions and corresponding opacity jump values
* for one viewing ray. These values are the basis for visiTrace
* computation.
*
* Values in both vector are assumed to have the same order.
*
* \param positions candidate positions
* \param opacityJumps opacityJumps for the positions
*/
void addCandidatesForRay( const std::vector< WPosition >& positions,
const std::vector< double >& opacityJumps );
/**
* Erases all data to be able to start a new VisiTrace computation.
*/
void reset();
protected:
private:
/**
* Optimization resulting in the desired 3D curve (\ref m_curve3D).
*/
void performVisiTrace();
std::vector< std::vector< WPosition > > m_candidatePositions; //!< The candidate positions for all rays
std::vector< std::vector< double > > m_candidateJumps; //!< The opacity jumps belonging to the intervals of the candidate positions.
std::vector< WPosition > m_curve3D; //!< The 3D curve computed by VisiTrace.
bool m_dataChanged; //!< Indicates whether new data has been added since last VisiTrace computation.
};
#endif // WVISITRACE_H
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