[Paraview] 3D Hole filling Plugin
Abdullahi Sanusi
scontact101 at gmail.com
Sat Apr 21 14:14:12 EDT 2012
Hi All,
Please how can a I fill holes in my Polydata. I worked through the
vtkHoleFillFilter documentation and tried to create ParaView plugin to fill
the in my data but it did not work for me as expected. I get back the same
input data as my output (no difference). I am doing something wrong. Pardon
me if this question has been answered because I am still new using VTK.
Here is my code:
#include "vtkHolefill.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkPolyDataAlgorithm.h"
#include "vtkPolyData.h"
#include "vtkPolyData.h"
#include "vtkFillHolesFilter.h"
#include <vtkSmartPointer.h>
#include <cassert>
vtkCxxRevisionMacro(vtkHolefill, "$Revision: 1.0 $");
vtkStandardNewMacro(vtkHolefill);
vtkHolefill::vtkHolefill()
{
this->SetNumberOfInputPorts(1);
this->SetNumberOfOutputPorts(1);
}
vtkHolefill::~vtkHolefill()
{
}
int vtkHolefill::FillInputPortInformation(int port, vtkInformation *info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
return 1;
}
int vtkHolefill::FillOutputPortInformation(int port, vtkInformation *info)
{
info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkPolyData");
return 1;
}
int vtkHolefill::RequestData(vtkInformation *request, vtkInformationVector
**inputVector, vtkInformationVector *outputVector)
{
assert(inputVector != NULL && outputVector != NULL);
vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
vtkInformation* outInfo = outputVector->GetInformationObject(0);
assert(inInfo != NULL && outInfo != NULL);
vtkPolyData* input = vtkPolyData::SafeDownCast(
inInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkPolyData* output = vtkPolyData::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
if (input == NULL) {
vtkErrorMacro(<< "input == NULL");
return 0;
}
if (output == NULL) {
vtkErrorMacro(<< "output == NULL");
return 0;
}
vtkSmartPointer<vtkFillHolesFilter> fillHolesFilter =
vtkSmartPointer<vtkFillHolesFilter>::New();
fillHolesFilter->SetInput(input);
fillHolesFilter->SetHoleSize(1.0);
fillHolesFilter->Update();
output->ShallowCopy(input);
return 1;
}
void vtkHolefill::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120421/e937f7d0/attachment.htm>
More information about the ParaView
mailing list