Commit 1af6ca83 authored by ledig's avatar ledig
Browse files

[STYLE]

parent 36934b70
......@@ -32,7 +32,7 @@
/**
* Class for keeping a single named item in a WItemSelection.
*/
class OWCOMMON_EXPORT WItemSelectionItem
class OWCOMMON_EXPORT WItemSelectionItem // NOLINT
{
public:
......
......@@ -22,12 +22,12 @@
//
//---------------------------------------------------------------------------
#include "stdint.h"
#include<vector>
#include <boost/math/special_functions/spherical_harmonic.hpp>
#include "stdint.h"
#include "WLinearAlgebraFunctions.h"
#include "WUnitSphereCoordinates.h"
#include "WValue.h"
......@@ -37,7 +37,6 @@
namespace wmath
{
std::vector<size_t> wmath::WSymmetricSphericalHarmonic::m_lj;
WSymmetricSphericalHarmonic::WSymmetricSphericalHarmonic() :
......@@ -213,7 +212,8 @@ wmath::WMatrix<double> WSymmetricSphericalHarmonic::calcBMatrix( const std::vect
for ( int m = 1; m <= k; m++ )
{
j = ( k*k+k+2 ) / 2 + m;
B( row, j-1 ) = rootOf2 * static_cast<double>( std::pow( static_cast<double>( -1 ), m+1 ) ) * boost::math::spherical_harmonic_i( k, m, theta, phi );
B( row, j-1 ) = rootOf2 * static_cast<double>( std::pow( static_cast<double>( -1 ), m+1 ) )
* boost::math::spherical_harmonic_i( k, m, theta, phi );
}
// m = 0
B( row, ( k*k+k+2 ) / 2 - 1 ) = boost::math::spherical_harmonic_r( k, 0, theta, phi );
......@@ -289,5 +289,4 @@ wmath::WMatrix<double> WSymmetricSphericalHarmonic::calcFRTMatrix( size_t order
}
return result;
}
} // Namespace WMath
......@@ -199,7 +199,7 @@ public:
A( 2, 2 ) = i;
wmath::WMatrix<double> Ainvers( wmath::pseudoInverse( A ) );
wmath::WMatrix<double> I( A*Ainvers );
for ( size_t row = 0; row < I.getNbRows(); row++ )
{
for ( size_t col = 0; col < I.getNbCols(); col++ )
......
......@@ -56,7 +56,7 @@ public:
A( 2, 0 ) = g;
A( 2, 1 ) = h;
A( 2, 2 ) = i;
wmath::WMatrix< double > U( nbRows, nbCols );
wmath::WMatrix< double > V( nbCols, nbCols );
wmath::WValue< double > S( nbCols );
......@@ -64,12 +64,12 @@ public:
wmath::WOSSIMHelper::computeSVD( A, U, V, S );
wmath::WMatrix< double > Sm( nbRows, nbCols );
Sm( 0,0 ) = S[0];
Sm( 1,1 ) = S[1];
Sm( 2,2 ) = S[2];
Sm( 0, 0 ) = S[0];
Sm( 1, 1 ) = S[1];
Sm( 2, 2 ) = S[2];
wmath::WMatrix<double> svd( U*Sm*V.transposed() );
for ( size_t row = 0; row < svd.getNbRows(); row++ )
{
for ( size_t col = 0; col < svd.getNbCols(); col++ )
......@@ -88,7 +88,7 @@ public:
// d = 4.5, e = 5.6, f = 6.7,
// g = 3.4, h = 1.2, i = 7.0;
// wmath::WMatrix< double > A( nbRows, nbCols );
//
//
// A( 0, 0 ) = a;
// A( 0, 1 ) = b;
// A( 0, 2 ) = c;
......@@ -98,10 +98,10 @@ public:
// A( 2, 0 ) = g;
// A( 2, 1 ) = h;
// A( 2, 2 ) = i;
//
//
// wmath::WMatrix<double> Ainvers( wmath::WOSSIMHelper::pseudoInverse( A ) );
// wmath::WMatrix<double> I( A*Ainvers );
//
//
// for ( size_t row = 0; row < I.getNbRows(); row++ )
// {
// for ( size_t col = 0; col < I.getNbCols(); col++ )
......
......@@ -503,4 +503,4 @@ void WMFiberDisplay::userData::updateRenderModes()
void WMFiberDisplay::userData::toggleColoring()
{
parent->toggleColoring();
}
\ No newline at end of file
}
......@@ -288,7 +288,7 @@ private:
class userData: public osg::Referenced
{
public:
userData( boost::shared_ptr< WMFiberDisplay > _parent )
explicit userData( boost::shared_ptr< WMFiberDisplay > _parent )
{
parent = _parent;
}
......
......@@ -27,6 +27,7 @@
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <boost/shared_ptr.hpp>
#include <boost/signals2/signal.hpp>
......@@ -287,14 +288,18 @@ void WMNavSlices::create()
rootState->setMode( GL_BLEND, osg::StateAttribute::ON );
m_rootNode->setUserData( this );
m_slicesNode->setUserData( this );
m_xSliceNode->setUserData( this );
m_ySliceNode->setUserData( this );
m_zSliceNode->setUserData( this );
m_xCrossNode->setUserData( this );
m_yCrossNode->setUserData( this );
m_zCrossNode->setUserData( this );
osg::ref_ptr< userData > usrData = osg::ref_ptr< userData >(
new userData( boost::shared_dynamic_cast< WMNavSlices >( shared_from_this() ) )
);
m_rootNode->setUserData( usrData );
m_slicesNode->setUserData( usrData );
m_xSliceNode->setUserData( usrData );
m_ySliceNode->setUserData( usrData );
m_zSliceNode->setUserData( usrData );
m_xCrossNode->setUserData( usrData );
m_yCrossNode->setUserData( usrData );
m_zCrossNode->setUserData( usrData );
m_slicesNode->addUpdateCallback( new sliceNodeCallback );
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->insert( m_slicesNode );
......@@ -339,21 +344,6 @@ void WMNavSlices::setSlicePosFromPick( WPickInfo pickInfo )
// handle the pick information on the slice views
if ( pickInfo.getViewerName() != "main" && pickInfo.getViewerName() != "" )
{
/*
osg::ref_ptr< osg::Viewport > port;
port = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Axial View" )->getCamera()->getViewport();
float axialWidgetWidth = port->width();
float axialWidgetHeight = port->height();
port = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Sagittal View" )->getCamera()->getViewport();
float sagittalWidgetWidth = port->width();
float sagittalWidgetHeight = port->height();
port = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Coronal View" )->getCamera()->getViewport();
float coronalWidgetWidth = port->width();
float coronalWidgetHeight = port->height();
*/
// this uses fixed windows size of 150x150 pixel
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_updateLock );
......@@ -389,7 +379,7 @@ void WMNavSlices::setSlicePosFromPick( WPickInfo pickInfo )
MStPY = 240.0 / static_cast< double >( m_axialWidgetHeight );
scale1 = 240.0 * aspectR / width;
scale2 = 240.0 / height;
m1 = height * scale1 / MStPY;
m1 = height * scale1 / MStPY;
m2 = width * scale2 / MStPX;
if( m1 <= static_cast< double >( m_axialWidgetHeight ) && m2 <= static_cast< double >( m_axialWidgetWidth ) )
......@@ -429,7 +419,7 @@ void WMNavSlices::setSlicePosFromPick( WPickInfo pickInfo )
MStPY = 240.0 / static_cast< double >( m_sagittalWidgetHeight );
scale1 = 240.0 * aspectR / width;
scale2 = 240.0 / height;
m1 = height * scale1 / MStPY;
m1 = height * scale1 / MStPY;
m2 = width * scale2 / MStPX;
if( m1 <= static_cast< double >( m_sagittalWidgetHeight ) && m2 <= static_cast< double >( m_sagittalWidgetWidth ) )
......@@ -469,7 +459,7 @@ void WMNavSlices::setSlicePosFromPick( WPickInfo pickInfo )
MStPY = 240.0 / static_cast< double >( m_coronalWidgetHeight );
scale1 = 240.0 * aspectR / width;
scale2 = 240.0 / height;
m1 = height * scale1 / MStPY;
m1 = height * scale1 / MStPY;
m2 = width * scale2 / MStPX;
if( m1 <= static_cast< double >( m_sagittalWidgetHeight ) && m2 <= static_cast< double >( m_coronalWidgetWidth ) )
......@@ -1121,7 +1111,7 @@ void WMNavSlices::updateViewportMatrix()
double MStPY = 240.0 / static_cast< double >( m_axialWidgetHeight );
double scale1 = 240.0 * aspectR / width;
double scale2 = 240.0 / height;
double m1 = height * scale1 / MStPY;
double m1 = height * scale1 / MStPY;
double m2 = width * scale2 / MStPX;
if( m1 <= static_cast< double >( m_axialWidgetHeight ) && m2 <= static_cast< double >( m_axialWidgetWidth ) )
......@@ -1168,7 +1158,7 @@ void WMNavSlices::updateViewportMatrix()
double MStPY = 240.0 / static_cast< double >( m_sagittalWidgetHeight );
double scale1 = 240.0 * aspectR / width;
double scale2 = 240.0 / height;
double m1 = height * scale1 / MStPY;
double m1 = height * scale1 / MStPY;
double m2 = width * scale2 / MStPX;
if( m1 <= static_cast< double >( m_sagittalWidgetHeight ) && m2 <= static_cast< double >( m_sagittalWidgetWidth ) )
......@@ -1217,7 +1207,7 @@ void WMNavSlices::updateViewportMatrix()
double MStPY = 240.0 / static_cast< double >( m_coronalWidgetHeight );
double scale1 = 240.0 * aspectR / width;
double scale2 = 240.0 / height;
double m1 = height * scale1 / MStPY;
double m1 = height * scale1 / MStPY;
double m2 = width * scale2 / MStPX;
if( m1 <= static_cast< double >( m_coronalWidgetHeight ) && m2 <= static_cast< double >( m_coronalWidgetWidth ) )
......@@ -1247,3 +1237,12 @@ void WMNavSlices::updateViewportMatrix()
}
}
void WMNavSlices::userData::updateGeometry()
{
parent->updateGeometry();
}
void WMNavSlices::userData::updateTextures()
{
parent->updateTextures();
}
......@@ -46,7 +46,7 @@
* Navigation slice module
* \ingroup modules
*/
class OWKERNEL_EXPORT WMNavSlices: public WModule, public osg::Referenced
class OWKERNEL_EXPORT WMNavSlices: public WModule
{
public:
......@@ -354,6 +354,22 @@ private:
int m_coronalWidgetHeight;
class userData: public osg::Referenced
{
friend class WMNavSlices;
public:
explicit userData( boost::shared_ptr< WMNavSlices > _parent )
{
parent = _parent;
}
void updateGeometry();
void updateTextures();
private:
boost::shared_ptr< WMNavSlices > parent;
};
/**
* Node callback to handle updates properly
*/
......@@ -368,7 +384,7 @@ private:
*/
virtual void operator()( osg::Node* node, osg::NodeVisitor* nv )
{
osg::ref_ptr< WMNavSlices > module = static_cast< WMNavSlices* > ( node->getUserData() );
osg::ref_ptr< userData > module = static_cast< userData* > ( node->getUserData() );
if ( module )
{
......
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