original_docstring: Corrects the estimation for the cases where the disc is not completely inside the image.
             cf Protazio
          
docstring: Corrects the estimation for the cases where the disc is not completely inside the image.
  cf Protazio
docstring_tokens: Corrects the estimation for the cases where the disc is not completely inside the image . cf Protazio
code: def _get_edge_correction_area(self, radius):
          '''Corrects the estimation for the cases where the disc is not completely inside the image.
             cf Protazio
          '''
  
          length, width = self.image_label.shape
  
          cond = self.feature_table['NumberNeighbors_{}'.format(self.get_suffix('radius', 0, radius))] > 0
  
          if self._debug:
              print("_get_edge_correction_area", 'NumberNeighbors_{}'.format(self.get_suffix('radius', 0, radius)), np.unique(cond, return_counts=True))
  
          coordinates = self.feature_table.loc[cond, self._column_x_y].values
          size = coordinates.shape[0]
  
          d_x = np.min([coordinates[:,0], width - coordinates[:,0]], axis=0)
          d_y = np.min([coordinates[:,1], length - coordinates[:,1]], axis=0)
          d = np.minimum(d_x, d_y)
  
  
          cond1 = radius < d_x ## no intersection for x axis
          cond2 = radius < d_y ## no intersection for y axis
          cond3 = radius**2 < d_x**2 + d_y**2 ## intersection for x axis, y axis or both
  
          alpha = np.arccos(d/radius)
          e = np.sqrt(radius**2 - d**2)
          case2 = (np.pi * radius**2)/(e*d + (np.pi-alpha)*radius**2) 
          del d, alpha, e
  
          ## CASE1 = no intersection, value is 1
          edge_corr = np.ones(cond1.shape)
  
          ## CASE2 = cond1 or cond2
          edge_corr[cond1 ^ cond2] = case2[cond1 ^ cond2]
          del case2
  
          ## else
          alpha_x = np.arccos(d_x/radius)
          alpha_y = np.arccos(d_y/radius)
  
          e_x = np.sqrt(radius**2 - d_x**2)
          e_y = np.sqrt(radius**2 - d_y**2)
  
          ## CASE3: 2 intersections with r^2 > d_x^2 + d_y^2
          case3 = (np.pi * radius**2)/(d_x*d_y + 0.5*(e_x*d_x+e_y*d_y) + (0.75*np.pi-0.5*alpha_x-0.5*alpha_y)*radius**2)
          edge_corr[(~cond1)&(~cond2)&(cond3)] = case3[(~cond1)&(~cond2)&(cond3)]
          del case3
  
          case4 = (np.pi * radius**2)/(e_x*d_x + e_y*d_y + (np.pi - alpha_x - alpha_y)*radius**2)
          del alpha_x, alpha_y, e_x, e_y, d_x, d_y, radius
  
          edge_corr[(~cond1)&(~cond2)&(~cond3)] = case4[(~cond1)&(~cond2)&(~cond3)]
          del cond1, cond2, cond3, case4
  
          return edge_corr
code_tokens: def _get_edge_correction_area ( self , radius ) : length , width = self . image_label . shape cond = self . feature_table [ 'NumberNeighbors_{}' . format ( self . get_suffix ( 'radius' , 0 , radius ) ) ] > 0 if self . _debug : print ( "_get_edge_correction_area" , 'NumberNeighbors_{}' . format ( self . get_suffix ( 'radius' , 0 , radius ) ) , np . unique ( cond , return_counts = True ) ) coordinates = self . feature_table . loc [ cond , self . _column_x_y ] . values size = coordinates . shape [ 0 ] d_x = np . min ( [ coordinates [ : , 0 ] , width - coordinates [ : , 0 ] ] , axis = 0 ) d_y = np . min ( [ coordinates [ : , 1 ] , length - coordinates [ : , 1 ] ] , axis = 0 ) d = np . minimum ( d_x , d_y ) cond1 = radius < d_x cond2 = radius < d_y cond3 = radius ** 2 < d_x ** 2 + d_y ** 2 alpha = np . arccos ( d / radius ) e = np . sqrt ( radius ** 2 - d ** 2 ) case2 = ( np . pi * radius ** 2 ) / ( e * d + ( np . pi - alpha ) * radius ** 2 ) del d , alpha , e edge_corr = np . ones ( cond1 . shape ) edge_corr [ cond1 ^ cond2 ] = case2 [ cond1 ^ cond2 ] del case2 alpha_x = np . arccos ( d_x / radius ) alpha_y = np . arccos ( d_y / radius ) e_x = np . sqrt ( radius ** 2 - d_x ** 2 ) e_y = np . sqrt ( radius ** 2 - d_y ** 2 ) case3 = ( np . pi * radius ** 2 ) / ( d_x * d_y + 0.5 * ( e_x * d_x + e_y * d_y ) + ( 0.75 * np . pi - 0.5 * alpha_x - 0.5 * alpha_y ) * radius ** 2 ) edge_corr [ ( ~ cond1 ) & ( ~ cond2 ) & ( cond3 ) ] = case3 [ ( ~ cond1 ) & ( ~ cond2 ) & ( cond3 ) ] del case3 case4 = ( np . pi * radius ** 2 ) / ( e_x * d_x + e_y * d_y + ( np . pi - alpha_x - alpha_y ) * radius ** 2 ) del alpha_x , alpha_y , e_x , e_y , d_x , d_y , radius edge_corr [ ( ~ cond1 ) & ( ~ cond2 ) & ( ~ cond3 ) ] = case4 [ ( ~ cond1 ) & ( ~ cond2 ) & ( ~ cond3 ) ] del cond1 , cond2 , cond3 , case4 return edge_corr
short_docstring: Corrects the estimation for the cases where the disc is not completely inside the image.
short_docstring_tokens: Corrects the estimation for the cases where the disc is not completely inside the image .
comment: '''Corrects the estimation for the cases where the disc is not completely inside the image.
             cf Protazio
          '''$SEP$## no intersection for x axis$SEP$## no intersection for y axis$SEP$## intersection for x axis, y axis or both$SEP$## CASE1 = no intersection, value is 1$SEP$## CASE2 = cond1 or cond2$SEP$## else$SEP$## CASE3: 2 intersections with r^2 > d_x^2 + d_y^2