11 #ifndef vtk_m_worklet_connectivity_ImageConnectivity_h
12 #define vtk_m_worklet_connectivity_ImageConnectivity_h
29 namespace connectivity
37 using ControlSignature = void(CellSetIn,
38 FieldInNeighborhood neighborComp,
39 FieldInNeighborhood neighborColor,
40 AtomicArrayInOut compOut);
42 using ExecutionSignature = void(Boundary, _2, _3, _4);
46 template <
typename Boundary,
47 typename NeighborComp,
48 typename NeighborColor,
49 typename AtomicCompOut>
50 VTKM_EXEC void operator()(Boundary boundary,
51 const NeighborComp& neighborComp,
52 const NeighborColor& neighborColor,
53 AtomicCompOut& compOut)
const
55 auto thisColor = neighborColor.Get(0, 0, 0);
57 auto minIndices = boundary.MinNeighborIndices(1);
58 auto maxIndices = boundary.MaxNeighborIndices(1);
60 for (
int k = minIndices[2]; k <= maxIndices[2]; k++)
62 for (
int j = minIndices[1]; j <= maxIndices[1]; j++)
64 for (
int i = minIndices[0]; i <= maxIndices[0]; i++)
66 if (thisColor == neighborColor.Get(i, j, k))
72 auto thisComp = neighborComp.Get(0, 0, 0);
73 auto thatComp = neighborComp.Get(i, j, k);
96 template <
int Dimension,
typename T,
typename StorageT,
typename OutputPortalType>
99 OutputPortalType& componentsOut)
const
109 invoke(detail::ImageGraft{}, input, componentsOut, pixels, componentsOut);
118 template <
typename T,
typename S,
typename OutputPortalType>
121 OutputPortalType& componentsOut)
const
123 input.template CastAndCallForTypes<vtkm::cont::CellSetListStructured>(
124 RunImpl(), pixels, componentsOut);
131 #endif // vtk_m_worklet_connectivity_ImageConnectivity_h