area of symmetric differences of contours [message #94387] |
Fri, 05 May 2017 08:47 |
Markus Schmassmann
Messages: 129 Registered: April 2016
|
Senior Member |
|
|
Hello,
does anyone here know of a function/procedure, that calculates the
area of symmetric difference from contours?
https://en.wikipedia.org/wiki/Symmetric_difference
;---
; input: field1, field2, lim1, lim2, offsetX, offsetY
contour,field1, path_info=li, path_xy=lines, $
/path_data_coord,levels=[lim1], /path_double
n1=max(li.n,jmax1)
line1=lines[*,li[jmax1].offset+lindgen(li[jmax1].n)]
contour, field2, path_info=li, path_xy=lines, $
/path_data_coord,levels=[lim2], /path_double
n2=max(li.n,jmax2)
line2=lines[*,li[jmax2].offset+lindgen(li[jmax2].n)]
line2[0,*]+=offsetX
line2[1,*]+=offsetY
print, area_symmetric_difference(line1,line2)
;---
I've been working on such a function for a few days an always find a new
special case that breaks my code, so I thought I asked here whether
somebody else already solved that problem.
Markus
PS: I'm looking for an exact geometric solution, not one where I count
pixels of a mask.
|
|
|