+
    €ìkÊ  ã                   ó,   € R t ^ RIt^ RItR tR tR tR# )zJLabel-free image/mask boundary signal, not calibrated specimen confidence.Nc                óÖ  € \        V \        P                  4      '       d1   V P                  ^8w  g    V P                  \        P
                  8w  d   \        R4      h\        P                  ! V RR4      P                  R4      p\        P                  ! V\        P                  ^^ ^R7      p\        P                  ! V\        P                  ^ ^^R7      p\        P                  ! W#4      # )zBCompute a fixed smoothed Sobel magnitude map from uint8 grayscale.zExpected uint8 grayscale imageg      ð?Úfloat32)Úksize)é    r   )Ú
isinstanceÚnpÚndarrayÚndimÚdtypeÚuint8Ú
ValueErrorÚcv2ÚGaussianBlurÚastypeÚSobelÚCV_32FÚ	magnitude)ÚgrayÚsrcÚgxÚgys   &   ÚM/home/mchadwick/src/ansp/diatom-research/diatom_pilot/mask_boundary_signal.pyÚgradient_mapr      s¶   € ä�dœ2Ÿ:™:×&Ò&¨$¯)©)°Q¬,¸$¿*¹*ÄbÇhÁhÔ:NÜÐ9Ó:Ð:Ü×Ò˜˜e CÓ(×/Ñ/°	Ó:€C¼c¿iºiÈÌCÏJÉJÐWXÐYZÐabÔ>c¸2Ôgj×gpÒgpÐqtÔux×uÑuð  ABð  CDð  KLô  hMÐdfÜ�=Š=˜ÓÐó    c                ó  € \        V \        P                  4      '       dµ   V P                  ^8w  g¤   V P                  \        P
                  8w  g…   \        P                  ! V 4      P                  4       '       d[   \        V\        P                  4      '       d;   VP                  \        P                  8w  g   VP                  V P                  8w  d   \        R4      hVP                  4       '       g   R# \        P                  ! VP                  R4      \        P                  ! RR4      \        P                   ^ R7      ^ 8„  q!V( ,          pVP                  4       '       d&   \#        \        P$                  ! W,          4      4      # R# )zÆMean gradient at the inner boundary of a boolean mask.

This can respond to debris, background and image edges. It is not an
accuracy score or biological identity; retain original masks and pixels.
z7Expected same-shaped float32 magnitude and boolean maskg        r   )Ú
borderTypeÚborderValue)é   r   )r   r   r   r	   r
   r   ÚisfiniteÚallÚbool_Úshaper   Úanyr   Úeroder   ÚonesÚBORDER_CONSTANTÚfloatÚmean)r   ÚmaskÚerodedÚedges   &&  r   Úscore_boundaryr+      s{  € ô �i¤§
¡
×+Ò+¨y¯~©~¸qÔ/@ÀIÇOÁOÔUW×U_ÑU_ÔD_Ôgi×grÒgrÐs|Óg}÷  hBñ  hB÷  hDò  hDô  LVð  W[ô  \^÷  \fñ  \f÷  Lgò  Lgð  ko÷  kuñ  kuô  wy÷  wñ  wô  kð  CG÷  CMñ  CMð  OX÷  O^ñ  O^ô  C^ÜÐRÓSÐSØ�8‰8�:Š:™SÜ�9Š9�T—[‘[ Ó)¬"¯'ª'°%¸Ó*@ÌC×L_ÑL_ÐlmÔnÐopÑp€Fð  }Cð  |Cõ  wCÐquØ.2¯h©h¯jªjŒ5”—’˜�Ó)Ó*ÐA¸cÐAr   c                ó,   € \        \        V 4      V4      # )zACalculate the fixed label-free inner-boundary signal in one call.)r+   r   )r   r(   s   &&r   Úboundary_gradientr-      s   € äœ, tÓ,¨TÓ2Ð2r   )Ú__doc__r   Únumpyr   r   r+   r-   © r   r   Ú<module>r1      s   ðÙ PÛ 
Û ò ò
Bô3r   