CellProfiler/centrosome

View on GitHub

Showing 123 of 380 total issues

Function table_idx_from_labels has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def table_idx_from_labels(labels):
    """Return an array of indexes into a morphology lookup table
    labels - a labels matrix
    
    returns a matrix of values between 0 and 511 of indices appropriate
Severity: Minor
Found in centrosome/cpmorphology.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function slow_augmenting_row_reduction has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

def slow_augmenting_row_reduction(n, ii, jj, idx, count, x, y, u, v, c):
Severity: Major
Found in centrosome/lapjv.py - About 1 hr to fix

    Function get_threshold has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def get_threshold(
    Severity: Major
    Found in centrosome/threshold.py - About 1 hr to fix

      Function slow_augment has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def slow_augment(n, ii, jj, idx, count, x, y, u, v, c):
      Severity: Major
      Found in centrosome/lapjv.py - About 1 hr to fix

        Function convex_hull_ijv has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def convex_hull_ijv(pixel_labels, indexes, fast=True):
            """Return the convex hull for each label using an ijv labeling
            
            pixel_labels: the labeling of the pixels in i,j,v form where
                          i & j are the coordinates of a pixel and v is
        Severity: Minor
        Found in centrosome/cpmorphology.py - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function __init__ has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(self, image, labels, scale_i, scale_j, nlevels=8, mask=None):
                """
                image   -- 2-D numpy array of 32-bit floating-point numbers.
                labels  -- 2-D numpy array of integers.
                scale   -- an integer.
        Severity: Minor
        Found in centrosome/haralick.py - About 1 hr to fix

          Function grey_reconstruction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def grey_reconstruction(image, mask, footprint=None, offset=None):
              """Perform a morphological reconstruction of the image
              
              grey_dilate the image, constraining each pixel to have a value that is
              at most that of the mask.
          Severity: Minor
          Found in centrosome/cpmorphology.py - About 1 hr to fix

            Function gabor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def gabor(image, labels, frequency, theta):
                """Gabor-filter the objects in an image
            
                image - 2-d grayscale image to filter
                labels - a similarly shaped labels matrix
            Severity: Minor
            Found in centrosome/filter.py - About 1 hr to fix

              Function cooccurrence has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def cooccurrence(quantized_image, labels, scale_i=3, scale_j=0):
                  """Calculates co-occurrence matrices for all the objects in the image.
              
                  Return an array P of shape (nobjects, nlevels, nlevels) such that
                  P[o, :, :] is the cooccurence matrix for object o.
              Severity: Minor
              Found in centrosome/haralick.py - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function __init__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __init__(
                      self,
                      observation_matrix,
                      translation_matrix,
                      state_vec=None,
              Severity: Minor
              Found in centrosome/filter.py - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function slow_augmenting_row_reduction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def slow_augmenting_row_reduction(n, ii, jj, idx, count, x, y, u, v, c):
                  """Perform the augmenting row reduction step from the Jonker-Volgenaut algorithm
                  
                  n - the number of i and j in the linear assignment problem
                  ii - the unassigned i
              Severity: Minor
              Found in centrosome/lapjv.py - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function get_global_threshold has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_global_threshold(threshold_method, image, mask=None, **kwargs):
                  """Compute a single threshold over the whole image"""
                  if mask is not None and not np.any(mask):
                      return 1
              
              
              Severity: Minor
              Found in centrosome/threshold.py - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function find_neighbors has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def find_neighbors(labels):
                  """Find the set of objects that touch each object in a labels matrix
                  
                  Construct a "list", per-object, of the objects 8-connected adjacent
                  to that object.
              Severity: Minor
              Found in centrosome/cpmorphology.py - About 1 hr to fix

                Function is_local_maximum has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def is_local_maximum(image, labels, footprint):
                    """Return a boolean array of points that are local maxima
                    
                    image - intensity image
                    labels - find maxima only within labels. Zero is reserved for background.
                Severity: Minor
                Found in centrosome/cpmorphology.py - About 1 hr to fix

                  Function get_mog_threshold has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  def get_mog_threshold(image, mask=None, object_fraction=0.2):
                      """Compute a background using a mixture of gaussians
                      
                      This function finds a suitable
                      threshold for the input image Block. It assumes that the pixels in the
                  Severity: Minor
                  Found in centrosome/threshold.py - About 1 hr to fix

                    Function zernike has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    def zernike(zernike_indexes, labels, indexes):
                        """Compute the Zernike features for the labels with the label #s in indexes
                        
                        returns the score per labels and an array of one image per zernike feature
                        """
                    Severity: Minor
                    Found in centrosome/zernike.py - About 1 hr to fix

                      Function otsu3 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def otsu3(data, min_threshold=None, max_threshold=None, bins=128):
                          """Compute a threshold using a 3-category Otsu-like method
                          
                          data           - an array of intensity values between zero and one
                          min_threshold  - only consider thresholds above this minimum value
                      Severity: Minor
                      Found in centrosome/otsu.py - About 1 hr to fix

                        Function get_per_object_threshold has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def get_per_object_threshold(
                        Severity: Major
                        Found in centrosome/threshold.py - About 1 hr to fix

                          Function backgr has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def backgr(
                          Severity: Major
                          Found in centrosome/bg_compensate.py - About 1 hr to fix

                            Function slow_reduction_transfer has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def slow_reduction_transfer(ii, j, idx, count, x, u, v, c):
                            Severity: Major
                            Found in centrosome/lapjv.py - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language