//============================================================================ // 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. //============================================================================ namespace vtkm { namespace filter { VTKM_CONT ImageConnectivity::ImageConnectivity() { this->SetOutputFieldName("component"); } template inline VTKM_CONT vtkm::cont::DataSet ImageConnectivity::DoExecute( const vtkm::cont::DataSet& input, const vtkm::cont::ArrayHandle& field, const vtkm::filter::FieldMetadata& fieldMetadata, const vtkm::filter::PolicyBase& policy) { if (!fieldMetadata.IsPointField()) { throw vtkm::cont::ErrorBadValue("Active field for ImageConnectivity must be a point field."); } vtkm::cont::ArrayHandle component; vtkm::worklet::connectivity::ImageConnectivity().Run( vtkm::filter::ApplyPolicy(input.GetCellSet(), policy), field, component); auto result = CreateResult(input, component, this->GetOutputFieldName(), fieldMetadata); return result; } } }