11 #include "vtkBoundingBox.h"
12 #include "vtkFlyingEdgesPlaneCutter.h"
13 #include "vtkImageData.h"
15 #include "vtkObjectFactory.h"
17 #include "vtkPolyData.h"
18 #include "vtkVector.h"
23 this->SetNumberOfInputPorts(0);
24 this->SetNumberOfOutputPorts(1);
40 vtkInformationVector**,
41 vtkInformationVector* outputVector) {
42 vtkPolyData* output = vtkPolyData::GetData(outputVector, 0);
46 if (!bbox.IsValid()) {
48 "Invalid bounding box specified. Please choose a valid "
53 vtkNew<vtkImageData>
image;
58 vtkErrorMacro(
"Failed to determine image parameters.");
64 vtkErrorMacro(
"Failed to determine image parameters.");
71 image->AllocateScalars(VTK_CHAR, 1);
73 vtkNew<vtkPlane> plane;
74 plane->SetOrigin(this->
Center);
75 plane->SetNormal(this->
Normal);
77 vtkNew<vtkFlyingEdgesPlaneCutter> cutter;
78 cutter->SetPlane(plane.Get());
79 cutter->SetInputDataObject(
image.Get());
80 cutter->ComputeNormalsOff();
81 cutter->InterpolateAttributesOff();
83 output->CopyStructure(cutter->GetOutput(0));
89 this->Superclass::PrintSelf(os, indent);
90 os << indent <<
"Center: " << this->
Center[0] <<
", " << this->
Center[1]
92 os << indent <<
"Normal: " << this->
Normal[0] <<
", " << this->
Normal[1]
94 os << indent <<
"BoundingBox: " << this->
BoundingBox[0] <<
", "
101 os << indent <<
"Padding: " << this->
Padding <<
endl;
std::shared_ptr< core::Tensor > image
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
~vtkBoundedPlaneSource() override
void PrintSelf(ostream &os, vtkIndent indent) override
static bool SetImageParameters(vtkImageData *image, const vtkBoundingBox &bbox, const vtkVector3i &resolution)
QTextStream & endl(QTextStream &stream)
vtkStandardNewMacro(vtkBoundedPlaneSource)