OpenWalnut
1.4.0
|
00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #include "WDataSetDTI.h" 00026 00027 // prototype instance as singleton 00028 boost::shared_ptr< WPrototyped > WDataSetDTI::m_prototype = boost::shared_ptr< WPrototyped >(); 00029 00030 00031 WDataSetDTI::WDataSetDTI( boost::shared_ptr< WValueSetBase > newValueSet, boost::shared_ptr< WGrid > newGrid ) 00032 : WDataSetSingle( newValueSet, newGrid ) 00033 { 00034 WAssert( newValueSet, "No value set given." ); 00035 WAssert( newGrid, "No grid given." ); 00036 WAssert( newValueSet->size() == newGrid->size(), "Number of values unequal number of positions in grid." ); 00037 WAssert( newValueSet->order() == 1, "The value set does not contain vectors." ); 00038 WAssert( newValueSet->dimension() == 6, "The size of the vetors does not match symmetric matrices: must be equal to 6." ); 00039 } 00040 00041 WDataSetDTI::~WDataSetDTI() 00042 { 00043 } 00044 00045 WDataSetSingle::SPtr WDataSetDTI::clone( boost::shared_ptr< WValueSetBase > newValueSet ) const 00046 { 00047 return WDataSetSingle::SPtr( new WDataSetDTI( newValueSet, getGrid() ) ); 00048 } 00049 00050 WDataSetSingle::SPtr WDataSetDTI::clone( boost::shared_ptr< WGrid > newGrid ) const 00051 { 00052 return WDataSetSingle::SPtr( new WDataSetDTI( getValueSet(), newGrid ) ); 00053 } 00054 00055 WDataSetSingle::SPtr WDataSetDTI::clone() const 00056 { 00057 return WDataSetSingle::SPtr( new WDataSetDTI( getValueSet(), getGrid() ) ); 00058 } 00059 00060 WTensorSym< 2, 3, float > WDataSetDTI::getTensor( size_t index ) const 00061 { 00062 boost::shared_ptr< WValueSet< float > > values = boost::dynamic_pointer_cast< WValueSet< float > >( m_valueSet ); 00063 WAssert( values, "The value set of a WDataSetDTI must be a WValueSet< float >, nothing else!" ); 00064 return WTensorSym< 2, 3, float >( values->getWValue( index ) ); 00065 } 00066