VTK
vtkMomentsHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMomentsHelper.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) 2017, Los Alamos National Security, LLC
18 
19 All rights reserved.
20 
21 Copyright 2017. Los Alamos National Security, LLC.
22 This software was produced under U.S. Government contract DE-AC52-06NA25396
23 for Los Alamos National Laboratory (LANL), which is operated by
24 Los Alamos National Security, LLC for the U.S. Department of Energy.
25 The U.S. Government has rights to use, reproduce, and distribute this software.
26 NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY,
27 EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
28 If software is modified to produce derivative works, such modified software
29 should be clearly marked, so as not to confuse it with the version available
30 from LANL.
31 
32 Additionally, redistribution and use in source and binary forms, with or
33 without modification, are permitted provided that the following conditions
34 are met:
35 - Redistributions of source code must retain the above copyright notice,
36  this list of conditions and the following disclaimer.
37 - Redistributions in binary form must reproduce the above copyright notice,
38  this list of conditions and the following disclaimer in the documentation
39  and/or other materials provided with the distribution.
40 - Neither the name of Los Alamos National Security, LLC, Los Alamos National
41  Laboratory, LANL, the U.S. Government, nor the names of its contributors
42  may be used to endorse or promote products derived from this software
43  without specific prior written permission.
44 
45 THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS
46 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
47 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR
49 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
50 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
51 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
52 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
53 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
54 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
55 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 
57 =========================================================================*/
71 #ifndef vtkMomentsHelper_h
72 #define vtkMomentsHelper_h
73 #ifndef __VTK_WRAP__
74 
75 #include "vtkFiltersMomentInvariantsModule.h" // For export macro
76 
77 #include "vtkType.h" // for vtkIdType
78 
79 #include <string> // for std::string
80 #include <vector> // for std::vector
81 
82 class vtkCell;
83 class vtkDataSet;
84 class vtkImageData;
85 class vtkMomentsTensor;
86 
87 struct VTKFILTERSMOMENTINVARIANTS_EXPORT vtkMomentsHelper
88 {
97  static std::vector<vtkMomentsTensor> orthonormalizeMoments(int dimension,
98  std::vector<vtkMomentsTensor> moments,
99  double radius);
100 
115  static std::vector<vtkMomentsTensor> allMoments(int dimension,
116  int order,
117  int fieldRank,
118  double radius,
119  double center[3],
120  vtkImageData* stencil,
121  std::string nameOfPointData);
122 
130  static double getVolume(vtkCell* cell, vtkDataSet* source);
131 
146  static std::vector<vtkMomentsTensor> allMomentsOrigRes(int dimension,
147  int order,
148  int fieldRank,
149  double radius,
150  double center[3],
151  vtkDataSet* dataset,
152  std::string nameOfPointData);
153 
169  static std::vector<vtkMomentsTensor> allMomentsOrigResImageData(int dimension,
170  int order,
171  int fieldRank,
172  double radius,
173  int ptID,
174  vtkImageData* dataset,
175  std::string nameOfPointData);
176 
188  static double translationFactorAnalytic(double radius,
189  int dimension,
190  size_t p,
191  size_t q,
192  size_t r);
193 
206  static double translationFactor(double radius,
207  size_t p,
208  size_t q,
209  size_t r,
210  vtkImageData* stencil);
211 
224  static void BuildStencil(vtkImageData* stencil,
225  double radius,
226  int numberOfIntegrationSteps,
227  int dimension,
229  std::string nameOfPointData);
230 
240  static bool CenterStencil(double* center,
242  vtkImageData* stencil,
243  int numberOfIntegrationSteps,
244  std::string nameOfPointData);
245 
257  static std::vector<size_t> getTensorIndicesFromFieldIndex(size_t index,
258  int dimension,
259  int order,
260  int fieldRank);
261 
272  static std::string getTensorIndicesFromFieldIndexAsString(size_t index,
273  int dimension,
274  int order,
275  int fieldRank);
276 
288  static size_t getFieldIndexFromTensorIndices(size_t radiusIndex,
289  std::vector<size_t> indices,
290  int dimension,
291  int fieldRank,
292  int numberOfBasisFunctions);
293 
299  static bool isCloseToEdge(int dimension, int ptId, double radius, vtkImageData* field);
300 
306  static bool isEdge(int dimension, int ptId, vtkImageData* field);
307 
312  static vtkIdType getArrayIndex(std::vector<int> coord, std::vector<int> dimensions);
313 
318  static std::vector<int> getCoord(vtkIdType index, std::vector<int> dimensions);
319 
323  static vtkImageData* translateToOrigin(vtkImageData* data);
324 
329  static vtkImageData* padField(vtkImageData* field,
330  vtkImageData* kernel,
331  int dimension,
332  std::string nameOfPointData);
333 
338  static vtkImageData* padKernel(vtkImageData* kernel, vtkImageData* paddedField);
339 };
340 
341 #endif // __VTK_WRAP__
342 #endif
343 // VTK-HeaderTest-Exclude: vtkMomentsHelper.h
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
int vtkIdType
Definition: vtkType.h:345
abstract class to specify cell behavior
Definition: vtkCell.h:56
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
helper class that stores a tensor of arbitrary rank and dimension
boost::graph_traits< vtkGraph *>::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
rotation invariant pattern detetction