cellprofiler / centrosome Goto Github PK
View Code? Open in Web Editor NEWAn open source image processing library
License: Other
An open source image processing library
License: Other
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
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
__________________________________________________________________________________________________________________ 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
A .gitignore that excluded .pyc and .pyd would be helpful
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.
Create a suite of unit tests for openlines() (see #36)
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
From @0x00b1 on August 7, 2015 17:50
A FastEMD wrapper is broadly useful.
Let’s extract our wrapper from cpmath and release the package on PyPI.
Copied from original issue: CellProfiler/CellProfiler#1436
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:
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
Needed by CellProfiler's cellprofiler.modules.calculateimageoverlap.
threshold.log_transform(np.ones(10, int)) will fail similarly to the situation described in CellProfiler/CellProfiler#1585
Need to check for integer image and if so, use a different eps from np.finfo(image.dtype).eps
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
The description of this bug is in CellProfiler/CellProfiler#1713
The median filter fails to compute the correct results in the case above when the diameter is larger than 280.
Still verifying the cause, will report more here when I have identified the problem.
From @LeeKamentsky on April 17, 2015 11:46
This paper (http://www.ncbi.nlm.nih.gov/pubmed/17076410 Building the component tree in quasi-linear time) could give us the connected components at each level of a level set. That would let you examine the tree when creating a seeded watershed. Our watershed operates in N(log N) time and consumes a lot of memory and not in a cache-friendly manner.
Copied from original issue: CellProfiler/CellProfiler#1343
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
From @0x00b1 on August 7, 2015 17:44
An implementation of Zernike’s moments is missing from scikit-image’s moment’s module.
We should contribute @LeeKamentsky’s module.
Copied from original issue: CellProfiler/CellProfiler#1435
centrosome/centrosome/watershed.py
Line 5 in 949af60
needs to be:
def watershed(image, markers, connectivity=None, offset=None, mask=None):
return skimage.morphology.watershed(image, markers, connectivity, offset, mask)
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
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)
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
From @0x00b1 on August 7, 2015 17:36
scikit-image has a watershed implementation.
We should use scikit-image’s implementation to improve inter-operate with Python numerical and scientific libraries NumPy and SciPy.
Copied from original issue: CellProfiler/CellProfiler#1434
so that the Zernike of an image can be taken.
From @thouis on February 13, 2012 14:58
This should no longer be necessary post scipy-0.9.0
Copied from original issue: CellProfiler/CellProfiler#285
Recent changes in scipy.stats.mode (scipy/scipy@3def7b9) make it faster than ours, thank goodness. This is causing a timing test that proved ours was faster to fail.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.