Commit 08bd7658 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[MERGE]

parents ebd8e110 659dc5a2
......@@ -12,3 +12,5 @@ eichelbaum@informatik.uni-leipzig.de Sebastian_Eichelbaum
cornimueller Cornelius_Mueller
mam04cvr@studserv.uni-leipzig.de Cornelius_Mueller
hlawitschka@ucdavis.edu Mario_Hlawitschka
mai02igw@informatik.uni-leipzig.de Robin_Ledig
mai02ifw@informatik.uni-leipzig.de Robin_Ledig
......@@ -27,7 +27,7 @@
#include <boost/shared_ptr.hpp>
#include "../../dataHandler/WDataSetFibers.h"
#include "../../dataHandler/WDataSetFiberVector.h"
#include "../../math/fiberSimilarity/WDLTMetric.h"
#include "../WLimits.h"
#include "../WTransferable.h"
......@@ -66,12 +66,12 @@ void WFiberCluster::merge( WFiberCluster& other ) // NOLINT
// NODOXYGEN
// \cond
void WFiberCluster::setDataSetReference( boost::shared_ptr< const WDataSetFibers > fibs )
void WFiberCluster::setDataSetReference( boost::shared_ptr< const WDataSetFiberVector > fibs )
{
m_fibs = fibs;
}
boost::shared_ptr< const WDataSetFibers > WFiberCluster::getDataSetReference() const
boost::shared_ptr< const WDataSetFiberVector > WFiberCluster::getDataSetReference() const
{
return m_fibs;
}
......
......@@ -31,12 +31,12 @@
#include <boost/shared_ptr.hpp>
#include "../../dataHandler/WDataSetFibers.h"
#include "../../dataHandler/WDataSetFiberVector.h"
#include "../WColor.h"
#include "../WTransferable.h"
/**
* Represents a cluster of indices of a WDataSetFibers.
* Represents a cluster of indices of a WDataSetFiberVector.
*/
class WFiberCluster : public WTransferable
{
......@@ -140,8 +140,8 @@ public:
// InputConnectors we must agglomerate those into one object. Please remove this.
// DISABLE DOXYGEN HERE
// \cond
void setDataSetReference( boost::shared_ptr< const WDataSetFibers > fibs );
boost::shared_ptr< const WDataSetFibers > getDataSetReference() const;
void setDataSetReference( boost::shared_ptr< const WDataSetFiberVector > fibs );
boost::shared_ptr< const WDataSetFiberVector > getDataSetReference() const;
static boost::shared_ptr< WPrototyped > getPrototype();
protected:
......@@ -163,7 +163,7 @@ private:
/**
* Reference to the real fibers of the brain this cluster belongs to.
*/
boost::shared_ptr< const WDataSetFibers > m_fibs;
boost::shared_ptr< const WDataSetFiberVector > m_fibs;
/**
* Color which is used to paint the members of this cluster.
......
......@@ -28,102 +28,77 @@
#include "WDataSet.h"
#include "WDataSetFibers2.h"
#include "WDataSetFiberVector.h"
// prototype instance as singleton
boost::shared_ptr< WPrototyped > WDataSetFibers2::m_prototype = boost::shared_ptr< WPrototyped >();
boost::shared_ptr< WPrototyped > WDataSetFiberVector::m_prototype = boost::shared_ptr< WPrototyped >();
WDataSetFibers2::WDataSetFibers2()
: WDataSet()
void WDataSetFiberVector::sortDescLength()
{
// default constructor used by the prototype mechanism
std::sort( m_fibers->begin(), m_fibers->end(), wmath::hasGreaterLengthThen );
}
WDataSetFibers2::WDataSetFibers2( boost::shared_ptr< std::vector< float > >vertices,
boost::shared_ptr< std::vector< unsigned int > > lineStartIndexes,
boost::shared_ptr< std::vector< unsigned int > > lineLengths,
boost::shared_ptr< std::vector< unsigned int > > verticesReverse )
: WDataSet(),
m_vertices( vertices ),
m_lineStartIndexes( lineStartIndexes ),
m_lineLengths( lineLengths ),
m_verticesReverse( verticesReverse )
void WDataSetFiberVector::erase( const std::vector< bool > &unused )
{
for ( size_t i = 0; i < m_vertices->size(); ++i )
assert( unused.size() == m_fibers->size() );
std::vector< wmath::WFiber >::iterator useable = m_fibers->begin();
for( size_t i = 0 ; i < unused.size(); ++i )
{
m_vertices->at( i ) = 160 - m_vertices->at( i );
++i;
m_vertices->at( i ) = 200 - m_vertices->at( i );
++i;
//m_pointArray[i] = m_dh->frames - m_pointArray[i];
if( !unused[i] )
{
*useable = ( *m_fibers )[i];
useable++;
}
}
m_fibers->erase( useable, m_fibers->end() );
}
void WDataSetFibers2::sortDescLength()
{
//std::sort( m_fibers->begin(), m_fibers->end(), wmath::hasGreaterLengthThen );
}
bool WDataSetFibers2::isTexture() const
bool WDataSetFiberVector::isTexture() const
{
return false;
}
size_t WDataSetFibers2::size() const
WDataSetFiberVector::WDataSetFiberVector( boost::shared_ptr< std::vector< wmath::WFiber > > fibs )
: WDataSet(),
m_fibers( fibs )
{
return m_lineStartIndexes->size();
//return m_fibers->size();
}
//const wmath::WFiber& WDataSetFibers2::operator[]( const size_t index ) const
//{
// assert( index < m_fibers->size() );
// return (*m_fibers)[index];
//}
const std::string WDataSetFibers2::getName() const
WDataSetFiberVector::WDataSetFiberVector()
: WDataSet(),
m_fibers()
{
return "WDataSetFibers";
// default constructor used by the prototype mechanism
}
const std::string WDataSetFibers2::getDescription() const
size_t WDataSetFiberVector::size() const
{
return "Contains tracked fiber data.";
return m_fibers->size();
}
boost::shared_ptr< WPrototyped > WDataSetFibers2::getPrototype()
const wmath::WFiber& WDataSetFiberVector::operator[]( const size_t index ) const
{
if ( !m_prototype )
{
m_prototype = boost::shared_ptr< WPrototyped >( new WDataSetFibers2() );
}
return m_prototype;
assert( index < m_fibers->size() );
return (*m_fibers)[index];
}
boost::shared_ptr< std::vector< float > > WDataSetFibers2::getVertices() const
const std::string WDataSetFiberVector::getName() const
{
return m_vertices;
return "WDataSetFiberVector";
}
boost::shared_ptr< std::vector< unsigned int > > WDataSetFibers2::getLineStartIndexes() const
const std::string WDataSetFiberVector::getDescription() const
{
return m_lineStartIndexes;
return "Contains tracked fiber data.";
}
boost::shared_ptr< std::vector< unsigned int > > WDataSetFibers2::getLineLengths() const
boost::shared_ptr< WPrototyped > WDataSetFiberVector::getPrototype()
{
return m_lineLengths;
}
if ( !m_prototype )
{
m_prototype = boost::shared_ptr< WPrototyped >( new WDataSetFiberVector() );
}
boost::shared_ptr< std::vector< unsigned int > > WDataSetFibers2::getVerticesReverse() const
{
return m_verticesReverse;
return m_prototype;
}
wmath::WPosition WDataSetFibers2::getPosition( unsigned int fiber, unsigned int vertex ) const
{
unsigned int index = m_lineStartIndexes->at( fiber ) * 3;
index += vertex * 3;
return wmath::WPosition( m_vertices->at( index ), m_vertices->at( index + 1 ), m_vertices->at( index + 2 ) );
}
......@@ -22,53 +22,60 @@
//
//---------------------------------------------------------------------------
#ifndef WDATASETFIBERS2_H
#define WDATASETFIBERS2_H
#ifndef WDATASETFIBERVECTOR_H
#define WDATASETFIBERVECTOR_H
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include "../math/WPosition.h"
#include "WDataSet.h"
#include "../math/WFiber.h"
/**
* Represents a simple set of WFibers.
*/
class WDataSetFibers2 : public WDataSet
class WDataSetFiberVector : public WDataSet
{
public:
/**
* Constructs a new set of fibers, usage of WFiber here is for backward compatibility and should be removed
* Constructs a new set of WFibers
*
* \param vertices
* \param lineStartIndexes
* \param lineLengths
* \param verticesReverse
* \param fibs Fiber vector to store in this data set
*/
WDataSetFibers2( boost::shared_ptr< std::vector< float > >vertices,
boost::shared_ptr< std::vector< unsigned int > > lineStartIndexes,
boost::shared_ptr< std::vector< unsigned int > > lineLengths,
boost::shared_ptr< std::vector< unsigned int > > verticesReverse );
explicit WDataSetFiberVector( boost::shared_ptr< std::vector< wmath::WFiber > > fibs );
/**
* Constructs a new set of WFibers. The constructed instance is not usable.
*/
WDataSetFibers2();
WDataSetFiberVector();
/**
* Get number of fibers in this data set.
*/
size_t size() const;
/**
* \param index The index number of the fiber which should be returned
* \return The i'th fiber.
*/
const wmath::WFiber& operator[]( const size_t index ) const;
/**
* Sort fibers descending on their length.
*/
void sortDescLength();
/**
* Deletes all those fibers which are marked true in the given
* unused vector.
*
* \param unused Vector having the those inidices set to true which should
* be deleted.
*/
void erase( const std::vector< bool > &unused );
/**
* Determines whether this dataset can be used as a texture.
*
......@@ -97,34 +104,6 @@ public:
*/
static boost::shared_ptr< WPrototyped > getPrototype();
/**
* Getter for m_vertices
*/
boost::shared_ptr< std::vector< float > > getVertices() const;
/**
* Getter
*/
boost::shared_ptr< std::vector< unsigned int > > getLineStartIndexes() const;
/**
* Getter
*/
boost::shared_ptr< std::vector< unsigned int > > getLineLengths() const;
/**
* Getter
*/
boost::shared_ptr< std::vector< unsigned int > > getVerticesReverse() const;
/**
* returns the position in space for a vertex of a given fiber
*
* \param fiber
* \param vertex
*/
wmath::WPosition getPosition( unsigned int fiber, unsigned int vertex ) const;
protected:
/**
......@@ -133,25 +112,7 @@ protected:
static boost::shared_ptr< WPrototyped > m_prototype;
private:
/**
* Point vector for all fibers that is actually usable for what we want to do
*/
boost::shared_ptr< std::vector< float > > m_vertices;
/**
* Line vector that contains the start index for each line
*/
boost::shared_ptr< std::vector< unsigned int > > m_lineStartIndexes;
/**
* Line vector that contains the number of vertices for each line
*/
boost::shared_ptr< std::vector< unsigned int > > m_lineLengths;
/**
* Reverse lookup table for which point belongs to which fiber
*/
boost::shared_ptr< std::vector< unsigned int > > m_verticesReverse;
boost::shared_ptr< std::vector< wmath::WFiber > > m_fibers; //!< stores all the fibers
};
#endif // WDATASETFIBERS2_H
#endif // WDATASETFIBERVECTOR_H
......@@ -33,53 +33,45 @@
// prototype instance as singleton
boost::shared_ptr< WPrototyped > WDataSetFibers::m_prototype = boost::shared_ptr< WPrototyped >();
void WDataSetFibers::sortDescLength()
WDataSetFibers::WDataSetFibers()
: WDataSet()
{
std::sort( m_fibers->begin(), m_fibers->end(), wmath::hasGreaterLengthThen );
// default constructor used by the prototype mechanism
}
void WDataSetFibers::erase( const std::vector< bool > &unused )
WDataSetFibers::WDataSetFibers( boost::shared_ptr< std::vector< float > >vertices,
boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
boost::shared_ptr< std::vector< size_t > > lineLengths,
boost::shared_ptr< std::vector< size_t > > verticesReverse )
: WDataSet(),
m_vertices( vertices ),
m_lineStartIndexes( lineStartIndexes ),
m_lineLengths( lineLengths ),
m_verticesReverse( verticesReverse )
{
assert( unused.size() == m_fibers->size() );
std::vector< wmath::WFiber >::iterator useable = m_fibers->begin();
for( size_t i = 0 ; i < unused.size(); ++i )
for ( size_t i = 0; i < m_vertices->size(); ++i )
{
if( !unused[i] )
{
*useable = ( *m_fibers )[i];
useable++;
}
m_vertices->at( i ) = 160 - m_vertices->at( i );
++i;
m_vertices->at( i ) = 200 - m_vertices->at( i );
++i;
//m_pointArray[i] = m_dh->frames - m_pointArray[i];
}
m_fibers->erase( useable, m_fibers->end() );
}
bool WDataSetFibers::isTexture() const
{
return false;
}
WDataSetFibers::WDataSetFibers( boost::shared_ptr< std::vector< wmath::WFiber > > fibs )
: WDataSet(),
m_fibers( fibs )
void WDataSetFibers::sortDescLength()
{
//std::sort( m_fibers->begin(), m_fibers->end(), wmath::hasGreaterLengthThen );
}
WDataSetFibers::WDataSetFibers()
: WDataSet(),
m_fibers()
bool WDataSetFibers::isTexture() const
{
// default constructor used by the prototype mechanism
return false;
}
size_t WDataSetFibers::size() const
{
return m_fibers->size();
}
const wmath::WFiber& WDataSetFibers::operator[]( const size_t index ) const
{
assert( index < m_fibers->size() );
return (*m_fibers)[index];
return m_lineStartIndexes->size();
}
const std::string WDataSetFibers::getName() const
......@@ -102,3 +94,29 @@ boost::shared_ptr< WPrototyped > WDataSetFibers::getPrototype()
return m_prototype;
}
boost::shared_ptr< std::vector< float > > WDataSetFibers::getVertices() const
{
return m_vertices;
}
boost::shared_ptr< std::vector< size_t > > WDataSetFibers::getLineStartIndexes() const
{
return m_lineStartIndexes;
}
boost::shared_ptr< std::vector< size_t > > WDataSetFibers::getLineLengths() const
{
return m_lineLengths;
}
boost::shared_ptr< std::vector< size_t > > WDataSetFibers::getVerticesReverse() const
{
return m_verticesReverse;
}
wmath::WPosition WDataSetFibers::getPosition( size_t fiber, size_t vertex ) const
{
size_t index = m_lineStartIndexes->at( fiber ) * 3;
index += vertex * 3;
return wmath::WPosition( m_vertices->at( index ), m_vertices->at( index + 1 ), m_vertices->at( index + 2 ) );
}
......@@ -30,8 +30,10 @@
#include <boost/shared_ptr.hpp>
#include "../math/WPosition.h"
#include "WDataSet.h"
#include "../math/WFiber.h"
/**
* Represents a simple set of WFibers.
......@@ -40,11 +42,17 @@ class WDataSetFibers : public WDataSet
{
public:
/**
* Constructs a new set of WFibers
* Constructs a new set of fibers, usage of WFiber here is for backward compatibility and should be removed
*
* \param fibs Fiber vector to store in this data set
* \param vertices
* \param lineStartIndexes
* \param lineLengths
* \param verticesReverse
*/
explicit WDataSetFibers( boost::shared_ptr< std::vector< wmath::WFiber > > fibs );
WDataSetFibers( boost::shared_ptr< std::vector< float > >vertices,
boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
boost::shared_ptr< std::vector< size_t > > lineLengths,
boost::shared_ptr< std::vector< size_t > > verticesReverse );
/**
* Constructs a new set of WFibers. The constructed instance is not usable.
......@@ -56,26 +64,11 @@ public:
*/
size_t size() const;
/**
* \param index The index number of the fiber which should be returned
* \return The i'th fiber.
*/
const wmath::WFiber& operator[]( const size_t index ) const;
/**
* Sort fibers descending on their length.
*/
void sortDescLength();
/**
* Deletes all those fibers which are marked true in the given
* unused vector.
*
* \param unused Vector having the those inidices set to true which should
* be deleted.
*/
void erase( const std::vector< bool > &unused );
/**
* Determines whether this dataset can be used as a texture.
*
......@@ -104,6 +97,34 @@ public:
*/
static boost::shared_ptr< WPrototyped > getPrototype();
/**
* Getter for m_vertices
*/
boost::shared_ptr< std::vector< float > > getVertices() const;
/**
* Getter
*/
boost::shared_ptr< std::vector< size_t > > getLineStartIndexes() const;
/**
* Getter
*/
boost::shared_ptr< std::vector< size_t > > getLineLengths() const;
/**
* Getter
*/
boost::shared_ptr< std::vector< size_t > > getVerticesReverse() const;
/**
* returns the position in space for a vertex of a given fiber
*
* \param fiber
* \param vertex
*/
wmath::WPosition getPosition( size_t fiber, size_t vertex ) const;
protected:
/**
......@@ -112,7 +133,25 @@ protected:
static boost::shared_ptr< WPrototyped > m_prototype;
private:
boost::shared_ptr< std::vector< wmath::WFiber > > m_fibers; //!< stores all the fibers
/**
* Point vector for all fibers that is actually usable for what we want to do
*/
boost::shared_ptr< std::vector< float > > m_vertices;
/**
* Line vector that contains the start index for each line
*/
boost::shared_ptr< std::vector< size_t > > m_lineStartIndexes;
/**
* Line vector that contains the number of vertices for each line
*/
boost::shared_ptr< std::vector< size_t > > m_lineLengths;
/**
* Reverse lookup table for which point belongs to which fiber
*/
boost::shared_ptr< std::vector< size_t > > m_verticesReverse;
};
#endif // WDATASETFIBERS_H
......@@ -27,8 +27,8 @@
#include <vector>
#include "../../math/WPosition.h"
#include "../../math/WVector3D.h"
#include "../math/WPosition.h"
#include "../math/WVector3D.h"
/**
* A triangle consisting of 3 id of vertices that represent its corners
......
//---------------------------------------------------------------------------
//
// 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/>.
//
//---------------------------------------------------------------------------