Commit d494805a authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[MERGE]

parents 29977b64 54159e7c
...@@ -119,3 +119,7 @@ boost::shared_ptr< WProperties > WDataSet::getInformationProperties() const ...@@ -119,3 +119,7 @@ boost::shared_ptr< WProperties > WDataSet::getInformationProperties() const
return m_infoProperties; return m_infoProperties;
} }
boost::shared_ptr< WDataSet > WDataSet::clone( boost::shared_ptr< WValueSetBase >, boost::shared_ptr< WGrid > ) const
{
return boost::shared_ptr< WDataSet >();
}
...@@ -149,6 +149,15 @@ public: ...@@ -149,6 +149,15 @@ public:
*/ */
boost::shared_ptr< WProperties > getInformationProperties() const; 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: protected:
/** /**
......
...@@ -63,3 +63,9 @@ wmath::WTensorSym< 2, 3, float > WDataSetDTI::getTensor( size_t index ) const ...@@ -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!" ); WAssert( values, "The value set of a WDataSetDTI must be a WValueSet< float >, nothing else!" );
return wmath::WTensorSym< 2, 3, float >( values->getWValue( index ) ); 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 ) );
}
...@@ -89,6 +89,15 @@ public: ...@@ -89,6 +89,15 @@ public:
*/ */
wmath::WTensorSym< 2, 3, float > getTensor( size_t index ) const; 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: protected:
/** /**
* The prototype as singleton. * The prototype as singleton.
......
...@@ -167,3 +167,7 @@ boost::shared_ptr< const WValueSetHistogram > WDataSetScalar::getHistogram( size ...@@ -167,3 +167,7 @@ boost::shared_ptr< const WValueSetHistogram > WDataSetScalar::getHistogram( size
return m_histograms[ buckets ]; 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 ) );
}
...@@ -149,6 +149,15 @@ public: ...@@ -149,6 +149,15 @@ public:
*/ */
static boost::shared_ptr< WPrototyped > getPrototype(); 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: protected:
/** /**
......
...@@ -169,3 +169,8 @@ double WDataSetSingle::getValueAt( size_t id ) const ...@@ -169,3 +169,8 @@ double WDataSetSingle::getValueAt( size_t id ) const
return 0.0; // should not be reached. Just there to quiet compiler. 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 ) );
}
...@@ -176,6 +176,15 @@ public: ...@@ -176,6 +176,15 @@ public:
*/ */
static boost::shared_ptr< WPrototyped > getPrototype(); 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: protected:
/** /**
......
...@@ -150,3 +150,8 @@ bool WDataSetSphericalHarmonics::isTexture() const ...@@ -150,3 +150,8 @@ bool WDataSetSphericalHarmonics::isTexture() const
{ {
return false; 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 ) );
}
...@@ -137,6 +137,15 @@ public: ...@@ -137,6 +137,15 @@ public:
*/ */
virtual bool isTexture() const; 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: protected:
/** /**
......
...@@ -46,6 +46,7 @@ class WDataSetTimeSeriesTest; ...@@ -46,6 +46,7 @@ class WDataSetTimeSeriesTest;
* A dataset that stores a time series. * A dataset that stores a time series.
* *
* \note Only works for scalar datasets at the moment! * \note Only works for scalar datasets at the moment!
* \note this is only a temporary solution
*/ */
class OWDATAHANDLER_EXPORT WDataSetTimeSeries : public WDataSet class OWDATAHANDLER_EXPORT WDataSetTimeSeries : public WDataSet
{ {
......
...@@ -166,3 +166,8 @@ bool WDataSetVector::isTexture() const ...@@ -166,3 +166,8 @@ bool WDataSetVector::isTexture() const
{ {
return true; 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 ) );
}
...@@ -124,6 +124,15 @@ public: ...@@ -124,6 +124,15 @@ public:
*/ */
boost::shared_ptr< WDataSetVector > isVectorDataSet(); 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: protected:
/** /**
......
...@@ -51,7 +51,9 @@ ...@@ -51,7 +51,9 @@
#include "WReaderNIfTI.h" #include "WReaderNIfTI.h"
WReaderNIfTI::WReaderNIfTI( std::string fileName ) 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 ) ...@@ -179,8 +181,10 @@ boost::shared_ptr< WDataSet > WReaderNIfTI::load( DataSetType dataSetType )
throw e; throw e;
} }
m_sform = convertMatrix( header->sto_xyz );
m_qform = convertMatrix( header->qto_xyz );
newGrid = boost::shared_ptr< WGridRegular3D >( 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; boost::shared_ptr< WDataSet > newDataSet;
// known description // known description
...@@ -402,3 +406,18 @@ boost::shared_ptr< WDataSet > WReaderNIfTI::load( DataSetType dataSetType ) ...@@ -402,3 +406,18 @@ boost::shared_ptr< WDataSet > WReaderNIfTI::load( DataSetType dataSetType )
return newDataSet; 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;
}
...@@ -64,6 +64,27 @@ public: ...@@ -64,6 +64,27 @@ public:
*/ */
virtual boost::shared_ptr< WDataSet > load( DataSetType dataSetType = W_DATASET_NONE ); 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: protected:
private: private:
/** /**
...@@ -81,6 +102,12 @@ private: ...@@ -81,6 +102,12 @@ private:
* \param in this matrix will be converted. * \param in this matrix will be converted.
*/ */
wmath::WMatrix< double > convertMatrix( const mat44& in ); 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 #endif // WREADERNIFTI_H
This diff is collapsed.
...@@ -159,6 +159,9 @@ protected: ...@@ -159,6 +159,9 @@ protected:
*/ */
virtual void notifyStop(); virtual void notifyStop();
//! a condition for property changes
boost::shared_ptr< WCondition > m_propCondition;
/** /**
* The filename of the dataset to load. * The filename of the dataset to load.
*/ */
...@@ -179,28 +182,6 @@ protected: ...@@ -179,28 +182,6 @@ protected:
*/ */
WPropString m_dataType; 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 * A list of color map selection types
*/ */
...@@ -211,18 +192,6 @@ protected: ...@@ -211,18 +192,6 @@ protected:
*/ */
WPropSelection m_matrixSelection; 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. bool m_isTexture; //!< Indicates whether the loaded dataSet will be available as texture.
/** /**
...@@ -232,6 +201,16 @@ protected: ...@@ -232,6 +201,16 @@ protected:
*/ */
void propertyChanged( boost::shared_ptr< WPropertyBase > property ); 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: private:
/** /**
......
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