Commit 6bb85493 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[CHANGE] adapted more modules to new data set types

parent 4e2a7748
......@@ -34,7 +34,6 @@
#include "../../common/WProgress.h"
#include "../../kernel/WKernel.h"
#include "../data/WMData.h"
#include "WMApplyMask.h"
#include "apply_mask.xpm"
......@@ -151,23 +150,23 @@ void WMApplyMask::moduleMain()
void WMApplyMask::connectors()
{
// initialize connectors
m_dataInput = boost::shared_ptr< WModuleInputData< WDataSetSingle > >( new WModuleInputData< WDataSetSingle >(
m_dataInput = boost::shared_ptr< WModuleInputData< WDataSetScalar > >( new WModuleInputData< WDataSetScalar >(
shared_from_this(), "dataSet", "The dataset to apply the mask to." ) );
// add it to the list of connectors. Please note, that a connector NOT added via addConnector will not work as expected.
addConnector( m_dataInput );
// initialize connectors
m_maskInput = boost::shared_ptr< WModuleInputData< WDataSetSingle > >(
new WModuleInputData< WDataSetSingle >( shared_from_this(), "mask",
m_maskInput = boost::shared_ptr< WModuleInputData< WDataSetScalar > >(
new WModuleInputData< WDataSetScalar >( shared_from_this(), "mask",
"The mask applied to the data." ) );
// add it to the list of connectors. Please note, that a connector NOT added via addConnector will not work as expected.
addConnector( m_maskInput );
// initialize connectors
m_output = boost::shared_ptr< WModuleOutputData< WDataSetSingle > >(
new WModuleOutputData< WDataSetSingle >( shared_from_this(), "out",
m_output = boost::shared_ptr< WModuleOutputData< WDataSetScalar > >(
new WModuleOutputData< WDataSetScalar >( shared_from_this(), "out",
"The filtered data set." ) );
// add it to the list of connectors. Please note, that a connector NOT added via addConnector will not work as expected.
......@@ -214,6 +213,6 @@ template< typename T > void WMApplyMask::applyMask( boost::shared_ptr< WValueSet
boost::shared_ptr< WValueSet< T > > valueSet;
valueSet = boost::shared_ptr< WValueSet< T > >( new WValueSet< T >( 0, 1, newVals, type ) );
m_dataSetOut = boost::shared_ptr< WDataSetSingle >( new WDataSetSingle( valueSet, m_dataSet->getGrid() ) );
m_dataSetOut = boost::shared_ptr< WDataSetScalar >( new WDataSetScalar( valueSet, m_dataSet->getGrid() ) );
m_output->updateData( m_dataSetOut );
}
......@@ -33,10 +33,11 @@
#include <osg/Geode>
#include <osg/Uniform>
#include "../../common/math/WVector3D.h"
#include "../../dataHandler/WDataSetScalar.h"
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.h"
#include "../../common/math/WVector3D.h"
class WPickHandler;
......@@ -108,11 +109,11 @@ private:
*/
template< typename T > void applyMask( boost::shared_ptr< WValueSet< T > > valSet, dataType type );
boost::shared_ptr< WModuleInputData< WDataSetSingle > > m_dataInput; //!< Input connector for getting the data.
boost::shared_ptr< WModuleInputData< WDataSetSingle > > m_maskInput; //!< Input connector for getting the mask.
boost::shared_ptr< WModuleOutputData< WDataSetSingle > > m_output; //!< The only output of this mask module.
boost::shared_ptr< WDataSetSingle > m_dataSet; //!< Pointer providing access to the data set in the whole module.
boost::shared_ptr< WDataSetSingle > m_dataSetOut; //!< Pointer providing access to the resulting data set in the whole module.
boost::shared_ptr< WDataSetSingle > m_mask; //!< Pointer providing access to the mask in the whole module.
boost::shared_ptr< WModuleInputData< WDataSetScalar > > m_dataInput; //!< Input connector for getting the data.
boost::shared_ptr< WModuleInputData< WDataSetScalar > > m_maskInput; //!< Input connector for getting the mask.
boost::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output; //!< The only output of this mask module.
boost::shared_ptr< WDataSetScalar > m_dataSet; //!< Pointer providing access to the data set in the whole module.
boost::shared_ptr< WDataSetScalar > m_dataSetOut; //!< Pointer providing access to the resulting data set in the whole module.
boost::shared_ptr< WDataSetScalar > m_mask; //!< Pointer providing access to the mask in the whole module.
};
#endif // WMAPPLYMASK_H
......@@ -32,6 +32,7 @@
#include <osg/StateAttribute>
#include "../../kernel/WKernel.h"
#include "../../dataHandler/WDataSetScalar.h"
#include "../../dataHandler/WDataTexture3D.h"
#include "../../common/WColor.h"
#include "../../graphicsEngine/WGEUtils.h"
......@@ -78,8 +79,8 @@ const std::string WMDirectVolumeRendering::getDescription() const
void WMDirectVolumeRendering::connectors()
{
// DVR needs one input: the scalar dataset
m_input = boost::shared_ptr< WModuleInputData < WDataSetSingle > >(
new WModuleInputData< WDataSetSingle >( shared_from_this(), "in", "The scalar dataset shown using DVR." )
m_input = boost::shared_ptr< WModuleInputData < WDataSetScalar > >(
new WModuleInputData< WDataSetScalar >( shared_from_this(), "in", "The scalar dataset shown using DVR." )
);
// As properties, every connector needs to be added to the list of connectors.
......@@ -135,7 +136,7 @@ void WMDirectVolumeRendering::moduleMain()
m_moduleState.wait();
// has the data changed?
boost::shared_ptr< WDataSetSingle > newDataSet = m_input->getData();
boost::shared_ptr< WDataSetScalar > newDataSet = m_input->getData();
bool dataChanged = ( m_dataSet != newDataSet );
if ( dataChanged || !m_dataSet )
// this condition will become true whenever the new data is different from the current one or our actual data is NULL. This handles all
......
......@@ -110,12 +110,12 @@ private:
/**
* An input connector used to get datasets from other modules. The connection management between connectors must not be handled by the module.
*/
boost::shared_ptr< WModuleInputData< WDataSetSingle > > m_input;
boost::shared_ptr< WModuleInputData< WDataSetScalar > > m_input;
/**
* This is a pointer to the dataset the module is currently working on.
*/
boost::shared_ptr< WDataSetSingle > m_dataSet;
boost::shared_ptr< WDataSetScalar > m_dataSet;
/**
* If this property is true, as special shader is used which emulates isosurfaces using the m_isoValue property.
......
......@@ -98,7 +98,7 @@ void WMDistanceMap::moduleMain()
// found some data
debugLog() << "Data changed. Updating ...";
boost::shared_ptr< WValueSet< float > > distanceMapValueSet = createOffset( m_dataSet );
m_distanceMapDataSet = boost::shared_ptr< WDataSetSingle >( new WDataSetSingle( distanceMapValueSet, m_dataSet->getGrid() ) );
m_distanceMapDataSet = boost::shared_ptr< WDataSetScalar >( new WDataSetScalar( distanceMapValueSet, m_dataSet->getGrid() ) );
WLogger::getLogger()->addLogMessage( "Done!", "Distance Map", LL_INFO );
......@@ -114,16 +114,16 @@ void WMDistanceMap::connectors()
{
// initialize connectors
m_input = boost::shared_ptr<WModuleInputData< WDataSetSingle > >(
new WModuleInputData< WDataSetSingle >( shared_from_this(),
m_input = boost::shared_ptr<WModuleInputData< WDataSetScalar > >(
new WModuleInputData< WDataSetScalar >( shared_from_this(),
"in", "Dataset to compute distance map for." )
);
// add it to the list of connectors. Please note, that a connector NOT added via addConnector will not work as expected.
addConnector( m_input );
m_output = boost::shared_ptr<WModuleOutputData< WDataSetSingle > >(
new WModuleOutputData< WDataSetSingle >( shared_from_this(),
m_output = boost::shared_ptr<WModuleOutputData< WDataSetScalar > >(
new WModuleOutputData< WDataSetScalar >( shared_from_this(),
"out", "Distance map for the input data set." )
);
......@@ -183,7 +183,7 @@ boost::shared_ptr< WValueSet< float > > makeFloatValueSet( boost::shared_ptr< WV
return boost::shared_ptr< WValueSet< float > >();
}
boost::shared_ptr< WValueSet< float > > WMDistanceMap::createOffset( boost::shared_ptr< const WDataSetSingle > dataSet )
boost::shared_ptr< WValueSet< float > > WMDistanceMap::createOffset( boost::shared_ptr< const WDataSetScalar > dataSet )
{
std::vector<float> floatDataset;
......
......@@ -31,7 +31,7 @@
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
#include "../../dataHandler/WDataSetSingle.h"
#include "../../dataHandler/WDataSetScalar.h"
/**
* Computes a distance map from an anatomy dataset.
......@@ -99,22 +99,22 @@ protected:
private:
boost::shared_ptr< WModuleInputData< WDataSetSingle > > m_input; //!< Input connector required by this module.
boost::shared_ptr< WModuleInputData< WDataSetScalar > > m_input; //!< Input connector required by this module.
/**
* Source dataset.
*/
boost::shared_ptr< WDataSetSingle > m_dataSet;
boost::shared_ptr< WDataSetScalar > m_dataSet;
/**
* Connector to provide the distance map to other modules.
*/
boost::shared_ptr< WModuleOutputData< WDataSetSingle > > m_output;
boost::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output;
/**
* Target dataset.
*/
boost::shared_ptr< WDataSetSingle > m_distanceMapDataSet;
boost::shared_ptr< WDataSetScalar > m_distanceMapDataSet;
/**
* Function to create a distance map from Anatomy data set.
......@@ -122,7 +122,7 @@ private:
* \param dataSet the data set that is used to compute the distance field.
* The distance is computed to the boundary between foreground an background
*/
boost::shared_ptr< WValueSet< float > > createOffset( boost::shared_ptr< const WDataSetSingle > dataSet );
boost::shared_ptr< WValueSet< float > > createOffset( boost::shared_ptr< const WDataSetScalar > dataSet );
/**
* Gauss function.
......
......@@ -145,8 +145,8 @@ void WMDistanceMapIsosurface::connectors()
// initialize connectors
// this is the scalar field input
m_input = boost::shared_ptr< WModuleInputForwardData< WDataSetSingle > >(
new WModuleInputForwardData< WDataSetSingle >( shared_from_this(),
m_input = boost::shared_ptr< WModuleInputForwardData< WDataSetScalar > >(
new WModuleInputForwardData< WDataSetScalar >( shared_from_this(),
"in", "Dataset to compute distance map for." )
);
......@@ -154,8 +154,8 @@ void WMDistanceMapIsosurface::connectors()
addConnector( m_input );
// this output is used to provide the distance map to other modules.
m_output = boost::shared_ptr< WModuleOutputForwardData< WDataSetSingle > >(
new WModuleOutputForwardData< WDataSetSingle >( shared_from_this(),
m_output = boost::shared_ptr< WModuleOutputForwardData< WDataSetScalar > >(
new WModuleOutputForwardData< WDataSetScalar >( shared_from_this(),
"out", "Distance map for the input data set." )
);
......
......@@ -27,7 +27,7 @@
#include <boost/shared_ptr.hpp>
#include "../../dataHandler/WDataSetSingle.h"
#include "../../dataHandler/WDataSetScalar.h"
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleContainer.h"
#include "../../kernel/WModuleInputForwardData.h"
......@@ -90,8 +90,8 @@ private:
WPropDouble m_isoValueProp; //!< Property holding the value for the distance.
WPropBool m_useTextureProp; //!< Property indicating whether to use texturing with scalar data sets.
boost::shared_ptr< WModuleInputForwardData< WDataSetSingle > > m_input; //!< Input connector required by this module.
boost::shared_ptr< WModuleOutputForwardData< WDataSetSingle > > m_output; //!< Connector to provide the distance map to other modules.
boost::shared_ptr< WModuleInputForwardData< WDataSetScalar > > m_input; //!< Input connector required by this module.
boost::shared_ptr< WModuleOutputForwardData< WDataSetScalar > > m_output; //!< Connector to provide the distance map to other modules.
boost::shared_ptr< WModule > m_marchingCubesModule; //!< The marching cubes module used in this container.
boost::shared_ptr< WModule > m_distanceMapModule; //!< The distance map module used in this container.
......
......@@ -161,8 +161,8 @@ void WMMarchingCubes::moduleMain()
void WMMarchingCubes::connectors()
{
// initialize connectors
m_input = boost::shared_ptr< WModuleInputData < WDataSetSingle > >(
new WModuleInputData< WDataSetSingle >( shared_from_this(),
m_input = boost::shared_ptr< WModuleInputData < WDataSetScalar > >(
new WModuleInputData< WDataSetScalar >( shared_from_this(),
"in", "Dataset to compute isosurface for." )
);
......
......@@ -34,6 +34,7 @@
#include <osg/Uniform>
#include "../../common/datastructures/WTriangleMesh2.h"
#include "../../dataHandler/WDataSetScalar.h"
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
......@@ -269,7 +270,7 @@ private:
boost::shared_ptr< WCondition > m_recompute;
boost::shared_ptr< WModuleInputData< WDataSetSingle > > m_input; //!< Input connector required by this module.
boost::shared_ptr< WModuleInputData< WDataSetScalar > > m_input; //!< Input connector required by this module.
boost::shared_ptr< WModuleOutputData< WTriangleMesh2 > > m_output; //!< Input connector required by this module.
boost::shared_ptr< WTriangleMesh2 > m_triMesh; //!< This triangle mesh is provided as output through the connector.
......@@ -292,7 +293,7 @@ private:
WMCTriangleVECTOR m_trivecTriangles; //!< List of WMCTriangleS which form the triangulation of the isosurface.
boost::shared_ptr< const WDataSetSingle > m_dataSet; //!< pointer to dataSet to be able to access it throughout the whole module.
boost::shared_ptr< const WDataSetScalar > m_dataSet; //!< pointer to dataSet to be able to access it throughout the whole module.
boost::shared_ptr< WGridRegular3D > m_grid; //!< pointer to grid, because we need to access the grid for the dimensions of the texture.
......
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