From 16ac72729562a61a689e4cde6a05c4a27955e071 Mon Sep 17 00:00:00 2001 From: Stefan Philips Date: Thu, 26 Jul 2012 20:36:38 +0200 Subject: [PATCH] [ADD] Show all three transformation matrixes as information properties --- src/core/dataHandler/WGridRegular3D.h | 4 --- src/modules/data/WMData.cpp | 38 ++++++++++++++++++++++++++- src/modules/data/WMData.h | 3 +++ 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/core/dataHandler/WGridRegular3D.h b/src/core/dataHandler/WGridRegular3D.h index b150516dc..b41437620 100644 --- a/src/core/dataHandler/WGridRegular3D.h +++ b/src/core/dataHandler/WGridRegular3D.h @@ -1194,10 +1194,6 @@ void WGridRegular3DTemplate< T >::initInformationProperties() WPropDouble zOffset = m_infoProperties->addProperty( "Z offset: ", "The distance between samples in z direction", static_cast< double >( getOffsetZ() ) ); - - WPropMatrix4X4 transformation = m_infoProperties->addProperty( "Transformation", - "The transformation of this grid.", - static_cast< WMatrix4d >( getTransform() ) ); } // +----------------------+ diff --git a/src/modules/data/WMData.cpp b/src/modules/data/WMData.cpp index 2c4b1a26d..bf091741b 100644 --- a/src/modules/data/WMData.cpp +++ b/src/modules/data/WMData.cpp @@ -288,7 +288,8 @@ void WMData::moduleMain() // register the dataset properties m_properties->addProperty( m_dataSet->getProperties() ); m_infoProperties->addProperty( m_dataSet->getInformationProperties() ); - + m_infoProperties->addProperty( getTransformationProperties() ); + // I am interested in the active property ( manually subscribe signal ) m_active->getCondition()->subscribeSignal( boost::bind( &WMData::propertyChanged, this, m_active ) ); @@ -450,3 +451,38 @@ std::string WMData::getDataTypeString( boost::shared_ptr< WDataSetSingle > dss ) return result; } +namespace +{ + // helper which gets a WMatrix< double > and returns a WMatrix4d + WMatrix4d WMatrixDoubleToWMatrix4d( const WMatrix< double >& matrix ) + { + WAssert( matrix.getNbRows() == 4, "" ); + WAssert( matrix.getNbCols() == 4, "" ); + WMatrix4d result; + for( size_t i = 0; i < 4; ++i ) + { + for( size_t j = 0; j < 4; ++j ) + { + result( i, j ) = matrix( i, j ); + } + } + return result; + } +} + +boost::shared_ptr< WProperties > WMData::getTransformationProperties() const +{ + boost::shared_ptr< WProperties > result( new WProperties( "Transformations", "Availabe transformation matrices for data-set " ) ); + WPropGroup transformation = result->addPropertyGroup( "Transformation", + "The transformation of this grid." ); + WPropMatrix4X4 noMatrixTransformation = result->addProperty( "No matrix transformation", + "The no matrix transformation for this data set.", + WMatrixDoubleToWMatrix4d( m_transformNoMatrix ) ); + WPropMatrix4X4 sformMatrixTransformation = result->addProperty( "sform matrix transformation", + "The sform matrix transformation for this data set.", + WMatrixDoubleToWMatrix4d( m_transformSForm ) ); + WPropMatrix4X4 qformMatrixTransformation = result->addProperty( "qform matrix transformation", + "The qform matrix transformation for this data set.", + WMatrixDoubleToWMatrix4d( m_transformQForm ) ); + return result; +} diff --git a/src/modules/data/WMData.h b/src/modules/data/WMData.h index b01b750e5..d718c122a 100644 --- a/src/modules/data/WMData.h +++ b/src/modules/data/WMData.h @@ -177,6 +177,9 @@ protected: WMatrix< double > m_transformQForm; private: + //! returns info property group with the three availabe transformation matrixes + boost::shared_ptr< WProperties > getTransformationProperties() const; + //! a condition for the matrix selection boost::shared_ptr< WCondition > m_propCondition; -- GitLab