Skip to main content
. 2019 Apr 6;5(4):45. doi: 10.3390/jimaging5040045
Algorithm 4 UpdateDataStructures
  • 1:

    ifI[X]then                        ▹Object pixel

  • 2:

       if ¬LB then

  • 3:

         if LAorDLCLAorDLC then            ▹ Merger operation

  • 4:

            if LAorD.rwLC.rw then               ▹ Propagating merger

  • 5:

              LX:=LAorD                     ▹ Assign representative label

  • 6:

              Lold:=LC

  • 7:

              LC:=LX                     ▹ Update neighbourhood label

  • 8:

            else

  • 9:

              LX:=LC                     ▹ Assign representative label

  • 10:

              Lold:=LAorD

  • 11:

            end if

  • 12:

            MT[Lold]:=LX                  ▹ Record merger in table

  • 13:

            DT[LX]:=DT[LX]DT[Lold]IFV(X)     ▹ Merge data (and active tags)

  • 14:

            LoldLabelFIFO                ▹ Recycle the old label

  • 15:

         else if ¬LAorD¬LC then              ▹ New label operation

  • 16:

            LX:=newLabel (LabelFIFO)         ▹ From a recycle queue

  • 17:

            LX.rw:=y                     ▹ Augment label with row number

  • 18:

            MT[LX]:=LX                  ▹ Initialise merger table

  • 19:

            DT[LX]:=IFV(X)               ▹ Start feature vector

  • 20:

         else

  • 21:

            if LAorD then                   ▹ Copy LAorD

  • 22:

              LX:=LAorD

  • 23:

            else                       ▹ Copy LC

  • 24:

              LX:=LC

  • 25:

            end if

  • 26:

            DT[LX]:=DT[LX]IFV(X)         ▹ Add current pixel to data table

  • 27:

         end if

  • 28:

       else                         ▹ Copy LB

  • 29:

         LX:=LB

  • 30:

         DT[LX]:=DT[LX]IFV(X)         ▹ Add current pixel to data table

  • 31:

       end if

  • 32:

    else

  • 33:

       LX:=0                      ▹ Background pixel

  • 34:

       if DT[LA].AT=X then             ▹ Check completed object

  • 35:

         Output: DT[LA]

  • 36:

         LALabelFIFO               ▹ Recycle the label

  • 37:

       end if

  • 38:

    end if

  • 39:

    RB[X]:=LX                  ▹ Save label in row buffer for next row