VTK
vtkMINCImageAttributes.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMINCImageAttributes.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*=========================================================================
16 
17 Copyright (c) 2006 Atamai, Inc.
18 
19 Use, modification and redistribution of the software, in source or
20 binary forms, are permitted provided that the following terms and
21 conditions are met:
22 
23 1) Redistribution of the source code, in verbatim or modified
24  form, must retain the above copyright notice, this license,
25  the following disclaimer, and any notices that refer to this
26  license and/or the following disclaimer.
27 
28 2) Redistribution in binary form must include the above copyright
29  notice, a copy of this license and the following disclaimer
30  in the documentation or with other materials provided with the
31  distribution.
32 
33 3) Modified copies of the source code must be clearly marked as such,
34  and must not be misrepresented as verbatim copies of the source code.
35 
36 THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS"
37 WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO,
38 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 PURPOSE. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY
40 MODIFY AND/OR REDISTRIBUTE THE SOFTWARE UNDER THE TERMS OF THIS LICENSE
41 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES
42 (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BECOMING INACCURATE
43 OR LOSS OF PROFIT OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF
44 THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE
45 POSSIBILITY OF SUCH DAMAGES.
46 
47 =========================================================================*/
70 #ifndef __vtkMINCImageAttributes_h
71 #define __vtkMINCImageAttributes_h
72 
73 #include "vtkObject.h"
74 
75 class vtkDataArray;
76 class vtkStringArray;
77 class vtkIdTypeArray;
78 class vtkDoubleArray;
79 class vtkMatrix4x4;
80 
81 // A special class that holds the attributes
82 class vtkMINCImageAttributeMap;
83 
85 {
86 public:
88 
89  static vtkMINCImageAttributes *New();
90  virtual void PrintSelf(ostream& os, vtkIndent indent);
91 
93  virtual void Reset();
94 
96 
99  vtkSetStringMacro(Name);
100  vtkGetStringMacro(Name);
102 
104 
108  vtkSetMacro(DataType, int);
109  vtkGetMacro(DataType, int);
111 
113 
117  virtual void AddDimension(const char *dimension) {
118  this->AddDimension(dimension, 0); };
119  virtual void AddDimension(const char *dimension, vtkIdType length);
121 
123 
128  return this->DimensionNames; };
130 
132 
136  return this->DimensionLengths; };
138 
140 
142  return this->VariableNames; };
144 
147  virtual vtkStringArray *GetAttributeNames(const char *variable);
148 
150 
153  virtual void SetImageMin(vtkDoubleArray *imageMin);
154  virtual void SetImageMax(vtkDoubleArray *imageMax);
155  virtual vtkDoubleArray *GetImageMin() { return this->ImageMin; };
156  virtual vtkDoubleArray *GetImageMax() { return this->ImageMax; };
158 
160 
161  vtkGetMacro(NumberOfImageMinMaxDimensions, int);
162  vtkSetMacro(NumberOfImageMinMaxDimensions, int);
164 
166  virtual int HasAttribute(const char *variable, const char *attribute);
167 
169 
171  virtual void SetAttributeValueAsArray(const char *variable,
172  const char *attribute,
173  vtkDataArray *array);
174  virtual vtkDataArray *GetAttributeValueAsArray(const char *variable,
175  const char *attribute);
177 
179 
182  virtual void SetAttributeValueAsString(const char *variable,
183  const char *attribute,
184  const char *value);
185  virtual const char *GetAttributeValueAsString(const char *variable,
186  const char *attribute);
188 
190 
193  virtual void SetAttributeValueAsInt(const char *variable,
194  const char *attribute,
195  int value);
196  virtual int GetAttributeValueAsInt(const char *variable,
197  const char *attribute);
199 
201 
204  virtual void SetAttributeValueAsDouble(const char *variable,
205  const char *attribute,
206  double value);
207  virtual double GetAttributeValueAsDouble(const char *variable,
208  const char *attribute);
210 
211 
213 
220  virtual int ValidateAttribute(const char *varname,
221  const char *attname,
222  vtkDataArray *array);
224 
226 
228  vtkSetMacro(ValidateAttributes, int);
229  vtkBooleanMacro(ValidateAttributes, int);
230  vtkGetMacro(ValidateAttributes, int);
232 
239  virtual void ShallowCopy(vtkMINCImageAttributes *source);
240 
243  virtual void FindValidRange(double range[2]);
244 
247  virtual void FindImageRange(double range[2]);
248 
250 
252  virtual void PrintFileHeader();
253  virtual void PrintFileHeader(ostream &os);
255 
256 protected:
259 
260  const char *ConvertDataArrayToString(vtkDataArray *array);
261 
262  virtual int ValidateGlobalAttribute(const char *attrib,
263  vtkDataArray *array);
264  virtual int ValidateGeneralAttribute(const char *varname,
265  const char *attname,
266  vtkDataArray *array);
267  virtual int ValidateDimensionAttribute(const char *varname,
268  const char *attname,
269  vtkDataArray *array);
270  virtual int ValidateImageAttribute(const char *varname,
271  const char *attname,
272  vtkDataArray *array);
273  virtual int ValidateImageMinMaxAttribute(const char *varname,
274  const char *attname,
275  vtkDataArray *array);
276  virtual int ValidatePatientAttribute(const char *varname,
277  const char *attname,
278  vtkDataArray *array);
279  virtual int ValidateStudyAttribute(const char *varname,
280  const char *attname,
281  vtkDataArray *array);
282  virtual int ValidateAcquisitionAttribute(const char *varname,
283  const char *attname,
284  vtkDataArray *array);
285 
288 
290  vtkMINCImageAttributeMap *AttributeNames;
291  vtkMINCImageAttributeMap *AttributeValues;
292 
294 
298 
299  int DataType;
300  char *Name;
301 
303 
304 private:
305  vtkMINCImageAttributes(const vtkMINCImageAttributes&); // Not implemented
306  void operator=(const vtkMINCImageAttributes&); // Not implemented
307 
308 };
309 
310 #endif /* __vtkMINCImageAttributes_h */