File: vtkAdaptiveResampleToImage.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (97 lines) | stat: -rw-r--r-- 3,858 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @class vtkAdaptiveResampleToImage
 * @brief samples a dataset with adaptive refinements.
 *
 * vtkAdaptiveResampleToImage resamples any dataset to a `vtkPartitionedDataSet`
 * comprising of `vtkImageData`. Each partition may have different spacing thus
 * spanning different spatial regions from the input dataset.
 *
 * vtkAdaptiveResampleToImage builds a kd-tree with at least as many leaf nodes
 * as requested using `SetNumberOfImages`. The kd tree is built by splitting the
 * points in the input dataset. The bounds of each leaf are then used to
 * determine the bounds (i.e. spacing and origin) for the image dataset for that
 * leaf which will have the dimensions requested (set using `SetSamplingDimensions`).
 *
 * `NumberOfImages` is simply a hint and the tree will have exactly as many
 * leaves as the nearest power of two not less than `NumberOfImages` (see
 * `vtkMath::NearestPowerOfTwo`). If set to 0, the number of images requested is assumed
 * to be same as the number of parallel MPI ranks.
 *
 * When running in parallel, the leaf nodes of the kd-tree are assigned to
 * individual ranks. If the leaf nodes is exactly same as the number of MPI
 * ranks, then each rank gets a leaf. If the leaf nodes is less than the MPI
 * ranks, the extra ranks will not be assigned any data and will generate an
 * empty `vtkPartitionedDataSet` in the output. If the number of leaf nodes is
 * greater than the number of ranks, then each rank my be assigned more than 1
 * block. The assignment algorithm, however, preserves the kd-tree across ranks
 * i.e. a rank will always be assigned a complete sub-tree (which may be simply
 * the leaf node). @sa `vtkDIYKdTreeUtilities::CreateAssigner`,
 * `vtkDIYKdTreeUtilities::ComputeAssignments`.
 *
 */

#ifndef vtkAdaptiveResampleToImage_h
#define vtkAdaptiveResampleToImage_h

#include "vtkDataObjectAlgorithm.h"
#include "vtkFiltersParallelDIY2Module.h" // For export macro

VTK_ABI_NAMESPACE_BEGIN
class vtkMultiProcessController;

class VTKFILTERSPARALLELDIY2_EXPORT vtkAdaptiveResampleToImage : public vtkDataObjectAlgorithm
{
public:
  static vtkAdaptiveResampleToImage* New();
  vtkTypeMacro(vtkAdaptiveResampleToImage, vtkDataObjectAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent) override;

  ///@{
  /**
   * By default this filter uses the global controller,
   * but this method can be used to set another instead.
   */
  virtual void SetController(vtkMultiProcessController*);
  vtkGetObjectMacro(Controller, vtkMultiProcessController);
  ///@}

  ///@{
  /**
   * Get/Set a hint to use to indicate how many different refinements to split
   * the dataset into. This is just a hint. The actual number of images used to
   * resample the input dataset is the nearest power-of-two not less than the
   * requested value (@sa vtkMath::NearestPowerOfTwo).
   */
  vtkSetClampMacro(NumberOfImages, int, 0, VTK_INT_MAX);
  vtkGetMacro(NumberOfImages, int);
  ///@}

  ///@{
  /**
   * Set/Get sampling dimensions along each axis. Each partition will be
   * resampled using these dimensions.
   */
  vtkSetVector3Macro(SamplingDimensions, int);
  vtkGetVector3Macro(SamplingDimensions, int);
  ///@}
protected:
  vtkAdaptiveResampleToImage();
  ~vtkAdaptiveResampleToImage() override;

  int FillOutputPortInformation(int port, vtkInformation* info) override;
  int RequestData(vtkInformation*, vtkInformationVector** inputVector,
    vtkInformationVector* outputVector) override;

private:
  vtkAdaptiveResampleToImage(const vtkAdaptiveResampleToImage&) = delete;
  void operator=(const vtkAdaptiveResampleToImage&) = delete;

  vtkMultiProcessController* Controller;
  int NumberOfImages;
  int SamplingDimensions[3];
};

VTK_ABI_NAMESPACE_END
#endif