Commit c2e8b349 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - removed old colormapping. Removed NavSlices and ported Marching Cubes.

parent f5c767e8
......@@ -145,13 +145,3 @@ boost::shared_ptr< WSubject > WDataHandler::getDefaultSubject()
return getDataHandler()->getSubjectByID( WSubject::SUBJECT_UNKNOWN );
}
void WDataHandler::registerDataSet( boost::shared_ptr< WDataSet > dataset )
{
getDefaultSubject()->addDataSet( dataset );
}
void WDataHandler::deregisterDataSet( boost::shared_ptr< WDataSet > dataset )
{
getDefaultSubject()->removeDataSet( dataset );
}
......@@ -93,24 +93,6 @@ public:
*/
static boost::shared_ptr< WDataHandler > getDataHandler();
// TODO(all): the following two methods are only useful with our current single-subject stuff. You should consider redesigning
// it in conjunction with the multi subject stuff.
/**
* Register a dataset to the "UNKNOWN" subject. This is a convenience class which is useful as long as we do not have proper
* multi subject facilities.
*
* \param dataset the dataset to register.
*/
static void registerDataSet( boost::shared_ptr< WDataSet > dataset );
/**
* Deregister a dataset to the "UNKNOWN" subject. This is a convenience class which is useful as long as we do not have proper
* multi subject facilities.
*
* \param dataset the dataset to deregister.
*/
static void deregisterDataSet( boost::shared_ptr< WDataSet > dataset );
/**
* Insert a new subject referenced by a pointer.
*
......
......@@ -30,7 +30,6 @@
#include "exceptions/WDHException.h"
#include "WDataSet.h"
#include "WDataSetVector.h"
#include "WDataTexture3D.h"
#include "WDataTexture3D_2.h"
// prototype instance as singleton
......@@ -61,11 +60,6 @@ bool WDataSet::isTexture() const
return false;
}
boost::shared_ptr< WDataTexture3D > WDataSet::getTexture()
{
throw WDHException( std::string( "This dataset does not provide a texture." ) );
}
osg::ref_ptr< WDataTexture3D_2 > WDataSet::getTexture2() const
{
throw WDHException( std::string( "This dataset does not provide a texture." ) );
......@@ -91,18 +85,6 @@ boost::shared_ptr< WPrototyped > WDataSet::getPrototype()
return m_prototype;
}
boost::shared_ptr< WCondition > WDataSet::getChangeCondition()
{
// this just forwards to the texture condition. In the future maybe datasets may also change so we need an separate condition in every
// dataset.
if ( isTexture() )
{
return getTexture()->getChangeCondition();
}
return boost::shared_ptr< WCondition >();
}
boost::shared_ptr< WDataSetVector > WDataSet::isVectorDataSet()
{
return boost::shared_ptr< WDataSetVector >();
......
......@@ -38,7 +38,6 @@
#include "WDataTexture3D_2.h"
#include "WExportDataHandler.h"
class WDataTexture3D;
class WCondition;
class WDataSetVector;
......@@ -92,15 +91,6 @@ public:
*/
virtual boost::shared_ptr< WDataSetVector > isVectorDataSet();
/**
* Returns the texture- representation of the dataset. May throw an exception if no texture is available.
*
* \return The texture.
* \deprecated
*/
OW_API_DEPRECATED
virtual boost::shared_ptr< WDataTexture3D > getTexture();
/**
* Returns the texture- representation of the dataset. May throw an exception if no texture is available.
*
......@@ -130,14 +120,6 @@ public:
*/
static boost::shared_ptr< WPrototyped > getPrototype();
/**
* Gets the condition which is fired whenever the dataset gets some kind of dirty (threshold, opacity, ...)
*
* \return the condition, or NULL if the dataset has no texture.
* \deprecated this is deprecated. Use dataset properties instead.
*/
boost::shared_ptr< WCondition > getChangeCondition();
/**
* Return a pointer to the properties object of the dataset. Add all the modifiable settings here. This allows the user to modify several
* properties of a dataset.
......
......@@ -28,7 +28,6 @@
#include "../common/WAssert.h"
#include "../common/WException.h"
#include "../common/WPrototyped.h"
#include "WDataTexture3D.h"
#include "WDataTexture3D_2.h"
#include "WGrid.h"
#include "WGridRegular3D.h"
......@@ -51,7 +50,6 @@ WDataSetSingle::WDataSetSingle( boost::shared_ptr< WValueSetBase > newValueSet,
m_valueSet = newValueSet;
m_grid = newGrid;
m_texture3D = boost::shared_ptr< WDataTexture3D >( new WDataTexture3D( m_valueSet, m_grid ) );
m_infoProperties->addProperty( m_grid->getInformationProperties() );
......@@ -67,7 +65,6 @@ WDataSetSingle::WDataSetSingle()
: WDataSet(),
m_grid(),
m_valueSet(),
m_texture3D(),
m_texture()
{
// default constructor used by the prototype mechanism
......@@ -108,11 +105,6 @@ bool WDataSetSingle::isTexture() const
return m_texture;
}
boost::shared_ptr< WDataTexture3D > WDataSetSingle::getTexture()
{
return m_texture3D;
}
osg::ref_ptr< WDataTexture3D_2 > WDataSetSingle::getTexture2() const
{
return m_texture;
......
......@@ -38,7 +38,6 @@
#include "WExportDataHandler.h"
class WDataTexture3D;
class WDataTexture3D_2;
/**
......@@ -141,14 +140,6 @@ public:
*/
virtual bool isTexture() const;
/**
* Returns the texture- representation of the dataset. May throw an exception if no texture is available.
*
* \return The texture.
* \deprecated
*/
virtual boost::shared_ptr< WDataTexture3D > getTexture();
/**
* Returns the texture representation of the dataset. May throw an exception if no texture is available.
*
......@@ -195,10 +186,6 @@ protected:
boost::shared_ptr< WValueSetBase > m_valueSet;
private:
/**
* The 3D texture representing this dataset.
*/
boost::shared_ptr< WDataTexture3D > m_texture3D;
/**
* The 3D texture representing this dataset.
......
This diff is collapsed.
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// 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 WDATATEXTURE3D_H
#define WDATATEXTURE3D_H
#include <stdint.h>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include "../graphicsEngine/WGETexture.h"
#include "../common/WProperties.h"
#include "WDataHandlerEnums.h"
#include "WValueSetBase.h"
#include "WGridRegular3D.h"
#include "WExportDataHandler.h"
class WCondition;
/**
* Class encapsulating a 3D texture. It is able to use a value set and grid to create an OpenSceneGraph texture, that can be used
* directly by modules. The texture values get scaled to a range of [0,1] to ensure the texture used its maximum precision. The values each get
* scaled from [min,max] to [0,1]. The values min and max can be retrieved by getMinValue and getMaxValue. Your shader should get them as
* uniforms to unscale the texture to have the real value.
*/
class OWDATAHANDLER_EXPORT WDataTexture3D // NOLINT
{
public:
/**
* Constructor. Creates the texture. Just run it after graphics engine was initialized.
*
* \param valueSet the value set to use
* \param grid the grid to use
*/
WDataTexture3D( boost::shared_ptr<WValueSetBase> valueSet, boost::shared_ptr<WGrid> grid );
/**
* Destructor.
*/
virtual ~WDataTexture3D();
/**
* Gives the alpha value for this texture.
*
* \return the alpha value.
*/
float getAlpha() const;
/**
* Sets the alpha value. The value must be in [0,1]. Otherwise nothing will happen.
*
* \param alpha the alpha value.
*/
void setAlpha( float alpha );
/**
* Sets the opacity value. The value must be in [0,100]. Otherwise nothing will happen.
*
* \param opacity the opacity value.
*/
void setOpacity( float opacity );
/**
* Returns the currently set threshold.
*
* \return the threshold.
*/
float getThreshold() const;
/**
* Sets the threshold to use.
*
* \param threshold the threshold.
*/
void setThreshold( float threshold );
/**
* Is this texture globally active and used for colormapping?
*
* \return true if active.
*/
bool isGloballyActive();
/**
* Sets whether the texture is active globally.
*
* \param active true if active
*/
void setGloballyActive( bool active = true );
/**
* Returns the data type of the texture.
*
* \return the type.
*/
dataType getDataType();
/**
* getter for the texture object
*
* \return the texture
*/
osg::ref_ptr< WGETexture3D > getTexture();
/**
* Gets the condition which is fired whenever the texture gets some kind of dirty (threshold, opacity, ...)
*
* \return the condition
*/
boost::shared_ptr< WCondition > getChangeCondition();
/**
* The texture got created using this grid. It can help to translate coordinates into the texture coordinate space relating to
* the grid.
*
* \return the grid.
*/
boost::shared_ptr< WGridRegular3D > getGrid() const;
/**
* Gets the minimum value in the texture.
*
* \return the min.
*/
float getMinValue();
/**
* Gets the maximum value in the texture.
*
* \return the maximum
*/
float getMaxValue();
/**
* Sets the minimum value in the texture. Use this if the default
* texture scaling is not applicable. This has no effect if the texture was
* already uploaded.
*
* \param min the min.
*/
void setMinValue( float min );
/**
* Sets the maximum value in the texture. Use this if the default
* texture scaling is not applicable. This has no effect if the texture was
* already uploaded.
*
* \param max the max.
*/
void setMaxValue( float max );
/**
* Gets the scaling factor to de-scale [0,1] to [0, max-min]
*
* \return the scaling factor.
*/
float getMinMaxScale();
/**
* getter
*/
bool isInterpolated();
/**
* setter
*
* \param interpol
*/
void setInterpolation( bool interpol );
/**
* getter
*/
int getSelectedColormap();
/**
* setter
*
* \param cmap
*/
void setSelectedColormap( int cmap );
/**
* Return a pointer to the properties object of the dataset. Add all the modifiable settings here. This allows the user to modify several
* properties of a dataset.
*
* \return the properties.
*/
boost::shared_ptr< WProperties > getProperties() const;
/**
* Return a pointer to the information properties object of the dataset. The dataset intends these properties to not be modified.
*
* \return the properties.
*/
boost::shared_ptr< WProperties > getInformationProperties() const;
protected:
/**
* The property object for the dataset.
*/
boost::shared_ptr< WProperties > m_properties;
/**
* The property object for the dataset containing only props whose purpose is "PV_PURPOSE_INFORMNATION". It is useful to define some property
* to only be of informational nature. The GUI does not modify them. As it is a WProperties instance, you can use it the same way as
* m_properties.
*/
boost::shared_ptr< WProperties > m_infoProperties;
/**
* Creates a 3d texture from a dataset. This function will be overloaded for the
* various data types. A template function is not recommended due to the different commands
* in the image creation.
*
*
* \param source Pointer to the raw data of a dataset
* \param components Number of values used in a Voxel, usually 1, 3 or 4
*/
osg::ref_ptr< osg::Image > createTexture3D( unsigned char* source, int components = 1 );
/**
* Creates a 3d texture from a dataset. This function will be overloaded for the
* various data types. A template function is not recommended due to the different commands
* in the image creation.
*
*
* \param source Pointer to the raw data of a dataset
* \param components Number of values used in a Voxel, usually 1, 3 or 4
*/
osg::ref_ptr< osg::Image > createTexture3D( int16_t* source, int components = 1 );
/**
* Creates a 3d texture from a dataset. This function will be overloaded for the
* various data types. A template function is not recommended due to the different commands
* in the image creation.
*
*
* \param source Pointer to the raw data of a dataset
* \param components Number of values used in a Voxel, usually 1, 3 or 4
*/
osg::ref_ptr< osg::Image > createTexture3D( int* source, int components = 1 );
/**
* Creates a 3d texture from a dataset. This function will be overloaded for the
* various data types. A template function is not recommended due to the different commands
* in the image creation.
*
*
* \param source Pointer to the raw data of a dataset
* \param components Number of values used in a Voxel, usually 1, 3 or 4
*/
osg::ref_ptr< osg::Image > createTexture3D( float* source, int components = 1 );
/**
* Creates a 3d texture from a dataset. This function will be overloaded for the
* various data types. A template function is not recommended due to the different commands
* in the image creation.
*
*
* \param source Pointer to the raw data of a dataset
* \param components Number of values used in a Voxel, usually 1, 3 or 4
*/
osg::ref_ptr< osg::Image > createTexture3D( double* source, int components = 1 );
/**
* Notifies about changes. Mainly this will be used by the textures whenever the threshold/opacity change.
*/
void notifyChange();
/**
* Creates a 3D texture for the data set.
*/
void createTexture();
/**
* The lock for securing createTexture.
*/
boost::shared_mutex m_creationLock;
/**
* Alpha value. Used for blending in/out textures.
*/
float m_alpha;
/**
* Threshold used for to exclude values.
*/
float m_threshold;
/**
* The actual texture.
*/
osg::ref_ptr< WGETexture3D > m_texture;
/**
* The value set from which the texture gets created.
*/
boost::shared_ptr<WValueSetBase> m_valueSet;
/**
* The grid used to set up the texture.
*/
boost::shared_ptr< WGridRegular3D > m_grid;
/**
* The condition which is fired whenever the dataset gets some kind of dirty (threshold, opacity, ...)
*/
boost::shared_ptr< WCondition > m_changeCondition;
/**
* Flag denotes whether this texture should be used by surfaces/slides for surface colormapping.
*/
bool m_globalActive;
/**
* flag denotes whether the texture filter should active or not
*/
bool m_interpolation;
/**
* indicates which colormap to use
*/
int m_cmap;
/**
* The smallest value inside the dataset
*/
float m_minValue;
/**
* The largest value inside the dataset
*/
float m_maxValue;
/**
* The scaling factor to apply to unscale a [0,1] to [0,max-min]
*/
float m_scale;
/**
* Scales the specified value to the interval [0,1] using m_maxValue and m_minValue.
*
* \param value the value to scale
*
* \return the value scaled to [0,1]
*/
float scaleInterval( float value ) const;
private:
};
#endif // WDATATEXTURE3D_H
......@@ -30,7 +30,6 @@
#include "../common/WLogger.h"
#include "WDataSet.h"
#include "WDataTexture3D.h"
#include "exceptions/WDHNoSuchDataSet.h"
#include "WSubject.h"
......@@ -70,13 +69,6 @@ void WSubject::addDataSet( boost::shared_ptr< WDataSet > dataset )
{
// simply add the new dataset
m_datasets.push_back( dataset );
// also register condition
boost::shared_ptr< WCondition > c = dataset->getChangeCondition();
if ( c.get() )
{
m_changeCondition->add( c );
}
m_changeCondition->notify();
m_listChangeCondition->notify();
}
......@@ -89,13 +81,6 @@ void WSubject::removeDataSet( boost::shared_ptr< WDataSet > dataset )
DatasetIterator fIt = std::find( l->get().begin(), l->get().end(), dataset );
l->get().erase( fIt );
// also de-register condition
boost::shared_ptr< WCondition > c = dataset->getChangeCondition();
if ( c.get() )
{
m_changeCondition->remove( c );
}
// unlock if some callback notified below wants to access the list
l.reset();
......@@ -106,17 +91,6 @@ void WSubject::removeDataSet( boost::shared_ptr< WDataSet > dataset )
void WSubject::clear()
{
DatasetSharedContainerType::WriteTicket l = m_datasets.getWriteTicket();
// iterate and find, remove
for ( DatasetIterator iter = l->get().begin(); iter != l->get().end(); ++iter )
{
// also de-register condition
boost::shared_ptr< WCondition > c = ( *iter )->getChangeCondition();
if ( c.get() )
{
m_changeCondition->remove( c );
}
}
l->get().clear();
// unlock if some callback notified below wants to access the list
......@@ -135,26 +109,6 @@ WSubject::DatasetSharedContainerType::WriteTicket WSubject::getDatasetsForWritin
return m_datasets.getWriteTicket();
}
std::vector< boost::shared_ptr< WDataTexture3D > > WSubject::getDataTextures( bool onlyActive )
{
std::vector< boost::shared_ptr< WDataTexture3D > > tex;
// Read lock the list, the lock is freed upon destruction of the ticket (if it goes out of scope for example).
DatasetSharedContainerType::ReadTicket l = m_datasets.getReadTicket();