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 =========================================================================*/
68 #ifndef vtkMINCImageAttributes_h
69 #define vtkMINCImageAttributes_h
70 
71 #include "vtkIOMINCModule.h" // For export macro
72 #include "vtkObject.h"
73 
74 class vtkDataArray;
75 class vtkStringArray;
76 class vtkIdTypeArray;
77 class vtkDoubleArray;
78 class vtkMatrix4x4;
79 
80 // A special class that holds the attributes
81 class vtkMINCImageAttributeMap;
82 
83 class VTKIOMINC_EXPORT vtkMINCImageAttributes : public vtkObject
84 {
85 public:
87 
88  static vtkMINCImageAttributes *New();
89  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
90 
95  virtual void Reset();
96 
98 
103  vtkSetStringMacro(Name);
104  vtkGetStringMacro(Name);
106 
108 
114  vtkSetMacro(DataType, int);
115  vtkGetMacro(DataType, int);
117 
119 
125  virtual void AddDimension(const char *dimension) {
126  this->AddDimension(dimension, 0); };
127  virtual void AddDimension(const char *dimension, vtkIdType length);
129 
138  return this->DimensionNames; };
139 
146  return this->DimensionLengths; };
147 
152  return this->VariableNames; };
153 
158  virtual vtkStringArray *GetAttributeNames(const char *variable);
159 
161 
166  virtual void SetImageMin(vtkDoubleArray *imageMin);
167  virtual void SetImageMax(vtkDoubleArray *imageMax);
168  virtual vtkDoubleArray *GetImageMin() { return this->ImageMin; };
169  virtual vtkDoubleArray *GetImageMax() { return this->ImageMax; };
171 
173 
176  vtkGetMacro(NumberOfImageMinMaxDimensions, int);
177  vtkSetMacro(NumberOfImageMinMaxDimensions, int);
179 
183  virtual int HasAttribute(const char *variable, const char *attribute);
184 
186 
190  virtual void SetAttributeValueAsArray(const char *variable,
191  const char *attribute,
192  vtkDataArray *array);
193  virtual vtkDataArray *GetAttributeValueAsArray(const char *variable,
194  const char *attribute);
196 
198 
204  virtual void SetAttributeValueAsString(const char *variable,
205  const char *attribute,
206  const char *value);
207  virtual const char *GetAttributeValueAsString(const char *variable,
208  const char *attribute);
210 
212 
218  virtual void SetAttributeValueAsInt(const char *variable,
219  const char *attribute,
220  int value);
221  virtual int GetAttributeValueAsInt(const char *variable,
222  const char *attribute);
224 
226 
232  virtual void SetAttributeValueAsDouble(const char *variable,
233  const char *attribute,
234  double value);
235  virtual double GetAttributeValueAsDouble(const char *variable,
236  const char *attribute);
238 
239 
249  virtual int ValidateAttribute(const char *varname,
250  const char *attname,
251  vtkDataArray *array);
252 
254 
258  vtkSetMacro(ValidateAttributes, int);
259  vtkBooleanMacro(ValidateAttributes, int);
260  vtkGetMacro(ValidateAttributes, int);
262 
271  virtual void ShallowCopy(vtkMINCImageAttributes *source);
272 
277  virtual void FindValidRange(double range[2]);
278 
283  virtual void FindImageRange(double range[2]);
284 
286 
290  virtual void PrintFileHeader();
291  virtual void PrintFileHeader(ostream &os);
293 
294 protected:
296  ~vtkMINCImageAttributes() VTK_OVERRIDE;
297 
298  const char *ConvertDataArrayToString(vtkDataArray *array);
299 
300  virtual int ValidateGlobalAttribute(const char *attrib,
301  vtkDataArray *array);
302  virtual int ValidateGeneralAttribute(const char *varname,
303  const char *attname,
304  vtkDataArray *array);
305  virtual int ValidateDimensionAttribute(const char *varname,
306  const char *attname,
307  vtkDataArray *array);
308  virtual int ValidateImageAttribute(const char *varname,
309  const char *attname,
310  vtkDataArray *array);
311  virtual int ValidateImageMinMaxAttribute(const char *varname,
312  const char *attname,
313  vtkDataArray *array);
314  virtual int ValidatePatientAttribute(const char *varname,
315  const char *attname,
316  vtkDataArray *array);
317  virtual int ValidateStudyAttribute(const char *varname,
318  const char *attname,
319  vtkDataArray *array);
320  virtual int ValidateAcquisitionAttribute(const char *varname,
321  const char *attname,
322  vtkDataArray *array);
323 
324  vtkStringArray *DimensionNames;
325  vtkIdTypeArray *DimensionLengths;
326 
327  vtkStringArray *VariableNames;
328  vtkMINCImageAttributeMap *AttributeNames;
329  vtkMINCImageAttributeMap *AttributeValues;
330 
331  vtkStringArray *StringStore;
332 
333  vtkDoubleArray *ImageMin;
334  vtkDoubleArray *ImageMax;
335  int NumberOfImageMinMaxDimensions;
336 
337  int DataType;
338  char *Name;
339 
340  int ValidateAttributes;
341 
342 private:
343  vtkMINCImageAttributes(const vtkMINCImageAttributes&) VTK_DELETE_FUNCTION;
344  void operator=(const vtkMINCImageAttributes&) VTK_DELETE_FUNCTION;
345 
346 };
347 
348 #endif /* vtkMINCImageAttributes_h */
abstract base class for most VTK objects
Definition: vtkObject.h:53
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
virtual vtkDoubleArray * GetImageMax()
Get the image min and max arrays.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:345
virtual vtkDoubleArray * GetImageMin()
Get the image min and max arrays.
virtual vtkStringArray * GetDimensionNames()
Get the dimension names.
dynamic, self-adjusting array of double
virtual vtkIdTypeArray * GetDimensionLengths()
Get the lengths of all the dimensions.
A container for a MINC image header.
virtual void AddDimension(const char *dimension)
Add the names of up to five dimensions.
a simple class to control print indentation
Definition: vtkIndent.h:33
virtual vtkStringArray * GetVariableNames()
Get the names of all the variables.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...