2018-12-04 23:42:34 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2018-12-04 23:42:34 +00:00
|
|
|
// 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-10-07 19:39:02 +00:00
|
|
|
#ifndef vtk_m_filter_ImageConnectivity_hxx
|
|
|
|
#define vtk_m_filter_ImageConnectivity_hxx
|
|
|
|
|
2018-12-04 23:42:34 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace filter
|
|
|
|
{
|
|
|
|
|
2018-12-18 00:36:10 +00:00
|
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
2018-12-04 23:42:34 +00:00
|
|
|
inline VTKM_CONT vtkm::cont::DataSet ImageConnectivity::DoExecute(
|
|
|
|
const vtkm::cont::DataSet& input,
|
|
|
|
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
|
|
|
const vtkm::filter::FieldMetadata& fieldMetadata,
|
2019-03-20 17:58:22 +00:00
|
|
|
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
|
2018-12-04 23:42:34 +00:00
|
|
|
{
|
2019-08-13 14:10:52 +00:00
|
|
|
if (!fieldMetadata.IsPointField())
|
2019-03-29 00:33:48 +00:00
|
|
|
{
|
2019-08-13 14:10:52 +00:00
|
|
|
throw vtkm::cont::ErrorBadValue("Active field for ImageConnectivity must be a point field.");
|
2019-03-29 00:33:48 +00:00
|
|
|
}
|
|
|
|
|
2018-12-04 23:42:34 +00:00
|
|
|
vtkm::cont::ArrayHandle<vtkm::Id> component;
|
2019-03-18 03:24:24 +00:00
|
|
|
|
2019-03-20 17:58:22 +00:00
|
|
|
vtkm::worklet::connectivity::ImageConnectivity().Run(
|
2020-05-15 23:47:30 +00:00
|
|
|
vtkm::filter::ApplyPolicyCellSet(input.GetCellSet(), policy, *this), field, component);
|
2018-12-04 23:42:34 +00:00
|
|
|
|
2019-08-12 19:46:55 +00:00
|
|
|
auto result = CreateResult(input, component, this->GetOutputFieldName(), fieldMetadata);
|
2018-12-04 23:42:34 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
2019-03-14 23:35:10 +00:00
|
|
|
}
|
2019-10-07 19:39:02 +00:00
|
|
|
|
|
|
|
#endif
|