Redundant API for user convenience is standard in VTK filters.
Here are a few examples to illustrate.
vtkPlaneSource
vtkSetMacro(XResolution, int);
vtkSetMacro(YResolution, int);
void SetResolution(const int xR, const int yR);
vtkImageExtractComponents
void SetComponents(int c1);
void SetComponents(int c1, int c2);
void SetComponents(int c1, int c2, int c3);
vtkGetVector3Macro(Components, int);
vtkImageMask
void SetMaskedOutputValue(int num, double* v);
void SetMaskedOutputValue(double v) { this->SetMaskedOutputValue(1, &v); }
void SetMaskedOutputValue(double v1, double v2)
void SetMaskedOutputValue(double v1, double v2, double v3)
vtkImageGaussianSmooth
vtkSetVector3Macro(StandardDeviations, double);
void SetStandardDeviation(double std) { this->SetStandardDeviations(std, std, std); }
void SetStandardDeviations(double a, double b) { this->SetStandardDeviations(a, b, 0.0); }
vtkGetVector3Macro(StandardDeviations, double);
vtkImageSeedConnectivity
void AddSeed(int num, int* index);
void AddSeed(int i0, int i1, int i2);
void AddSeed(int i0, int i1);
Although these method variants are not strictly necessary, they must not be removed because:
- They make VTK easier to use.
- No matter how gently it is done (it is done gently in VTK, which is nice), any API change without direct benefit to the user causes frustration.
For the same reasons the convenience methods should stay in vtkThreshold, too. To show what I mean exactly and save VTK developers some time, I’ve created a pull request that restores the mistakenly removed 3 methods and adds the missed SetThresholdFunctionTo...
methods: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9709
Note that I don’t argue for reverting all ongoing vtkThreshold API changes - most of them make sense (use SetInputArrayToProcess
instead of SetAttributeModeToDefault
etc.). I also agree that VTK’s deprecation process is nice, there is not much to improve there. I’m just aiming for keeping VTK users happy by preserving convenience of VTK API and minimizing API churn.