WLoaderNIfTI.h 2.25 KB
Newer Older
1 2
//---------------------------------------------------------------------------
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5 6
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------

#ifndef WLOADERNIFTI_H
#define WLOADERNIFTI_H

28
#include <string>
29
#include <vector>
30 31
#include <boost/shared_ptr.hpp>

32
#include "../WLoader.h"
33
#include "../../math/WMatrix.hpp"
34

35
#include "nifti/nifti1_io.h"
36

37 38
class WDataHandler;

39 40
/**
 * Loader for the NIfTI file format. For NIfTI just see http://nifti.nimh.nih.gov/.
41
 * \ingroup dataHandler
42 43 44 45
 */
class WLoaderNIfTI : public WLoader
{
public:
46 47 48 49 50 51 52
    /**
     * Constructs a loader to be executed in its own thread and ets the data needed
     * for the loader when executed in its own thread.
     */
    WLoaderNIfTI( std::string fileName, boost::shared_ptr< WDataHandler > dataHandler );

    /**
53 54 55
     * Loads the dataset.
     * 
     * \return the dataset loaded.
56
     */
57
    virtual boost::shared_ptr< WDataSet > load();
58

59 60
protected:
private:
61
    /**
Alexander Wiebel's avatar
Alexander Wiebel committed
62 63
     * This function allows to copy the data given as a T*
     * by niftilibio into a std::vector< T >
64
     */
65
    template < typename T > std::vector< T > copyArray( const T* dataArray, const size_t countVoxels, const size_t vDim );
66 67 68 69 70 71

    /**
     * This function converts a 4x4 matrix from the NIfTI libs into the format
     * used by OpenWalnut.
     */
    wmath::WMatrix< double > convertMatrix( const mat44& in );
72 73 74
};

#endif  // WLOADERNIFTI_H