diff --git a/src/dataHandler/WDataSet.cpp b/src/dataHandler/WDataSet.cpp index 6ed20d93905cd0282b243beae13c6079e5569d1a..a1babf2bfdcfd2b929a03ce98d361b5201b5dfde 100644 --- a/src/dataHandler/WDataSet.cpp +++ b/src/dataHandler/WDataSet.cpp @@ -119,3 +119,7 @@ boost::shared_ptr< WProperties > WDataSet::getInformationProperties() const return m_infoProperties; } +boost::shared_ptr< WDataSet > WDataSet::clone( boost::shared_ptr< WValueSetBase >, boost::shared_ptr< WGrid > ) const +{ + return boost::shared_ptr< WDataSet >(); +} diff --git a/src/dataHandler/WDataSet.h b/src/dataHandler/WDataSet.h index c74a3c7a121db8396812ab9036466b6d75987645..e974df82ce3377a729fb595b1351ee8634354fb4 100644 --- a/src/dataHandler/WDataSet.h +++ b/src/dataHandler/WDataSet.h @@ -149,6 +149,15 @@ public: */ boost::shared_ptr< WProperties > getInformationProperties() const; + /** + * Returns a new dataset with the given valueset and grid that is of the same type as this dataset. + * + * \param vs The valueset. + * \param grid The grid. + * \return The new dataset. + */ + virtual boost::shared_ptr< WDataSet > clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const; + protected: /** diff --git a/src/dataHandler/WDataSetDTI.cpp b/src/dataHandler/WDataSetDTI.cpp index 841f5869f5755b7e60cd5da4e59601bbd4b7a744..e020e62de2af3c0380762daea4d495aef5e4c15c 100644 --- a/src/dataHandler/WDataSetDTI.cpp +++ b/src/dataHandler/WDataSetDTI.cpp @@ -63,3 +63,9 @@ wmath::WTensorSym< 2, 3, float > WDataSetDTI::getTensor( size_t index ) const WAssert( values, "The value set of a WDataSetDTI must be a WValueSet< float >, nothing else!" ); return wmath::WTensorSym< 2, 3, float >( values->getWValue( index ) ); } + +boost::shared_ptr< WDataSet > WDataSetDTI::clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const +{ + return boost::shared_ptr< WDataSet >( new WDataSetDTI( vs, grid ) ); +} + diff --git a/src/dataHandler/WDataSetDTI.h b/src/dataHandler/WDataSetDTI.h index e4af720e4984ec0374ec836c7444cb9341750672..ddf0c9b6ffccb355a15fe0a02fae84d8130a233c 100644 --- a/src/dataHandler/WDataSetDTI.h +++ b/src/dataHandler/WDataSetDTI.h @@ -89,6 +89,15 @@ public: */ wmath::WTensorSym< 2, 3, float > getTensor( size_t index ) const; + /** + * Returns a new dataset with the given valueset and grid that is of the same type as this dataset. + * + * \param vs The valueset. + * \param grid The grid. + * \return The new dataset. + */ + virtual boost::shared_ptr< WDataSet > clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const; + protected: /** * The prototype as singleton. diff --git a/src/dataHandler/WDataSetScalar.cpp b/src/dataHandler/WDataSetScalar.cpp index 41d59cfb83bbc1042bc4b5395fdce1c624c6742c..1efc90eff980b1d1a4efd2dd99c18c910821f191 100644 --- a/src/dataHandler/WDataSetScalar.cpp +++ b/src/dataHandler/WDataSetScalar.cpp @@ -167,3 +167,7 @@ boost::shared_ptr< const WValueSetHistogram > WDataSetScalar::getHistogram( size return m_histograms[ buckets ]; } +boost::shared_ptr< WDataSet > WDataSetScalar::clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const +{ + return boost::shared_ptr< WDataSet >( new WDataSetScalar( vs, grid ) ); +} diff --git a/src/dataHandler/WDataSetScalar.h b/src/dataHandler/WDataSetScalar.h index 34eb8fd6af931129cdb46a063701f0e4814b7c63..f65af4d165d3e07b7e27643d6aa32690bb81f491 100644 --- a/src/dataHandler/WDataSetScalar.h +++ b/src/dataHandler/WDataSetScalar.h @@ -149,6 +149,15 @@ public: */ static boost::shared_ptr< WPrototyped > getPrototype(); + /** + * Returns a new dataset with the given valueset and grid that is of the same type as this dataset. + * + * \param vs The valueset. + * \param grid The grid. + * \return The new dataset. + */ + virtual boost::shared_ptr< WDataSet > clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const; + protected: /** diff --git a/src/dataHandler/WDataSetSingle.cpp b/src/dataHandler/WDataSetSingle.cpp index bee2f7cb9777b5987d5a12c9c3ab70f83ea707ce..ec41f3cf6fca32c4c761463bec7b4a747a0a56c4 100644 --- a/src/dataHandler/WDataSetSingle.cpp +++ b/src/dataHandler/WDataSetSingle.cpp @@ -169,3 +169,8 @@ double WDataSetSingle::getValueAt( size_t id ) const return 0.0; // should not be reached. Just there to quiet compiler. } + +boost::shared_ptr< WDataSet > WDataSetSingle::clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const +{ + return boost::shared_ptr< WDataSet >( new WDataSetSingle( vs, grid ) ); +} diff --git a/src/dataHandler/WDataSetSingle.h b/src/dataHandler/WDataSetSingle.h index 18c7cab4a528b0cebe38147701498a21564faf89..f4b7840f73804383c62faa643137928f71de450a 100644 --- a/src/dataHandler/WDataSetSingle.h +++ b/src/dataHandler/WDataSetSingle.h @@ -176,6 +176,15 @@ public: */ static boost::shared_ptr< WPrototyped > getPrototype(); + /** + * Returns a new dataset with the given valueset and grid that is of the same type as this dataset. + * + * \param vs The valueset. + * \param grid The grid. + * \return The new dataset. + */ + virtual boost::shared_ptr< WDataSet > clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const; + protected: /** diff --git a/src/dataHandler/WDataSetSphericalHarmonics.cpp b/src/dataHandler/WDataSetSphericalHarmonics.cpp index c98e88b969a6925d06cb6674a0f52ca453d0aa28..3babb926814423c9b5fcc5c79c0cea6714c90666 100644 --- a/src/dataHandler/WDataSetSphericalHarmonics.cpp +++ b/src/dataHandler/WDataSetSphericalHarmonics.cpp @@ -150,3 +150,8 @@ bool WDataSetSphericalHarmonics::isTexture() const { return false; } + +boost::shared_ptr< WDataSet > WDataSetSphericalHarmonics::clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const +{ + return boost::shared_ptr< WDataSet >( new WDataSetSphericalHarmonics( vs, grid ) ); +} diff --git a/src/dataHandler/WDataSetSphericalHarmonics.h b/src/dataHandler/WDataSetSphericalHarmonics.h index 7c3c5672318012ba7175874090638c828aaec3f4..14787298346b740e78230e0d3b86a36420fe52d2 100644 --- a/src/dataHandler/WDataSetSphericalHarmonics.h +++ b/src/dataHandler/WDataSetSphericalHarmonics.h @@ -137,6 +137,15 @@ public: */ virtual bool isTexture() const; + /** + * Returns a new dataset with the given valueset and grid that is of the same type as this dataset. + * + * \param vs The valueset. + * \param grid The grid. + * \return The new dataset. + */ + virtual boost::shared_ptr< WDataSet > clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const; + protected: /** diff --git a/src/dataHandler/WDataSetTimeSeries.h b/src/dataHandler/WDataSetTimeSeries.h index 7a6489716d2f3ef06b211cfc5c26e2f616a5f5a9..de45dd02ac93224a44f1ed29d0a09713dbed705d 100644 --- a/src/dataHandler/WDataSetTimeSeries.h +++ b/src/dataHandler/WDataSetTimeSeries.h @@ -46,6 +46,7 @@ class WDataSetTimeSeriesTest; * A dataset that stores a time series. * * \note Only works for scalar datasets at the moment! + * \note this is only a temporary solution */ class OWDATAHANDLER_EXPORT WDataSetTimeSeries : public WDataSet { diff --git a/src/dataHandler/WDataSetVector.cpp b/src/dataHandler/WDataSetVector.cpp index 858175ea4feb642c07cd079dac886a4b6048a892..bff89dc2ee285dbe90031443a9f54bf60b592d2b 100644 --- a/src/dataHandler/WDataSetVector.cpp +++ b/src/dataHandler/WDataSetVector.cpp @@ -166,3 +166,8 @@ bool WDataSetVector::isTexture() const { return true; } + +boost::shared_ptr< WDataSet > WDataSetVector::clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const +{ + return boost::shared_ptr< WDataSet >( new WDataSetVector( vs, grid ) ); +} diff --git a/src/dataHandler/WDataSetVector.h b/src/dataHandler/WDataSetVector.h index 1ca759b27c7d20ed2509bc069894f6cd7cd3d3f9..e949f7dec07dfbb2ce359bd946ae9c08253418cf 100644 --- a/src/dataHandler/WDataSetVector.h +++ b/src/dataHandler/WDataSetVector.h @@ -124,6 +124,15 @@ public: */ boost::shared_ptr< WDataSetVector > isVectorDataSet(); + /** + * Returns a new dataset with the given valueset and grid that is of the same type as this dataset. + * + * \param vs The valueset. + * \param grid The grid. + * \return The new dataset. + */ + virtual boost::shared_ptr< WDataSet > clone( boost::shared_ptr< WValueSetBase > vs, boost::shared_ptr< WGrid > grid ) const; + protected: /** diff --git a/src/dataHandler/io/WReaderNIfTI.cpp b/src/dataHandler/io/WReaderNIfTI.cpp index 907d0c133249f11450efa9f1801e6409aeb3d83d..f40f40bb6ccc2ac255cb70d627a8df7f37be8264 100644 --- a/src/dataHandler/io/WReaderNIfTI.cpp +++ b/src/dataHandler/io/WReaderNIfTI.cpp @@ -51,7 +51,9 @@ #include "WReaderNIfTI.h" WReaderNIfTI::WReaderNIfTI( std::string fileName ) - : WReader( fileName ) + : WReader( fileName ), + m_sform( 4, 4 ), + m_qform( 4, 4 ) { } @@ -179,8 +181,10 @@ boost::shared_ptr< WDataSet > WReaderNIfTI::load( DataSetType dataSetType ) throw e; } + m_sform = convertMatrix( header->sto_xyz ); + m_qform = convertMatrix( header->qto_xyz ); newGrid = boost::shared_ptr< WGridRegular3D >( - new WGridRegular3D( columns, rows, frames, WGridTransformOrtho( convertMatrix( header->sto_xyz ) ) ) ); + new WGridRegular3D( columns, rows, frames, WGridTransformOrtho( getStandardTransform() ) ) ); boost::shared_ptr< WDataSet > newDataSet; // known description @@ -402,3 +406,18 @@ boost::shared_ptr< WDataSet > WReaderNIfTI::load( DataSetType dataSetType ) return newDataSet; } + +wmath::WMatrix< double > WReaderNIfTI::getStandardTransform() const +{ + return wmath::WMatrix< double >( 4, 4 ).makeIdentity(); +} + +wmath::WMatrix< double > WReaderNIfTI::getSFormTransform() const +{ + return m_sform; +} + +wmath::WMatrix< double > WReaderNIfTI::getQFormTransform() const +{ + return m_qform; +} diff --git a/src/dataHandler/io/WReaderNIfTI.h b/src/dataHandler/io/WReaderNIfTI.h index ae6e7824524ec31221d361ebdf1dee2c3c77b5f4..7527f130208393608b433277375982aa47eb5a48 100644 --- a/src/dataHandler/io/WReaderNIfTI.h +++ b/src/dataHandler/io/WReaderNIfTI.h @@ -64,6 +64,27 @@ public: */ virtual boost::shared_ptr< WDataSet > load( DataSetType dataSetType = W_DATASET_NONE ); + /** + * Returns a standard transformation. + * + * \return A Wmatrix that represents the dataset's transformation. + */ + wmath::WMatrix< double > getStandardTransform() const; + + /** + * Returns the SForm transformation stored in the nifti file's header. + * + * \return A Wmatrix that represents the dataset's transformation. + */ + wmath::WMatrix< double > getSFormTransform() const; + + /** + * Returns the QForm transformation stored in the nifti file's header. + * + * \return A Wmatrix that represents the dataset's transformation. + */ + wmath::WMatrix< double > getQFormTransform() const; + protected: private: /** @@ -81,6 +102,12 @@ private: * \param in this matrix will be converted. */ wmath::WMatrix< double > convertMatrix( const mat44& in ); + + //! the sform transform stored in the file header + wmath::WMatrix< double > m_sform; + + //! the qform transform stored in the file header + wmath::WMatrix< double > m_qform; }; #endif // WREADERNIFTI_H diff --git a/src/kernel/modules/data/WMData.cpp b/src/kernel/modules/data/WMData.cpp index 912d5fbcc59177bd96e0728f0c242982f467ee50..9250ef15d97d9ae314624b5131fcd8f639f873f2 100644 --- a/src/kernel/modules/data/WMData.cpp +++ b/src/kernel/modules/data/WMData.cpp @@ -33,6 +33,7 @@ #include "../../../dataHandler/WDataSetScalar.h" #include "../../../dataHandler/WDataSetTimeSeries.h" #include "../../../dataHandler/WDataSetVector.h" +#include "../../../dataHandler/WDataSetRawHARDI.h" #include "../../../dataHandler/WSubject.h" #include "../../../dataHandler/WDataHandler.h" #include "../../../dataHandler/WDataTexture3D.h" @@ -54,7 +55,10 @@ WMData::WMData(): WModule(), m_fileNameSet( false ), - m_isTexture() + m_isTexture(), + m_transformNoMatrix( 4, 4 ), + m_transformSForm( 4, 4 ), + m_transformQForm( 4, 4 ) { // initialize members } @@ -124,88 +128,26 @@ void WMData::connectors() void WMData::properties() { - // properties + m_propCondition = boost::shared_ptr< WCondition >( new WCondition() ); + // properties m_dataName = m_infoProperties->addProperty( "Filename", "The filename of the dataset.", std::string( "" ) ); m_dataType = m_infoProperties->addProperty( "Data type", "The type of the the single data values.", std::string( "" ) ); - // use this callback for the other properties - WPropertyBase::PropertyChangeNotifierType propertyCallback = boost::bind( &WMData::propertyChanged, this, _1 ); - - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - m_groupTex = m_properties->addPropertyGroup( "Texture Properties ", "Properties only related to the texture representation." ); - - // several other properties - m_interpolation = m_groupTex->addProperty( "Interpolation", - "If active, the boundaries of single voxels" - " will not be visible in colormaps. The transition between" - " them will be smooth by using interpolation then.", - true, - propertyCallback ); - m_threshold = m_groupTex->addProperty( "Threshold", "Values below this threshold will not be " - "shown in colormaps.", 0.0, propertyCallback ); - m_threshold->setMax( 1.0 ); - m_threshold->setMin( 0.0 ); - - m_opacity = m_groupTex->addProperty( "Opacity %", "The opacity of this data in colormaps combining" - " values from several data sets.", 100, propertyCallback ); - m_opacity->setMax( 100 ); - m_opacity->setMin( 0 ); - - m_colorMapSelectionsList = boost::shared_ptr< WItemSelection >( new WItemSelection() ); - m_colorMapSelectionsList->addItem( "Grayscale", "" ); - m_colorMapSelectionsList->addItem( "Rainbow", "" ); - m_colorMapSelectionsList->addItem( "Hot iron", "" ); - m_colorMapSelectionsList->addItem( "Negative to positive", "" ); - m_colorMapSelectionsList->addItem( "Atlas", "" ); - m_colorMapSelectionsList->addItem( "Blue-Green-Purple", "" ); - m_colorMapSelectionsList->addItem( "Vector", "" ); - - m_colorMapSelection = m_groupTex->addProperty( "Colormap", "Colormap type.", m_colorMapSelectionsList->getSelectorFirst(), propertyCallback ); - WPropertyHelper::PC_SELECTONLYONE::addTo( m_colorMapSelection ); - m_matrixSelectionsList = boost::shared_ptr< WItemSelection >( new WItemSelection() ); m_matrixSelectionsList->addItem( "No matrix", "" ); - m_matrixSelectionsList->addItem( "qform", "" ); m_matrixSelectionsList->addItem( "sform", "" ); + m_matrixSelectionsList->addItem( "qform", "" ); m_matrixSelection = m_properties->addProperty( "Transformation matrix", "matrix", - m_matrixSelectionsList->getSelectorFirst(), propertyCallback ); + m_matrixSelectionsList->getSelectorFirst(), m_propCondition ); WPropertyHelper::PC_SELECTONLYONE::addTo( m_matrixSelection ); - // } } void WMData::propertyChanged( boost::shared_ptr< WPropertyBase > property ) { if( m_isTexture ) { - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - if ( property == m_threshold ) - { - m_dataSet->getTexture()->setThreshold( m_threshold->get() ); - } - else if ( property == m_opacity ) - { - m_dataSet->getTexture()->setOpacity( m_opacity->get() ); - } - else if ( property == m_interpolation ) - { - m_dataSet->getTexture()->setInterpolation( m_interpolation->get() ); - } - else if ( property == m_colorMapSelection ) - { - m_dataSet->getTexture()->setSelectedColormap( m_colorMapSelection->get( true ).getItemIndexOfSelected( 0 ) ); - } - else if ( property == m_matrixSelection ) - { - boost::shared_ptr< WGridRegular3D > grid = m_dataSet->getTexture()->getGrid(); - - //grid->setActiveMatrix( m_matrixSelection->get( true ).getItemIndexOfSelected( 0 ) ); - - WDataHandler::getDefaultSubject()->getChangeCondition()->notify(); - m_output->triggerUpdate(); - } - // } if ( property == m_active ) { // forward to texture @@ -249,6 +191,9 @@ void WMData::notifyStop() void WMData::moduleMain() { + m_moduleState.setResetable( true, true ); + m_moduleState.add( m_propCondition ); + WAssert( m_fileNameSet, "No filename specified." ); using wiotools::getSuffix; @@ -266,17 +211,6 @@ void WMData::moduleMain() // load it now std::string suffix = getSuffix( fileName ); - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - if( suffix == ".fib" - || suffix == ".cnt" - || suffix == ".asc" - || suffix == ".edf" ) - { - // hide other properties since they make no sense fo these data set types. - m_groupTex->setHidden(); - } - // } - if( suffix == ".nii" || ( suffix == ".gz" && ::nifti_compiled_with_zlib() ) ) { @@ -290,6 +224,10 @@ void WMData::moduleMain() WReaderNIfTI niiLoader( fileName ); m_dataSet = niiLoader.load(); + m_transformNoMatrix = niiLoader.getStandardTransform(); + m_transformSForm = niiLoader.getSFormTransform(); + m_transformQForm = niiLoader.getQFormTransform(); + m_isTexture = m_dataSet->isTexture(); boost::shared_ptr< WDataSetSingle > dss = boost::shared_dynamic_cast< WDataSetSingle >( m_dataSet ); @@ -301,9 +239,6 @@ void WMData::moduleMain() case W_DT_UNSIGNED_CHAR: case W_DT_INT16: case W_DT_SIGNED_INT: - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - m_colorMapSelection->set( m_colorMapSelectionsList->getSelector( 0 ) ); - // } m_dataSet->getTexture2()->colormap()->set( m_dataSet->getTexture2()->colormap()->get().newSelector( WItemSelector::IndexList( 1, 0 ) ) ); @@ -312,10 +247,6 @@ void WMData::moduleMain() case W_DT_DOUBLE: if( boost::shared_dynamic_cast< WDataSetVector >( m_dataSet ) ) { - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - m_colorMapSelection->set( m_colorMapSelectionsList->getSelector( 6 ) ); - m_interpolation->set( false ); - // } m_dataSet->getTexture2()->colormap()->set( m_dataSet->getTexture2()->colormap()->get().newSelector( WItemSelector::IndexList( 1, 6 ) ) ); @@ -323,9 +254,6 @@ void WMData::moduleMain() } else { - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - m_colorMapSelection->set( m_colorMapSelectionsList->getSelector( 5 ) ); - // } m_dataSet->getTexture2()->colormap()->set( m_dataSet->getTexture2()->colormap()->get().newSelector( WItemSelector::IndexList( 1, 5 ) ) ); @@ -335,15 +263,6 @@ void WMData::moduleMain() WAssert( false, "Unknow data type in Data module" ); } } - - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - if( boost::shared_dynamic_cast< WDataSetScalar >( m_dataSet ) ) - { - m_threshold->setMin( boost::shared_dynamic_cast< WDataSetScalar >( m_dataSet )->getMin() ); - m_threshold->setMax( boost::shared_dynamic_cast< WDataSetScalar >( m_dataSet )->getMax() ); - m_threshold->set( boost::shared_dynamic_cast< WDataSetScalar >( m_dataSet )->getMin() ); - } - // } } else if( suffix == ".edf" ) { @@ -394,22 +313,69 @@ void WMData::moduleMain() // I am interested in the active property ( manually subscribe signal ) m_active->getCondition()->subscribeSignal( boost::bind( &WMData::propertyChanged, this, m_active ) ); - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - // register at datahandler - WDataHandler::registerDataSet( m_dataSet ); // this will get obsolete soon - // } - // notify m_output->updateData( m_dataSet ); ready(); - // go to idle mode - waitForStop(); // WThreadedRunner offers this for us. It uses boost::condition to avoid wasting CPU cycles with while loops. + while( !m_shutdownFlag() ) + { + m_moduleState.wait(); + if( m_shutdownFlag() ) + { + break; + } + + // change transform matrix + if( m_matrixSelection->changed() ) + { + // a new grid + boost::shared_ptr< WGrid > newGrid; + boost::shared_ptr< WDataSetSingle > ds = boost::shared_dynamic_cast< WDataSetSingle >( m_dataSet ); + boost::shared_ptr< WGridRegular3D > oldGrid = boost::shared_dynamic_cast< WGridRegular3D >( ds->getGrid() ); + + switch( m_matrixSelection->get( true ).getItemIndexOfSelected( 0 ) ) + { + case 0: + newGrid = boost::shared_ptr< WGrid >( new WGridRegular3D( oldGrid->getNbCoordsX(), oldGrid->getNbCoordsY(), oldGrid->getNbCoordsZ(), + WGridTransformOrtho( m_transformNoMatrix ) ) ); + break; + case 1: + newGrid = boost::shared_ptr< WGrid >( new WGridRegular3D( oldGrid->getNbCoordsX(), oldGrid->getNbCoordsY(), oldGrid->getNbCoordsZ(), + WGridTransformOrtho( m_transformSForm ) ) ); + break; + case 2: + newGrid = boost::shared_ptr< WGrid >( new WGridRegular3D( oldGrid->getNbCoordsX(), oldGrid->getNbCoordsY(), oldGrid->getNbCoordsZ(), + WGridTransformOrtho( m_transformQForm ) ) ); + break; + } + + if( boost::shared_dynamic_cast< WDataSetRawHARDI >( m_dataSet ) ) + { + typedef std::vector< wmath::WVector3D > OrientationType; + // hardi datasets are a morre difficult case because of additional parameters + boost::shared_ptr< WDataSetRawHARDI > hardi = boost::shared_dynamic_cast< WDataSetRawHARDI >( m_dataSet ); + m_dataSet = boost::shared_ptr< WDataSet >( + new WDataSetRawHARDI( hardi->getValueSet(), newGrid, + boost::shared_ptr< OrientationType >( new OrientationType( hardi->getOrientations() ) ), + hardi->getDiffusionBValue() ) ); + // TODO( reichenbach ): remove copying orientations + } + else + { + // this creates a dataset of the same type as m_dataSet without explicit knowledge of the correct type + m_dataSet = m_dataSet->clone( ds->getValueSet(), newGrid ); + } + + // the clone() may have returned a zero-pointer, only update if it hasn't + // this may happen if the clone() operation has not been implemented in the derived dataset class + if( m_dataSet ) + { + m_output->updateData( m_dataSet ); + } + } + } // remove dataset from datahandler - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - WDataHandler::deregisterDataSet( m_dataSet ); - // } if ( m_dataSet->isTexture() ) { m_properties->removeProperty( m_dataSet->getTexture2()->getProperties() ); diff --git a/src/kernel/modules/data/WMData.h b/src/kernel/modules/data/WMData.h index c56c5da55b14be82fef3eb896d27eda018a90caa..47ee9c34e5a61e7f692c0dad7d044e6877e32144 100644 --- a/src/kernel/modules/data/WMData.h +++ b/src/kernel/modules/data/WMData.h @@ -159,6 +159,9 @@ protected: */ virtual void notifyStop(); + //! a condition for property changes + boost::shared_ptr< WCondition > m_propCondition; + /** * The filename of the dataset to load. */ @@ -179,28 +182,6 @@ protected: */ WPropString m_dataType; - // { TODO(ebaum): this is deprecated and will be replaced by WGEColormapping - /** - * \deprecated Be aware that this will be replaced by WGEColormapping - * Grouping the texture display properties - */ - WPropGroup m_groupTex; - - /** - * Interpolation? - */ - WPropBool m_interpolation; - - /** - * A list of color map selection types - */ - boost::shared_ptr< WItemSelection > m_colorMapSelectionsList; - - /** - * Selection property for color map - */ - WPropSelection m_colorMapSelection; - /** * A list of color map selection types */ @@ -211,18 +192,6 @@ protected: */ WPropSelection m_matrixSelection; - - /** - * Threshold value for this data. - */ - WPropDouble m_threshold; - - /** - * Opacity value for this data. - */ - WPropInt m_opacity; - // } - bool m_isTexture; //!< Indicates whether the loaded dataSet will be available as texture. /** @@ -232,6 +201,16 @@ protected: */ void propertyChanged( boost::shared_ptr< WPropertyBase > property ); + // in case of a nifti file, there may be several transforms specified in the file + //! a standard transform (should be an identity transform) + wmath::WMatrix< double > m_transformNoMatrix; + + //! a standard transform (should be an identity transform) + wmath::WMatrix< double > m_transformSForm; + + //! a standard transform (should be an identity transform) + wmath::WMatrix< double > m_transformQForm; + private: /**