Evita  0.16
evDataset.h
Go to the documentation of this file.
1 /*
2  *
3  * EVITA: Efficient Visualization of Terascale Datasets
4  * Copyright (C) 2000-2016 Team Evita
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
19  * MA 02139, USA.
20  *
21  */
22 
23 
24 #ifndef __evDataset_h
25 #define __evDataset_h
26 
27 
28 #include "evDataObject.h"
29 #include "evROIList.h"
30 #include "evCodec.h"
31 #include "evProgressReporter.h"
32 
33 
34 class evDataset : public evDataObject
35 {
36  public:
37  evDataset(void);
38  virtual ~evDataset(void);
39 
40  virtual const evString GetClassName(void) const
41  {
42  return(evString("evDataset"));
43  }
44 
45  void Free(void);
46 
47  int Copy(const evDataset &dataset);
48 
49  int SetSize(const evAddress &address);
50  void SetGridType(const int grid_type);
51  void SetVectorDimension(const unsigned int num_components,
52  const unsigned int *vector_dimension);
53  void SetComponentName(const unsigned int component,
54  const evString component_name);
55 
56  int GetNumDimensions(void) const;
57  int GetSize(const int index) const;
58  evAddress GetSize(void) const;
59  unsigned int GetTotalSize(void) const;
60  int GetGridType(void) const;
61  // int HasExplicitGrid(void) const;
62  unsigned int GetNumComponents(void) const;
63  unsigned int GetVectorDimension(const unsigned int component) const;
64  const unsigned int *GetVectorDimension(void) const;
65  evString GetComponentName(const unsigned int component) const;
66 
67  int ReadHeader(evFile &infile, evString &compression_method);
68  int Read(const evString filename,
69  evProgressReporter *progress_reporter = NULL);
70  int WriteHeader(evFile &outfile, const evString &compression_method) const;
71  int Write(const evString filename,
72  evProgressReporter *progress_reporter = NULL);
73 
74  int SetCodec(const evString compression_method);
75  evCodec *GetCodec(void) const;
76 
77  evROIList *GetROIList(void);
78  const evROIList *GetROIList(void) const;
79 
80  int AllocateSingleROI(void);
81 
82  int Segment(const evSegmentationMap &segmentation_map,
83  const unsigned int tile_size,
84  evProgressReporter *progress_reporter = NULL);
85  int Composite(unsigned int component, evVectorField &field) const;
86 
87  double DistortionMSE(const unsigned int component,
88  const evDataset &dataset) const;
89 
90  virtual void PrintSelf(const int tabbing) const;
91 
92  protected:
93 
94  private:
95  unsigned int NumDimensions;
97  unsigned int TotalSize;
98 
99  int GridType;
100 
101  unsigned int NumComponents;
102  unsigned int *VectorDimension;
103  std::vector<evString> ComponentName;
104 
107 
108  void Initialize(void);
109 
110  int Encode(evBitBuffer &output_buffer,
111  evProgressReporter *progress_reporter = NULL);
112  int Decode(evBitBuffer &input_buffer,
113  evProgressReporter *progress_reporter = NULL);
114 
115 };
116 
117 
118 inline void evDataset::SetGridType(const int grid_type)
119 {
120  this->GridType = grid_type;
121 }
122 
123 
124 inline void evDataset::SetComponentName(const unsigned int component,
125  const evString component_name)
126 {
127  if (component >= this->NumComponents)
128  return;
129  this->ComponentName[component] = component_name;
130 }
131 
132 
133 inline int evDataset::GetGridType(void) const
134 {
135  return(this->GridType);
136 }
137 
138 
139 /*
140 inline int evDataset::HasExplicitGrid(void) const
141 {
142  return(evROI::HasExplicitGrid(this->GridType));
143 }
144 */
145 
146 
147 inline int evDataset::GetNumDimensions(void) const
148 {
149  return(this->NumDimensions);
150 }
151 
152 
153 inline int evDataset::GetSize(const int index) const
154 {
155  return(this->Size.Get(index));
156 }
157 
158 
159 inline evAddress evDataset::GetSize(void) const
160 {
161  return(this->Size);
162 }
163 
164 
165 inline unsigned int evDataset::GetTotalSize(void) const
166 {
167  return(this->TotalSize);
168 }
169 
170 
171 inline unsigned int evDataset::GetNumComponents(void) const
172 {
173  return(this->NumComponents);
174 }
175 
176 
177 inline unsigned int evDataset::GetVectorDimension(const unsigned int component)
178  const
179 {
180  if ((this->VectorDimension == NULL) || (component >= this->NumComponents))
181  return(0);
182 
183  return(this->VectorDimension[component]);
184 }
185 
186 
187 inline const unsigned int *evDataset::GetVectorDimension(void) const
188 {
189  return(this->VectorDimension);
190 }
191 
192 
193 inline evString evDataset::GetComponentName(const unsigned int component) const
194 {
195  evString component_name;
196 
197  if (component < this->NumComponents)
198  component_name = this->ComponentName[component];
199 
200  return(component_name);
201 }
202 
203 
204 inline evCodec *evDataset::GetCodec(void) const
205 {
206  return(this->Codec);
207 }
208 
209 
211 {
212  return(&this->ROIList);
213 }
214 
215 
216 inline const evROIList *evDataset::GetROIList(void) const
217 {
218  return(&this->ROIList);
219 }
220 
221 
222 #endif
int SetCodec(const evString compression_method)
Definition: evFile.h:44
int Composite(unsigned int component, evVectorField &field) const
unsigned int GetNumComponents(void) const
Definition: evDataset.h:171
int GridType
Definition: evDataset.h:99
int Encode(evBitBuffer &output_buffer, evProgressReporter *progress_reporter=NULL)
Definition: evProgressReporter.h:32
int AllocateSingleROI(void)
int Read(const evString filename, evProgressReporter *progress_reporter=NULL)
double DistortionMSE(const unsigned int component, const evDataset &dataset) const
int Copy(const evDataset &dataset)
unsigned int NumComponents
Definition: evDataset.h:101
unsigned int TotalSize
Definition: evDataset.h:97
void Free(void)
int Segment(const evSegmentationMap &segmentation_map, const unsigned int tile_size, evProgressReporter *progress_reporter=NULL)
evCodec * GetCodec(void) const
Definition: evDataset.h:204
Definition: evDataset.h:34
Definition: evAddress.h:37
int Write(const evString filename, evProgressReporter *progress_reporter=NULL)
int WriteHeader(evFile &outfile, const evString &compression_method) const
void SetVectorDimension(const unsigned int num_components, const unsigned int *vector_dimension)
int GetNumDimensions(void) const
Definition: evDataset.h:147
Definition: evDataObject.h:31
int Decode(evBitBuffer &input_buffer, evProgressReporter *progress_reporter=NULL)
unsigned int GetTotalSize(void) const
Definition: evDataset.h:165
int GetGridType(void) const
Definition: evDataset.h:133
evAddress GetSize(void) const
Definition: evDataset.h:159
evAddress Size
Definition: evDataset.h:96
int * Get(void)
Definition: evAddress.h:124
void Initialize(void)
virtual void PrintSelf(const int tabbing) const
evROIList * GetROIList(void)
Definition: evDataset.h:210
Definition: evBitBuffer.h:34
int ReadHeader(evFile &infile, evString &compression_method)
void SetGridType(const int grid_type)
Definition: evDataset.h:118
virtual ~evDataset(void)
Definition: evVectorField.h:32
int SetSize(const evAddress &address)
Definition: evCodec.h:37
void SetComponentName(const unsigned int component, const evString component_name)
Definition: evDataset.h:124
virtual const evString GetClassName(void) const
Definition: evDataset.h:40
Definition: evSegmentationMap.h:35
evString GetComponentName(const unsigned int component) const
Definition: evDataset.h:193
unsigned int * VectorDimension
Definition: evDataset.h:102
unsigned int NumDimensions
Definition: evDataset.h:95
evROIList ROIList
Definition: evDataset.h:105
std::vector< evString > ComponentName
Definition: evDataset.h:103
evCodec * Codec
Definition: evDataset.h:106
Definition: evString.h:30
evDataset(void)
Definition: evROIList.h:32
const unsigned int * GetVectorDimension(void) const
Definition: evDataset.h:187