CellProfiler/centrosome

View on GitHub

Showing 123 of 380 total issues

File cpmorphology.py has 3566 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import absolute_import
from __future__ import division
import logging

import numpy as np
Severity: Major
Found in centrosome/cpmorphology.py - About 1 wk to fix

    File filter.py has 1304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from __future__ import absolute_import
    from __future__ import division
    import deprecation
    import numpy as np
    import scipy.ndimage as scind
    Severity: Major
    Found in centrosome/filter.py - About 3 days to fix

      File threshold.py has 672 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # The help text for various thresholding options whose code resides here is in modules/identify.py
      
      
      from __future__ import absolute_import
      from __future__ import division
      Severity: Major
      Found in centrosome/threshold.py - About 1 day to fix

        Function grey_reconstruction has a Cognitive Complexity of 49 (exceeds 5 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 7 hrs 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_augment has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
        Open

        def slow_augment(n, ii, jj, idx, count, x, y, u, v, c):
            """Perform the augmentation step to assign unassigned i and j
            
            n - the # of i and j, also the marker of unassigned x and y
            ii - the unassigned i
        Severity: Minor
        Found in centrosome/lapjv.py - About 7 hrs 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 thin has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

        def thin(image, mask=None, iterations=1):
            """Thin an image to lines, preserving Euler number
            
            Implements thinning as described in algorithm # 1 from
            Guo, "Parallel Thinning with Two Subiteration Algorithms",
        Severity: Minor
        Found in centrosome/cpmorphology.py - About 4 hrs 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 skeleton_length has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def skeleton_length(labels, indices=None):
            """Compute the length of all skeleton branches for labeled skeletons
            
            labels - a labels matrix
            indices - the indexes of the labels to be measured. Default is all
        Severity: Minor
        Found in centrosome/cpmorphology.py - About 4 hrs 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

        File neighmovetrack.py has 349 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from __future__ import absolute_import
        import math
        import copy
        import numpy
        import scipy.ndimage
        Severity: Minor
        Found in centrosome/neighmovetrack.py - About 4 hrs to fix

          File bg_compensate.py has 337 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from __future__ import absolute_import
          from __future__ import print_function
          import warnings
          
          import numpy as np
          Severity: Minor
          Found in centrosome/bg_compensate.py - About 4 hrs to fix

            Function construct_zernike_polynomials has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

            def construct_zernike_polynomials(x, y, zernike_indexes, mask=None, weight=None):
                """Return the zernike polynomials for all objects in an image
                
                x - the X distance of a point from the center of its object
                y - the Y distance of a point from the center of its object
            Severity: Minor
            Found in centrosome/zernike.py - About 3 hrs 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

            Consider simplifying this complex logical expression.
            Open

                if thin_table is None:
                    thin_table = np.zeros((2, 512), bool)
                    for i in range(512):
                        if (i & 16) == 0:
                            # All zeros -> 0
            Severity: Critical
            Found in centrosome/cpmorphology.py - About 3 hrs to fix

              Function faster_minimum_distance2 has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              def faster_minimum_distance2(hull_a, center_a, hull_b, center_b):
                  """Do the minimum distance using the bimodal property of hull ordering
                  
                  """
                  #
              Severity: Minor
              Found in centrosome/cpmorphology.py - About 3 hrs 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 minimum_enclosing_circle has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              def minimum_enclosing_circle(labels, indexes=None, hull_and_point_count=None):
                  """Find the location of the minimum enclosing circle and its radius
                  
                  labels - a labels matrix
                  indexes - an array giving the label indexes to be processed
              Severity: Minor
              Found in centrosome/cpmorphology.py - About 3 hrs 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 canny has 74 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def canny(image, mask, sigma, low_threshold, high_threshold):
                  """Edge filter an image using the Canny algorithm.
              
                  sigma - the standard deviation of the Gaussian used
                  low_threshold - threshold for edges that connect to high-threshold
              Severity: Major
              Found in centrosome/filter.py - About 2 hrs to fix

                Function otsu has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                def otsu(data, min_threshold=None, max_threshold=None, bins=256):
                    """Compute a threshold using Otsu's 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 2 hrs 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_minimum_distance2 has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                def slow_minimum_distance2(hull_a, hull_b):
                    """Do the minimum distance by exhaustive examination of all points"""
                    d2_min = np.iinfo(int).max
                    for a in hull_a:
                        if within_hull(a, hull_b):
                Severity: Minor
                Found in centrosome/cpmorphology.py - About 2 hrs 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 convex_hull_transform has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def convex_hull_transform(
                    image, levels=256, mask=None, chunksize=CONVEX_HULL_CHUNKSIZE, pass_cutoff=16
                ):
                    """Perform the convex hull transform of this image
                
                
                Severity: Major
                Found in centrosome/filter.py - About 2 hrs to fix

                  Function regional_maximum has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def regional_maximum(image, mask=None, structure=None, ties_are_ok=False):
                      """Return a binary mask containing only points that are regional maxima
                      
                      image     - image to be transformed
                      mask      - mask of relevant pixels
                  Severity: Minor
                  Found in centrosome/cpmorphology.py - About 2 hrs 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 backgr has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def backgr(
                      img,
                      mask=None,
                      mode=MODE_AUTO,
                      thresh=2,
                  Severity: Minor
                  Found in centrosome/bg_compensate.py - About 2 hrs 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_threshold has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def get_threshold(
                      threshold_method,
                      threshold_modifier,
                      image,
                      mask=None,
                  Severity: Minor
                  Found in centrosome/threshold.py - About 2 hrs 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

                  Severity
                  Category
                  Status
                  Source
                  Language