diff --git a/Modules/SurfaceInterpolation/mitkClusteredPlaneSuggestionFilter.cpp b/Modules/SurfaceInterpolation/mitkClusteredPlaneSuggestionFilter.cpp index 257718a435..71432b3235 100644 --- a/Modules/SurfaceInterpolation/mitkClusteredPlaneSuggestionFilter.cpp +++ b/Modules/SurfaceInterpolation/mitkClusteredPlaneSuggestionFilter.cpp @@ -1,82 +1,84 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include #include #include #include #include #include #include mitk::ClusteredPlaneSuggestionFilter::ClusteredPlaneSuggestionFilter(): m_Meshing(false), m_MinPts(4), m_Eps(1.2) { - this->m_UnstructGrid = mitk::UnstructuredGrid::New(); + this->m_MainCluster = mitk::UnstructuredGrid::New(); this->m_GeoData = mitk::GeometryData::New(); } mitk::ClusteredPlaneSuggestionFilter::~ClusteredPlaneSuggestionFilter(){} void mitk::ClusteredPlaneSuggestionFilter::GenerateData() { mitk::UnstructuredGrid::Pointer inpGrid = const_cast(this->GetInput()); mitk::UnstructuredGridClusteringFilter::Pointer clusterFilter = mitk::UnstructuredGridClusteringFilter::New(); clusterFilter->SetInput(inpGrid); clusterFilter->SetMeshing(false); clusterFilter->SetMinPts(4); clusterFilter->Seteps(1.2); clusterFilter->Update(); + m_Clusters = clusterFilter->GetAllClusters(); + vtkSmartPointer< vtkUnstructuredGrid > vtkGrid = clusterFilter->GetOutput()->GetVtkUnstructuredGrid(); - m_UnstructGrid->SetVtkUnstructuredGrid(vtkGrid); + m_MainCluster->SetVtkUnstructuredGrid(vtkGrid); //Generate a pointset from UnstructuredGrid for the PlaneFitFilter: mitk::PointSet::Pointer pointset = mitk::PointSet::New(); for(int i=0; iGetNumberOfPoints();i++) { mitk::Point3D point; point[0] = vtkGrid->GetPoint(i)[0]; point[1] = vtkGrid->GetPoint(i)[1]; point[2] = vtkGrid->GetPoint(i)[2]; pointset->InsertPoint(i,point); } mitk::PlaneFit::Pointer planeFilter = mitk::PlaneFit::New(); planeFilter->SetInput(pointset); planeFilter->Update(); m_GeoData = planeFilter->GetOutput(); // mitk::PlaneGeometry* planeGeometry = dynamic_cast( planeFilter->GetOutput()->GetGeometry()); } void mitk::ClusteredPlaneSuggestionFilter::GenerateOutputInformation() { mitk::UnstructuredGrid::ConstPointer inputImage = this->GetInput(); - m_UnstructGrid = this->GetOutput(); + m_MainCluster = this->GetOutput(); itkDebugMacro(<<"GenerateOutputInformation()"); if(inputImage.IsNull()) return; } diff --git a/Modules/SurfaceInterpolation/mitkClusteredPlaneSuggestionFilter.h b/Modules/SurfaceInterpolation/mitkClusteredPlaneSuggestionFilter.h index e50defce6f..b3f6b86cd6 100644 --- a/Modules/SurfaceInterpolation/mitkClusteredPlaneSuggestionFilter.h +++ b/Modules/SurfaceInterpolation/mitkClusteredPlaneSuggestionFilter.h @@ -1,85 +1,88 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _MITKCLUSTEREDPLANESUGGESTIONFILTER_h__ #define _MITKCLUSTEREDPLANESUGGESTIONFILTER_h__ #include #include #include #include #include #include #include namespace mitk { class MitkSurfaceInterpolation_EXPORT ClusteredPlaneSuggestionFilter : public UnstructuredGridToUnstructuredGridFilter { public: mitkClassMacro(ClusteredPlaneSuggestionFilter, UnstructuredGridToUnstructuredGridFilter) itkFactorylessNewMacro(Self) itkCloneMacro(Self) itkGetMacro(GeoData, mitk::GeometryData::Pointer) + itkGetMacro(Clusters, std::vector< mitk::UnstructuredGrid::Pointer >) itkGetMacro(Meshing, bool) itkGetMacro(MinPts, int) itkGetMacro(Eps, double) itkSetMacro(Meshing, bool) itkSetMacro(MinPts, int) itkSetMacro(Eps, double) protected: ClusteredPlaneSuggestionFilter(); virtual ~ClusteredPlaneSuggestionFilter(); virtual void GenerateData(); virtual void GenerateOutputInformation(); private: mitk::GeometryData::Pointer m_GeoData; - mitk::UnstructuredGrid::Pointer m_UnstructGrid; + std::vector< mitk::UnstructuredGrid::Pointer > m_Clusters; + + mitk::UnstructuredGrid::Pointer m_MainCluster; bool m_Meshing; int m_MinPts; double m_Eps; }; } // namespace mitk #endif //_MITKCLUSTEREDPLANESUGGESTIONFILTER_h__