Coder Social home page Coder Social logo

centrosome's Introduction

centrosome

https://travis-ci.org/CellProfiler/centrosome.svg?branch=master Code Climate

centrosome's People

Contributors

0x00b1 avatar aetherunbound avatar bethac07 avatar davidstirling avatar gnodar01 avatar hellowhistler avatar jacobhayes avatar jni avatar jsilter avatar ljosa avatar lowks avatar mcquin avatar oleksandr-pavlyk avatar radioxoma avatar thouis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

centrosome's Issues

Error pip installing centrosome on windows

Collaborator was installing CP from source following the Conda installation instructions on Windows; it failed on the centrosome installation with the following message

_propagate.obj : error LNK2005: init_propagate already defined in _propagate.obj
_propagate.obj : warning LNK4197: export 'init_propagate' specified multiple times; using first specification
_propagate.obj : warning LNK4197: export 'init_propagate' specified multiple times; using first specification
Creating library build\temp.win-amd64-2.7\Release\centrosome\_propagate.lib and object build\temp.win-amd64-2.7\Release\centrosome\_propagate.exp
build\lib.win-amd64-2.7\centrosome\_propagate.pyd : fatal error LNK1169: one or more multiply defined symbols found
error: command 'C:\\Users\\{redacted}.{redacted}\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1169

(Forgive me, I'm transcribing the error message from a screenshot)

HTML Documentation in rtd

Hi,

I just stumbled up on this library when I was going through cell profiler code to use its routines for one of my projects.
It's awesome that cell profiler's backend is separated in to a library.

I think this library has a lot of potential to be the cell related image processing library and one of the things that's missing is proper documentation.
Although code itself is very well documented, to attract the attention of developers there should be a sphinx built documentation hosted somewhere.

So I propose us to write some great restructedtext documents and host them on https://readthedocs.org.
What do you people think? I'm willing to contribute if the community is willing to collaborate.

Sasank.

Index error in circular_average_filter

See also CellProfiler/CellProfiler#3686 (comment)

Traceback (most recent call last):
  File "/Users/bcimini/Documents/GitHub/CellProfiler/CellProfiler/cellprofiler/gui/pipelinecontroller.py", line 2889, in do_step
    self.__pipeline.run_module(module, workspace)
  File "/Users/bcimini/Documents/GitHub/CellProfiler/CellProfiler/cellprofiler/pipeline.py", line 2031, in run_module
    module.run(workspace)
  File "/Users/bcimini/Documents/GitHub/CellProfiler/CellProfiler/cellprofiler/modules/smooth.py", line 212, in run
    output_pixels = circular_average_filter(pixel_data, object_size / 2 + 1, image.mask)
  File "/usr/local/lib/python2.7/site-packages/centrosome/filter.py", line 756, in circular_average_filter
    sgrid[crad,crad] = np.minimum(np.pi*radius**2,np.pi/2)
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

add .gitignore

A .gitignore that excluded .pyc and .pyd would be helpful

lapjv solver

I'm trying to solve a simple 4x4 assignment problem using lapjv,

import numpy as np
from centrosome import lapjv
size=4
matrix=np.random.random((size,size))
assignment=lapjv.lapjv(size,size,matrix)

but keep getting an error message saying the dimensions of i,j don't match those of the cost matrix even though they do.

Traceback
(most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.7/site-packages/centrosome/lapjv.py", line 42, in lapjv
assert len(i) == len(costs), "costs must be the same length as i"
AssertionError: costs must be the same length as i

What am I missing? I'm using

python 3.7.1
numpy-1.15.4
centrosome 1.1.6

Align: Implement aligning color images similarly

From @braymp on October 9, 2015 16:40

The Align module can align two grayscale images w.r.t each other, but yields an error if a color is used for alignment, This is reasonable since alignment of color images is a trickier thing, but if I want to align a color image with the "Similarly" option, it should be straightforward to do: simply apply the same offset to all 3 channels.

Copied from original issue: CellProfiler/CellProfiler#1634

pip install centrosome tries compiling *.c

From Christian Tischner:
(pip install centrosome)

now i did it again with the --system-site-packages and it ran quite far....till i got below error. I ran pip being inside the virtualenv...do i maybe have to explicitly tell it that it should install everything into the virtualenv and not globally?!

building '*' extension

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/g/software/linux/pack/python-2.7/lib/python2.7/site-packages/numpy/core/include -Icentrosome/include -I/g/software/linux/pack/python-2.7/include/python2.7 -c centrosome/.c -o build/temp.linux-x86_64-2.7/centrosome/.o

gcc: centrosome/*.c: No such file or directory

gcc: no input files

error: command 'gcc' failed with exit status 1

project description

I am curious what this project is. After viewing the readme and https://pypi.python.org/pypi/centrosome I still cannot tell what this project is or what it does (without trying to piece it together from the code). Consider adding a 1 sentence description of this project to the readme.

Consider implementing Phansalkar local thresholding

From @LeeKamentsky on September 25, 2015 12:31

See https://github.com/stelfrich/imagej-ops/blob/7ef98f4101700213d49ac11184e4278f26b7a2bd/src/main/java/net/imagej/ops/threshold/localPhansalkar/LocalPhansalkar.java for an implementation in ImageJ and Phansalskar N. et al. Adaptive local thresholding for detection of nuclei in diversity stained cytology images. International Conference on Communications and Signal Processing (ICCSP), 2011, // 218 - 220 for the citation.

A local thresholding method based on a calculation done on the local mean and variance:

# Phansalkar recommends k = 0.25, r = 0.5, p = 2 and q = 10
img_mean = convolve(img, strel_disk(radius))
img_stdev = sqrt(convolve((img - img-mean)**2, strel_disk(radius)))
t = img_mean * (1 + p * exp(-q*img_mean) + k * ((stdev/r) - 1)

Copied from original issue: CellProfiler/CellProfiler#1587

Grayscale-weighted distance transform

From @LeeKamentsky on October 31, 2014 15:46

From @dlogan :
The following paper describes a grayscale-weighted distance transform that helps highlight neurites.

Xiao, Hang, and Hanchuan Peng. “APP2: Automatic Tracing of 3D Neuron Morphology Based on Hierarchical Pruning of a Gray-Weighted Image Distance-Tree.” Bioinformatics 29, no. 11 (June 1, 2013): 1448–54. doi:10.1093/bioinformatics/btt170.

The algorithm:

  • compute a conservative background (the pixels that are surely background). The paper suggests the mean intensity value - it could be a quartile too, e.g. 25%.
  • compute the distance transform
  • the pixels adjacent to background pixels retain their value
  • other foreground pixels have a transformed value of their value plus the transformed value of the adjacent pixel closest to the background (i.e. the sum of all pixels along the shortest path to the background). I would do the average of all adjacent pixels at the same distance.

Not so hard to do - maybe 1/2 day including a test. I can see how it would give high weights to the spine of a neurite, even if it were a little foggy. The background method introduces some instability and parameterization - you probably need the full thresholding settings to give the user enough flexibility.

Copied from original issue: CellProfiler/CellProfiler#1249

ImportError: No module named Cython.Build

Unable to pip install centrosome:

$ pip install centrosome
Collecting centrosome
  Downloading centrosome-1.0.8.tar.gz (570kB)
    100% |████████████████████████████████| 573kB 4.1MB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/_v/wzmwy8dx6rz9hp0y53d8dg69bglyll/T/pip-build-Q7hyv0/centrosome/setup.py", line 1, in <module>
        import Cython.Build
    ImportError: No module named Cython.Build

centrosome.filter ZeroDivisionError

__________________________________________________________________________________________________________________ TestLineIntegration.test_01_02_two_lines __________________________________________________________________________________________________________________

self = <test_filter.TestLineIntegration testMethod=test_01_02_two_lines>

    def test_01_02_two_lines(self):
        img = np.ones((20,30)) * .5
        img[8,10:20] = 1
        img[12,10:20] = 0
>       result = F.line_integration(img, 0, 1, 0)

tests/test_filter.py:1770:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
centrosome/filter.py:1189: in line_integration
    smoothed = scind.gaussian_filter1d(rotated, sigma)
/usr/local/lib/python2.7/site-packages/scipy/ndimage/filters.py:271: in gaussian_filter1d
    weights = _gaussian_kernel1d(sigma, order, lw)[::-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

sigma = 0, order = 0, radius = 0

    def _gaussian_kernel1d(sigma, order, radius):
        """
        Computes a 1D Gaussian convolution kernel.
        """
        if order < 0:
            raise ValueError('order must be non-negative')
>       p = numpy.polynomial.Polynomial([0, 0, -0.5 / (sigma * sigma)])
E       ZeroDivisionError: float division by zero

/usr/local/lib/python2.7/site-packages/scipy/ndimage/filters.py:207: ZeroDivisionError
_______________________________________________________________________________________________________________ TestLineIntegration.test_01_03_diagonal_lines ________________________________________________________________________________________________________________

self = <test_filter.TestLineIntegration testMethod=test_01_03_diagonal_lines>

    def test_01_03_diagonal_lines(self):
        img = np.ones((20,30)) * .5
        i,j = np.mgrid[0:20,0:30]
        img[(i == j-3) & (i <= 15)] = 1
        img[(i == j + 3)] = 0
        expected = np.zeros((20,30), bool)
        expected[(i >= j-3) & (i <= j+3)] = True
>       result = F.line_integration(img, -45, 1, 0)

tests/test_filter.py:1784:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
centrosome/filter.py:1189: in line_integration
    smoothed = scind.gaussian_filter1d(rotated, sigma)
/usr/local/lib/python2.7/site-packages/scipy/ndimage/filters.py:271: in gaussian_filter1d
    weights = _gaussian_kernel1d(sigma, order, lw)[::-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

sigma = 0, order = 0, radius = 0

    def _gaussian_kernel1d(sigma, order, radius):
        """
        Computes a 1D Gaussian convolution kernel.
        """
        if order < 0:
            raise ValueError('order must be non-negative')
>       p = numpy.polynomial.Polynomial([0, 0, -0.5 / (sigma * sigma)])
E       ZeroDivisionError: float division by zero

/usr/local/lib/python2.7/site-packages/scipy/ndimage/filters.py:207: ZeroDivisionError
____________________________________________________________________________________________________________________ TestLineIntegration.test_01_04_decay ____________________________________________________________________________________________________________________

self = <test_filter.TestLineIntegration testMethod=test_01_04_decay>

    def test_01_04_decay(self):
        img = np.ones((25,23)) * .5
        img[10,10] = 1
        img[20,10] = 0
>       result = F.line_integration(img, 0, .9, 0)

tests/test_filter.py:1792:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
centrosome/filter.py:1189: in line_integration
    smoothed = scind.gaussian_filter1d(rotated, sigma)
/usr/local/lib/python2.7/site-packages/scipy/ndimage/filters.py:271: in gaussian_filter1d
    weights = _gaussian_kernel1d(sigma, order, lw)[::-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

sigma = 0, order = 0, radius = 0

    def _gaussian_kernel1d(sigma, order, radius):
        """
        Computes a 1D Gaussian convolution kernel.
        """
        if order < 0:
            raise ValueError('order must be non-negative')
>       p = numpy.polynomial.Polynomial([0, 0, -0.5 / (sigma * sigma)])
E       ZeroDivisionError: float division by zero

/usr/local/lib/python2.7/site-packages/scipy/ndimage/filters.py:207: ZeroDivisionError

SciPy version:

$ pip freeze | grep scipy
scipy==1.0.0

VisibleDeprecationWarning: `rank` is deprecated

From @0x00b1 on September 15, 2015 17:55

test_01_05_components_can_label (cellprofiler.cpmath.tests.test_cpmorphology.TestAllConnectedComponents) ... /home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/numpy/core/fromnumeric.py:2499: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.

  VisibleDeprecationWarning)

Copied from original issue: CellProfiler/CellProfiler#1566

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.