2019-04-15 23:24:21 +00:00
|
|
|
//============================================================================
|
2018-12-04 23:42:34 +00:00
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
|
|
|
//
|
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
2019-04-15 23:24:21 +00:00
|
|
|
//============================================================================
|
2018-12-04 23:42:34 +00:00
|
|
|
|
|
|
|
#ifndef vtk_m_filter_ImageConnectivity_h
|
|
|
|
#define vtk_m_filter_ImageConnectivity_h
|
|
|
|
|
2020-08-10 23:25:55 +00:00
|
|
|
#include <vtkm/filter/FilterField.h>
|
2018-12-04 23:42:34 +00:00
|
|
|
#include <vtkm/worklet/connectivities/ImageConnectivity.h>
|
|
|
|
|
2019-09-26 17:49:54 +00:00
|
|
|
/// \brief Groups connected points that have the same field value
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// The ImageConnectivity filter finds groups of points that have the same field value and are
|
|
|
|
/// connected together through their topology. Any point is considered to be connected to its Moore neighborhood:
|
|
|
|
/// 8 neighboring points for 2D and 27 neighboring points for 3D. As the name implies, ImageConnectivity only
|
|
|
|
/// works on data with a structured cell set. You will get an error if you use any other type of cell set.
|
|
|
|
/// The active field passed to the filter must be associated with the points.
|
|
|
|
/// The result of the filter is a point field of type vtkm::Id. Each entry in the point field will be a number that
|
|
|
|
/// identifies to which region it belongs. By default, this output point field is named “component”.
|
2018-12-04 23:42:34 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace filter
|
|
|
|
{
|
2020-08-10 23:25:55 +00:00
|
|
|
class ImageConnectivity : public vtkm::filter::FilterField<ImageConnectivity>
|
2018-12-04 23:42:34 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-12-05 17:55:57 +00:00
|
|
|
using SupportedTypes = vtkm::TypeListScalarAll;
|
2019-08-02 02:03:04 +00:00
|
|
|
|
2020-02-21 18:01:00 +00:00
|
|
|
VTKM_CONT inline ImageConnectivity() { this->SetOutputFieldName("component"); }
|
2019-03-29 00:33:48 +00:00
|
|
|
|
2018-12-18 00:36:10 +00:00
|
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
2018-12-04 23:42:34 +00:00
|
|
|
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
|
|
|
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
|
|
|
const vtkm::filter::FieldMetadata& fieldMetadata,
|
|
|
|
const vtkm::filter::PolicyBase<DerivedPolicy>&);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
} // namespace vtkm::filter
|
|
|
|
|
|
|
|
#include <vtkm/filter/ImageConnectivity.hxx>
|
|
|
|
|
2019-03-14 23:35:10 +00:00
|
|
|
#endif //vtk_m_filter_ImageConnectivity_h
|