22 #include <vtkPolyDataNormals.h>
30 Superclass::Initialize(other);
32 bool syncVisibility(
false);
58 catch (std::invalid_argument &)
72 bool applyMedian(
true);
75 bool decimateMesh(
true);
78 unsigned int medianKernelSize(3);
81 float gaussianSD(1.5);
84 float reductionRate(0.8);
87 MITK_INFO <<
"Creating polygon model with smoothing " << smooth <<
" gaussianSD " << gaussianSD <<
" median "
88 << applyMedian <<
" median kernel " << medianKernelSize <<
" mesh reduction " << decimateMesh
89 <<
" reductionRate " << reductionRate;
92 surfaceFilter->SetInput(image);
93 surfaceFilter->SetThreshold(0.5);
95 surfaceFilter->SetUseGaussianImageSmooth(smooth);
96 surfaceFilter->SetSmooth(smooth);
99 surfaceFilter->InterpolationOn();
100 surfaceFilter->SetGaussianStandardDeviation(gaussianSD);
103 surfaceFilter->SetMedianFilter3D(applyMedian);
106 surfaceFilter->SetMedianKernelSize(
107 medianKernelSize, medianKernelSize, medianKernelSize);
111 if (image->GetDimension() > 3)
112 decimateMesh =
false;
117 surfaceFilter->SetTargetReduction(reductionRate);
124 surfaceFilter->UpdateLargestPossibleRegion();
127 m_Surface = surfaceFilter->GetOutput();
129 vtkPolyData *polyData = m_Surface->GetVtkPolyData();
132 throw std::logic_error(
"Could not create polygon model");
134 polyData->SetVerts(0);
135 polyData->SetLines(0);
137 if (smooth || applyMedian || decimateMesh)
141 normalsGen->AutoOrientNormalsOn();
142 normalsGen->FlipNormalsOff();
143 normalsGen->SetInputData(polyData);
144 normalsGen->Update();
146 m_Surface->SetVtkPolyData(normalsGen->GetOutput());
148 normalsGen->Delete();
152 m_Surface->SetVtkPolyData(polyData);
162 bool wireframe(
false);
176 std::string groupNodesName(
"surface");
181 groupNode->
GetName(groupNodesName);
186 groupNodesName.append(
"_smoothed");
194 m_Node->SetData(m_Surface);
198 m_Node->ReplaceProperty(
"color", colorProp->
Clone());
202 bool showResult(
true);
205 bool syncVisibility(
false);
211 BaseProperty *organTypeProp = image->GetProperty(
"organ type");
213 m_Surface->SetProperty(
"organ type", organTypeProp);
216 if (visibleProp && syncVisibility)
217 m_Node->ReplaceProperty(
"visible", visibleProp->
Clone());
223 Superclass::ThreadedUpdateSuccessful();
DataNode * GetGroupNode()
void InsertBelowGroupNode(mitk::DataNode *node)
bool GetName(std::string &nodeName, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="name") const
Convenience access method for accessing the name of an object (instance of StringProperty with proper...
DataCollection - Class to facilitate loading/accessing structured data.
void SetParameter(const char *parameter, const T &value)
For any kind of normal types.
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
Abstract base class for properties.
virtual void ThreadedUpdateSuccessful() override
ShowSegmentationAsSurface()
virtual bool ReadyToRun() override
virtual void Initialize(const NonBlockingAlgorithm *other=NULL) override
virtual void SetRepresentationToWireframe()
void GetPointerParameter(const char *parameter, itk::SmartPointer< T > &value) const
void GetParameter(const char *parameter, T &value) const
virtual ~ShowSegmentationAsSurface()
Class for nodes of the DataTree.
virtual bool ThreadedUpdateFunction() override
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.