Commit bb810836 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] added some more debug code.

parent 455f3de6
......@@ -404,6 +404,7 @@ template<typename T> boost::shared_ptr<WTriangleMesh> WMarchingCubesAlgorithm::g
double max = std::max( v1, std::max( v2, std::max( v3, std::max( v4, std::max( v5, std::max( v6, std::max( v7, v8 ) ) ) ) ) ) );
// das ist das entscheidente kriterium. Wenn das falsch ist wird auch beim nicht-SpanSpace MC was falsch
//wlog::debug( "MC Zelle" ) << x << " - " << y << " - " << z << "|" << min << "->" << max;
if( ( min <= isoValue ) && ( max >= isoValue ) )
{
// wlog::info( "MC Direkt" ) << x << " - " << y << " - " << z;
......@@ -418,12 +419,21 @@ template<typename T> boost::shared_ptr<WTriangleMesh> WMarchingCubesAlgorithm::g
}
// Debug End
boost::shared_ptr< WSpanSpace< T > > sstyped = boost::dynamic_pointer_cast< WSpanSpace< T > >( spanSpace );
boost::shared_ptr< WSpanSpaceBase::cellids_t > cells = spanSpace->findCells( isoValue );
for( typename WSpanSpaceBase::cellids_t::const_iterator i = cells->begin(); i < cells->end(); ++i )
{
// Debug
// wlog::info( "MC SS" ) << ( *i )->m_x << " - " << ( *i )->m_y << " - " << ( *i )->m_z;
CellDef v( ( *i )->m_x, ( *i )->m_y, ( *i )->m_z );
mcMitSSListe.push_back( v );
// Alle Cellen ausgeben die laut spanspace im Isobereich liegen es aber nicht sind
typename WSpanSpace< T >::minmax_t mm = sstyped->getCellMinMax( v.get< 0 >(), v.get< 1 >() , v.get< 2 >() );
if( !( ( mm.m_min <= isoValue ) && ( mm.m_max >= isoValue ) ) )
{
wlog::debug( "MC SS Liste" ) << v.get< 0 >() << ", " << v.get< 1 >() << ", " << v.get< 2 >() << " -- [" << static_cast< float >( mm.m_min ) << ", " << static_cast< float >( mm.m_max ) << "]";
}
// Debug End
calculateMarchingCube( ( *i )->m_x, ( *i )->m_y, ( *i )->m_z, vals );
......@@ -432,46 +442,7 @@ template<typename T> boost::shared_ptr<WTriangleMesh> WMarchingCubesAlgorithm::g
// Debug: compare both lists
wlog::info( "MC Direkt - Zellen:" ) << mcDirektListe.size();
wlog::info( "MC mit SS - Zellen:" ) << mcMitSSListe.size();
// listen sortieren. Der vergleichsoperator "<" für boost::tuple erzeugt lexikographische Ordnung. Sortierung ist für
// std::set_difference nötig
std::sort( mcDirektListe.begin(), mcDirektListe.end() );
std::sort( mcMitSSListe.begin(), mcMitSSListe.end() );
// Set Difference - Mengen Unterschied. Ergebnis ist eine Liste mit den elementen die in der ersten vorhanden, aber in der 2. nicht
CellVec diffDirektZuSS( std::max( mcDirektListe.size(), mcMitSSListe.size() ) );
CellVec::iterator it = std::set_difference( mcDirektListe.begin(), mcDirektListe.end(),
mcMitSSListe.begin(), mcMitSSListe.end(),
diffDirektZuSS.begin() // Zielliste
);
// kürzen, daß der vektor nur so lang ist wie er gefüllt wurde
diffDirektZuSS.resize( it - diffDirektZuSS.begin() );
// und andersrum
CellVec diffSSZuDirekt( std::max( mcDirektListe.size(), mcMitSSListe.size() ) );
it = std::set_difference( mcMitSSListe.begin(), mcMitSSListe.end(),
mcDirektListe.begin(), mcDirektListe.end(),
diffSSZuDirekt.begin() // Zielliste
);
// kürzen, daß der vektor nur so lang ist wie er gefüllt wurde
diffSSZuDirekt.resize( it - diffSSZuDirekt.begin() );
// Den Kram ausgeben
wlog::debug( "Vergleichstest" ) << "Zellen im direkten MC, aber nicht im SS MC: " << diffDirektZuSS.size();
wlog::debug( "Vergleichstest" ) << "Zellen im SS MC, aber nicht im direkten MC: " << diffSSZuDirekt.size();
// ICh hoffe mal dass die zweite zahl immer 0 sein wird.
// Das könnte die GUI einfrieren ;-)
for( it = diffDirektZuSS.begin(); it != diffDirektZuSS.end(); ++it )
{
wlog::debug( "Diff: Direkt zu SS" ) << ( *it ).get< 0 >() << ", " << ( *it ).get< 1 >() << ", " << ( *it ).get< 2 >();
}
for( it = diffSSZuDirekt.begin(); it != diffSSZuDirekt.end(); ++it )
{
wlog::debug( "Diff: SS zu Dirtekt" ) << ( *it ).get< 0 >() << ", " << ( *it ).get< 1 >() << ", " << ( *it ).get< 2 >();
}
wlog::info( "DIfferenz: " ) << mcMitSSListe.size() - mcDirektListe.size();
// Debug End
}
else
......
......@@ -167,9 +167,15 @@ template< class T > boost::shared_ptr< SSKdTreeNode< T > > WSpanSpaceKdTree< T >
boost::shared_ptr< SSKdTreeNode< T > > kdNode( new SSKdTreeNode< T >() );
m_depth = depth;
// wlog::debug( "kdTree" ) << "---depth" << depth << "---";
// for( unsigned int fi = first; fi < last; fi++ )
// wlog::debug( "kdTree" ) << points[ fi ].m_id.m_x << " - " << points[ fi ].m_id.m_y << " - " << points[ fi ].m_id.m_z << "|" << points[ fi ].m_minMax.m_min << "->" << points[ fi ].m_minMax.m_max;
if( size <= 1 )
{
kdNode->m_location = points[ first + median ];
// wlog::debug( "SS Zelle" ) << kdNode->m_location.m_id.m_x << ", " << kdNode->m_location.m_id.m_y << ", " << kdNode->m_location.m_id.m_z << "|" << kdNode->m_location.m_minMax.m_min << "->"
// << kdNode->m_location.m_minMax.m_max ;
return kdNode;
}
......@@ -266,9 +272,6 @@ public:
*/
boost::shared_ptr< cellids_t > findCells( double iso ) const;
protected:
private:
/**
* Get the minimum and maximun isovalue of a special cell with given x,y,z coordinates
*
......@@ -280,6 +283,9 @@ private:
*/
minmax_t getCellMinMax( unsigned int coordX, unsigned int coordY, unsigned int coordZ );
protected:
private:
/**
* Calculate the id of a cell
*
......@@ -306,7 +312,7 @@ private:
* \param isovalue search in KdTree for this isovalue
* \param cellVector write in this vector the cells which this isovalue
*/
void searchKdTree( T isovalue, cellids_t& cellVector ) const;
void searchKdTree( double isovalue, cellids_t& cellVector ) const;
/**
* Search the minimun isovalues in KdTree
......@@ -315,7 +321,7 @@ private:
* \param isovalue which is search for
* \param cellVector pointer of vector in which cells are written
*/
void searchKdMinMax( boost::shared_ptr< SSKdTreeNode< T > > root, T isovalue, cellids_t& cellVector ) const;
void searchKdMinMax( boost::shared_ptr< SSKdTreeNode< T > > root, double isovalue, cellids_t& cellVector ) const;
/**
* Search the maximum values in KdTree
......@@ -324,7 +330,7 @@ private:
* \param isovalue which is search for
* \param cellVector pointer of vector in which cells are written
*/
void searchKdMaxMin( boost::shared_ptr< SSKdTreeNode< T > > root, T isovalue, cellids_t& cellVector ) const;
void searchKdMaxMin( boost::shared_ptr< SSKdTreeNode< T > > root, double isovalue, cellids_t& cellVector ) const;
cellids_t m_activeCells; //!< variable is used to get the number of active cells
};
......@@ -373,7 +379,7 @@ template< class T > WSpanSpace<T>::WSpanSpace( size_t nbCoordsX, size_t nbCoords
progressKd->finish();
wlog::debug( "SpanSpace" ) << "finished";
}
template< class T > void WSpanSpace<T>::searchKdTree( T isovalue,
template< class T > void WSpanSpace<T>::searchKdTree( double isovalue,
cellids_t& cellVector ) const
{
if( m_kdTreeNode )
......@@ -385,15 +391,17 @@ template< class T > void WSpanSpace<T>::searchKdTree( T isovalue,
else
cellVector.push_back( &m_kdTreeNode->m_location.m_id );
}
template< class T > void WSpanSpace<T>::searchKdMaxMin( boost::shared_ptr< SSKdTreeNode< T > > root, T isovalue,
template< class T > void WSpanSpace<T>::searchKdMaxMin( boost::shared_ptr< SSKdTreeNode< T > > root, double isovalue,
cellids_t& cellVector ) const
{
if( root->m_location.m_minMax.m_max > isovalue )
if( root->m_location.m_minMax.m_max >= isovalue )
{
if( root->m_location.m_minMax.m_min > isovalue )
if( root->m_location.m_minMax.m_min <= isovalue )
{
if( !root->m_rightTree && !root->m_leftTree )
{
cellVector.push_back( &root->m_location.m_id );
}
}
if( root->m_leftTree )
......@@ -406,15 +414,17 @@ template< class T > void WSpanSpace<T>::searchKdMaxMin( boost::shared_ptr< SSKdT
searchKdMinMax( root->m_rightTree, isovalue, cellVector );
}
}
template< class T > void WSpanSpace<T>::searchKdMinMax( boost::shared_ptr< SSKdTreeNode< T > > root, T isovalue,
template< class T > void WSpanSpace<T>::searchKdMinMax( boost::shared_ptr< SSKdTreeNode< T > > root, double isovalue,
cellids_t& cellVector ) const
{
if( root->m_location.m_minMax.m_min < isovalue )
if( root->m_location.m_minMax.m_min <= isovalue )
{
if( root->m_location.m_minMax.m_max > isovalue )
if( root->m_location.m_minMax.m_max >= isovalue )
{
if( !root->m_rightTree && !root->m_leftTree )
{
cellVector.push_back( &root->m_location.m_id );
}
}
if( root->m_rightTree )
{
......@@ -432,12 +442,17 @@ template< class T > typename WSpanSpace< T >::minmax_t WSpanSpace< T >::getCellM
valMax = valMin = getValue( coordX, coordY, coordZ );
// get point neighbours
// Not needed since we already initialize valMin and valMax using this voxel's value
// valMin = std::min( valMin, getValue( coordX, coordY, coordZ ) );
// valMax = std::max( valMax, getValue( coordX, coordY, coordZ ) );
valMin = std::min( valMin, getValue( coordX + 1, coordY + 1, coordZ + 1 ) );
valMax = std::max( valMax, getValue( coordX + 1, coordY + 1, coordZ + 1 ) );
valMin = std::min( valMin, getValue( coordX + 1, coordY, coordZ ) );
valMax = std::max( valMax, getValue( coordX + 1, coordY, coordZ ) );
valMin = std::min( valMin, getValue( coordX + 1, coordY, coordZ + 1 ) );
valMax = std::max( valMax, getValue( coordX + 1, coordY, coordZ + 1 ) );
valMin = std::min( valMin, getValue( coordX + 1, coordY + 1, coordZ ) );
valMax = std::max( valMax, getValue( coordX + 1, coordY + 1, coordZ ) );
......
# mostly modules from our default whitelist
ADD_MODULE( arbitraryPlane )
ADD_MODULE( arbitraryROIs )
ADD_MODULE( colormapper )
ADD_MODULE( coordinateHUD )
ADD_MODULE( coordinateSystem )
ADD_MODULE( directVolumeRendering )
ADD_MODULE( distanceMap )
ADD_MODULE( distanceMapIsosurface )
ADD_MODULE( fiberDisplay )
ADD_MODULE( fiberResampling )
ADD_MODULE( gridRenderer )
ADD_MODULE( imageSpaceLIC )
ADD_MODULE( isosurface )
ADD_MODULE( isosurfaceRaytracer )
ADD_MODULE( navigationSlices )
ADD_MODULE( scalarOperator )
ADD_MODULE( superquadricGlyphs )
ADD_MODULE( triangleMeshRenderer )
ADD_MODULE( vectorOperator )
ADD_MODULE( vectorPlot )
ADD_MODULE( voxelizer )
ADD_MODULE( transferFunction1D )
ADD_MODULE( data )
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