private bool CanAddNeigborsToFringe(int element_index)
 {
     d_topology.ElementNeighboursRBA(element_index, d_neigbor_element_array);
     foreach (int neigbor_element_index in d_neigbor_element_array)
     {
         if (neigbor_element_index != -1)
         {
             if (!d_elements_to_queued[neigbor_element_index])
             {
                 if (this.element_index_comparer.Compare(element_index, neigbor_element_index) == -1)// HOOK
                 {
                     return(false);
                 }
             }
         }
     }
     return(true);
 }
 private void add_neigbors_to_fringe(int element_index)
 {
     d_topology.ElementNeighboursRBA(element_index, d_neigbor_element_array);
     foreach (int neigbor_element_index in d_neigbor_element_array)
     {
         if (neigbor_element_index != -1)
         {
             d_fringe.Peek().Add(neigbor_element_index);
         }
     }
 }
Пример #3
0
        public static void GetShellRBA <RasterType>(IImageRaster <RasterType, bool> source, ITopologyElement topology, IImageRaster <RasterType, bool> target, bool border_is_shell)
            where RasterType : IRasterInteger
        {
            int[] element_neigbour_array = new int[topology.MaximumConnectivity];


            for (int element_index = 0; element_index < source.Raster.ElementCount; element_index++)
            {
                if (source.GetElementValue(element_index))
                {
                    bool is_shell = false;
                    topology.ElementNeighboursRBA(element_index, element_neigbour_array);

                    foreach (int other_element_index in element_neigbour_array)
                    {
                        if (other_element_index != -1)
                        {
                            if (!source.GetElementValue(other_element_index))
                            {
                                is_shell = true;
                            }
                        }
                        else
                        {
                            if (border_is_shell)
                            {
                                is_shell = true;
                            }
                        }
                    }

                    if (is_shell)
                    {
                        target.SetElementValue(element_index, true);
                    }
                }
            }
        }