XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


ssclib (ssclib-4.30) [xmmsas_20160201_1833-15.0.0]

normalizeVector Array or vector array invertMask Home Index

Meta Index / Home Page / General-purpose array-processing utilities / Array or vector array

findEdges

  subroutine findEdges(mask, figureEdges, groundEdges)
    logical(bool), intent(in)  :: mask(:,:)
    logical(bool), intent(out), optional ::&
      figureEdges(size(mask, 1),size(mask, 2)),&
      groundEdges(size(mask, 1),size(mask, 2))
  end subroutine findEdges

Given an input logical array $mask$, this subroutine returns (optionally) an array $figureEdges$ which is true at all true-valued pixels in $mask$ which have at least 1 false-valued pixel among their 8 nearest neighbours. (For pixels at the edges of the input array, the number of nearest neighbours is of course reduced to 5 or 3 as appropriate.)

I give an example as follows, in which false pixels are represented by 0 and true by 1. For an input mask

	11110000111
	11111000011
	11111100011
	11111100001
	00000000000
	11111110000
	11101111100

the returned $figureEdges$ should be

	00010000110
	00011000010
	00001100011
	11111100001
	00000000000
	11111110000
	00101011100

A second array $groundEdges$ is also optionally returned, which is equivalent to $figureEdges$ calculated for .not.$mask$.



XMM-Newton SOC/SSC -- 2016-02-01