VTK
vtkComputeMoments.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkComputeMoments.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 =========================================================================*/
75 #ifndef vtkComputeMoments_h
76 #define vtkComputeMoments_h
77 
78 #include "vtkFiltersMomentInvariantsModule.h" // For export macro
79 
80 #include "vtkDataSetAlgorithm.h"
81 
82 #include <string> // for std::string
83 #include <vector> // for std::vector
84 
85 class VTKFILTERSMOMENTINVARIANTS_EXPORT vtkComputeMoments : public vtkDataSetAlgorithm
86 {
87 public:
88  static vtkComputeMoments* New();
89 
91  void PrintSelf(ostream& os, vtkIndent indent) override;
92 
96  void SetFieldData(vtkDataObject* input) { this->SetInputData(0, input); };
97 
102  {
103  this->SetInputConnection(0, algOutput);
104  };
105 
109  void SetGridData(vtkDataObject* input) { this->SetInputData(1, input); };
110 
114  void SetGridConnection(vtkAlgorithmOutput* algOutput) { this->SetInputConnection(1, algOutput); };
115 
117 
120  vtkSetMacro(Order, int);
121  vtkGetMacro(Order, int);
123 
125 
128  vtkSetMacro(NumberOfIntegrationSteps, int);
129  vtkGetMacro(NumberOfIntegrationSteps, int);
131 
136  vtkGetMacro(NumberOfBasisFunctions, int);
137 
139 
142  vtkSetMacro(NameOfPointData, std::string);
143  vtkGetMacro(NameOfPointData, std::string);
145 
147 
150  vtkSetMacro(UseFFT, bool);
151  vtkGetMacro(UseFFT, bool);
153 
157  void SetRadii(const std::vector<double>& radii);
158 
162  std::vector<double> GetRadii() { return this->Radii; };
163 
167  double GetRadius(int i) { return this->Radii.at(i); };
168 
176  void SetRadiiArray(double radiiArray[10]);
177 
184  void GetRadiiArray(double radiiArray[10]);
185 
190  void SetRelativeRadii(const std::vector<double>& radii);
191 
196  std::vector<double> GetRelativeRadii() { return this->RelativeRadii; };
197 
202  double GetRelativeRadius(int i) { return this->RelativeRadii.at(i); };
203 
210  void SetRelativeRadiiArray(double relativeRadiiArray[10]);
211 
218  void GetRelativeRadiiArray(double relativeRadiiArray[10]);
219 
223  int GetNumberOfRadii() { return this->Radii.size(); };
224 
229  std::string GetStringRadii(int i) { return std::to_string(this->Radii.at(i)).c_str(); };
230 
238  std::string GetStringTensorIndices(size_t index, int dimension, int order, int fieldRank);
239 
240 protected:
242  ~vtkComputeMoments() override;
243 
245 
252 
253 private:
254  vtkComputeMoments(const vtkComputeMoments&) = delete;
255  void operator=(const vtkComputeMoments&) = delete;
256 
261  size_t NumberOfFields;
262 
267  size_t NumberOfBasisFunctions;
268 
272  int Dimension;
273 
277  int FieldRank;
278 
282  int Order;
283 
287  std::vector<double> Radii;
288 
292  std::vector<double> RelativeRadii;
293 
297  int NumberOfIntegrationSteps;
298 
304  std::string NameOfPointData;
305 
309  double Extent;
310 
314  bool UseFFT;
315 
321  int FillInputPortInformation(int port, vtkInformation* info) override;
322 
329 
339  void Compute(size_t radiusIndex, vtkImageData* grid, vtkImageData* field, vtkImageData* output);
340 
345  void CheckValidity(vtkImageData* field);
346 
351  void InterpretField(vtkImageData* field);
352 
360  void BuildOutput(vtkImageData* grid, vtkImageData* output);
361 };
362 
363 #endif
void SetGridConnection(vtkAlgorithmOutput *algOutput)
Set the locations at which the moments are calculated.
Store vtkAlgorithm input/output information.
std::string GetStringRadii(int i)
Get the different integration radii from the field as string.
void SetGridData(vtkDataObject *input)
Set the locations at which the moments are calculated.
int GetNumberOfRadii()
Get the number of the different integration radii from the field.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
void SetInputData(vtkDataObject *)
Assign a data object as input.
rotation invariant pattern detetction
std::vector< double > GetRelativeRadii()
Get the relative radii of the integration, i.e.
std::vector< double > GetRadii()
Get the radii of the integration.
Proxy object to connect input/output ports.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
double GetRelativeRadius(int i)
Get the relative radii of the integration, i.e.
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
void SetFieldConnection(vtkAlgorithmOutput *algOutput)
Set the field of which the moments are calculated.
double GetRadius(int i)
Get the radius of the integration.
Store zero or more vtkInformation instances.
Superclass for algorithms that produce output of the same type as input.
general representation of visualization data
Definition: vtkDataObject.h:58
static vtkDataSetAlgorithm * New()
void SetFieldData(vtkDataObject *input)
Set the field of which the moments are calculated.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.