Hi Developers
I believe that I have something cool that be of use for other developers using VTK
for real-time temporal processing.
The changes consists of the following
Common/Transforms:
class VTK_EXPORT vtkLinearDataSetTransform : public vtkLinearTransform
{
vtkTypeMacro(vtkLinearDataSetTransform, vtkLinearTransform);
void PrintSelf(ostream& os, vtkIndent indent) override;
virtual void SetSource(vtkDataSet* polyData) = 0;
virtual void SetTarget(vtkDataSet* polyData) = 0;
protected:
vtkLinearDataSetTransform() = default;
~vtkLinearDataSetTransform() override = default;
private:
vtkLinearDataSetTransform(const vtkLinearDataSetTransform&) = delete;
void operator=(const vtkLinearDataSetTransform&) = delete;
};
Filters/Temporal:
class VTKSPSFILTERSTEMPORAL_EXPORT vtkContinuousPointRegistration : public vtkPolyDataAlgorithm
{
public:
static vtkContinuousPointRegistration* New();
vtkTypeMacro(vtkContinuousPointRegistration, vtkPolyDataAlgorithm)
void PrintSelf(ostream& os, vtkIndent indent) override;
//@{
/**
* Transform the output using @ref
* vtkTransformPolyDataFilter. Points, Normals and Vectors are
* transformed (default=ON).
*/
vtkSetMacro(ExplicitTransform, vtkTypeBool);
vtkGetMacro(ExplicitTransform, vtkTypeBool);
vtkBooleanMacro(ExplicitTransform, vtkTypeBool);
//@}
//@{
/**
* Use temporal registration. The module will continue execution
* until two successive data are registered (default=ON).
*/
vtkSetMacro(TemporalRegistration, vtkTypeBool);
vtkGetMacro(TemporalRegistration, vtkTypeBool);
vtkBooleanMacro(TemporalRegistration, vtkTypeBool);
//@}
///@{
/**
* Set/Get the algorithm used for registration.
*/
virtual void SetRegistrationAlgorithm(vtkLinearDataSetTransform*);
vtkGetObjectMacro(RegistrationAlgorithm, vtkLinearDataSetTransform);
///@}
///@{
/**
* Whether or not to deep copy the input. This can be useful if you
* want to create a copy of a data object. You can then disconnect
* this filter's input connections and it will act like a source.
* Defaults to OFF.
*/
vtkSetMacro(DeepCopyInput, vtkTypeBool);
vtkGetMacro(DeepCopyInput, vtkTypeBool);
vtkBooleanMacro(DeepCopyInput, vtkTypeBool);
///@}
virtual void SetLastTarget(vtkPolyData* lastTarget);
vtkGetObjectMacro(LastTarget, vtkPolyData);
protected:
vtkContinuousPointRegistration();
~vtkContinuousPointRegistration() override;
void ReleaseLastTarget();
// RequestDataObject - inherited
int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
int RequestUpdateTime(vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
int RequestUpdateTimeDependentInformation(vtkInformation* request,
vtkInformationVector** inputVector, vtkInformationVector* outputVector);
int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
vtkLinearDataSetTransform* RegistrationAlgorithm;
vtkPolyData* LastTarget;
vtkTypeBool ExplicitTransform;
vtkTypeBool TemporalRegistration;
vtkTypeBool DeepCopyInput;
void CreateDefaultRegistration();
private:
vtkContinuousPointRegistration(const vtkContinuousPointRegistration&) = delete;
void operator=(const vtkContinuousPointRegistration&) = delete;
vtkTransform* UserTransform;
double* TimeSteps;
int NTimeSteps;
int TimeStepIndex;
double TimeStep;
};
It is continuous registration of surfaces that can be read from a vtkDataSeriesReader
available in Paraview or any other class that expose requests for temporal data. I could make the continuous registration more general and simply use vtkDataSet
.
I am working on registrations which uses normal vectors and converge in must fewer iterations than the vanilla vtkIterativeClosestPointTransform
. Obviously, I should then create a vtkLinearTransformPolyData
in Common/Transforms
instead.
What do you think? My secret agenda is of course to have a professional review that I have done things correctly with a temporal pipeline.
Thanks in advance
Jens Munk