~ubuntu-branches/ubuntu/raring/voxbo/raring

« back to all changes in this revision

Viewing changes to stand_alone/timeseries.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Hanke
  • Date: 2010-06-06 11:33:11 UTC
  • Revision ID: james.westby@ubuntu.com-20100606113311-v3c13imdkkd5n7ae
Tags: upstream-1.8.5~svn1172
ImportĀ upstreamĀ versionĀ 1.8.5~svn1172

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
// timeseries.h
 
3
// Copyright (c) 1998-2010 by The VoxBo Development Team
 
4
// 
 
5
// This file is part of VoxBo
 
6
// 
 
7
// VoxBo is free software: you can redistribute it and/or modify it
 
8
// under the terms of the GNU General Public License as published by
 
9
// the Free Software Foundation, either version 3 of the License, or
 
10
// (at your option) any later version.
 
11
// 
 
12
// VoxBo is distributed in the hope that it will be useful, but
 
13
// WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
// General Public License for more details.
 
16
// 
 
17
// You should have received a copy of the GNU General Public License
 
18
// along with VoxBo.  If not, see <http://www.gnu.org/licenses/>.
 
19
// 
 
20
// For general information on VoxBo, including the latest complete
 
21
// source code and binary distributions, manual, and associated files,
 
22
// see the VoxBo home page at: http://www.voxbo.org/
 
23
// 
 
24
// original version written by Kosh Banerjee
 
25
 
 
26
/*********************************************************************
 
27
* Include guard.                                                     *
 
28
*********************************************************************/
 
29
#ifndef TIMESERIES_H
 
30
#define TIMESERIES_H
 
31
 
 
32
/*********************************************************************
 
33
* Required include files.                                            *
 
34
*********************************************************************/
 
35
#include <iostream>
 
36
#include <cstring>
 
37
#include <cstdio>
 
38
#include <string>
 
39
#include "utils.h"
 
40
#include "vb_common_incs.h"
 
41
#include "genericexcep.h"
 
42
 
 
43
class TimeSeries
 
44
{
 
45
  private:
 
46
 
 
47
/*********************************************************************
 
48
* DATA MEMBERS:                                                      *
 
49
* currentSeries - keeps track of the current time series. The range  *
 
50
*                 for currentSeries is [0, dimx * dimy * dimz - 1].  *
 
51
* dimT - the number of time series.                                  *
 
52
* dimX - the number of voxels in the X direction.                    *
 
53
* dimY - the number of voxels in the Y direction.                    *
 
54
* dimZ - the number of voxels in the Z direction.                    *
 
55
* indexX - used to hold the X spatial index corresponding to a voxel *
 
56
*          position.                                                 *
 
57
* indexY - used to hold the Y spatial index corresponding to a voxel *
 
58
*          position.                                                 *
 
59
* indexZ - used to hold the Z spatial index corresponding to a voxel *
 
60
*          position.                                                 *
 
61
* theTes - a Tes object whose time series is to be read.             *
 
62
* tesFileName - the 4D data file name.                               *
 
63
*********************************************************************/
 
64
    unsigned long currentSeries;
 
65
    unsigned int dimX, dimY, dimZ, dimT;
 
66
    unsigned int indexX, indexY, indexZ;
 
67
    Tes theTes;
 
68
    string tesFileName;
 
69
 
 
70
/*********************************************************************
 
71
* Private methods.                                                   *
 
72
*********************************************************************/
 
73
    void init(const string& tesFile) throw (GenericExcep);
 
74
    void init(const Tes& theTes) throw (GenericExcep);
 
75
 
 
76
  public:
 
77
 
 
78
/*********************************************************************
 
79
* Constructors:                                                      *
 
80
*********************************************************************/
 
81
    TimeSeries();
 
82
    TimeSeries(const string& tesFileName);
 
83
    TimeSeries(const char *tesFileName);
 
84
    TimeSeries(const Tes& theTes);
 
85
    TimeSeries(const TimeSeries& T); // Copy constructor.
 
86
 
 
87
/*********************************************************************
 
88
* Destructor:                                                        *
 
89
*********************************************************************/
 
90
    ~TimeSeries();
 
91
 
 
92
/*********************************************************************
 
93
* Accessor methods.                                                  *
 
94
*********************************************************************/
 
95
    unsigned int getDimX() const;
 
96
    unsigned int getDimY() const;
 
97
    unsigned int getDimZ() const;
 
98
    unsigned int getDimT() const;
 
99
 
 
100
    unsigned int getIndexX() const;
 
101
    unsigned int getIndexY() const;
 
102
    unsigned int getIndexZ() const;
 
103
    unsigned long getCurrentSeries() const;
 
104
 
 
105
    Tes *getTesFile() ;
 
106
 
 
107
/*********************************************************************
 
108
* Public methods.                                                    *
 
109
*********************************************************************/
 
110
    int getCurrentTimeSeries(double *tSeries);
 
111
    void reset();
 
112
    void zeroOut(const unsigned int x, const unsigned int y, const unsigned int z) throw ();
 
113
    void zeroOut(const unsigned long index) throw ();
 
114
    void toString() const;
 
115
    unsigned int getTimeSeriesIndex() const;
 
116
    int getTimeSeries(double *tSeries, const unsigned int i) throw ();
 
117
 
 
118
    void getTimeSeries(double *tSeries, const unsigned int xIndex,
 
119
    unsigned int yIndex, const unsigned int zIndex) throw ();
 
120
    int getSameSeries(double *tSeries) throw();
 
121
 
 
122
}; // class TimeSeries
 
123
 
 
124
#endif // TIMESERIES_H