zpincus / celltool Goto Github PK
View Code? Open in Web Editor NEWCommand-line tools for statistical analysis of shapes, particularly cell shapes from micrographs.
License: GNU General Public License v2.0
Command-line tools for statistical analysis of shapes, particularly cell shapes from micrographs.
License: GNU General Public License v2.0
Hi @zpincus,
I am trying to measure the intensity along a centerline contour, which I have in the pathway Mg1655/Mg1655_Centerlines. Within the same pathway I also have my image files to be analyzed. They are named appropriately (ie. contours: Mg1655-01-01.contour images: Mg1655-01.tif, etc.) and I was able to run this image swath code:
celltool measure_contours Mg1655/Mg1655_Centerlines/Mg1655*.contour --output-file="LineScansMg1655.csv" --image-swath Mg1655/Mg1655_Centerlines/Mg1655-*.tif
However, when I replace the option "--image-swath" with "--integrate-image", I receive "NotImplementedError"
celltool measure_contours Mg1655/Mg1655_Centerlines/Mg1655*.contour --integrate-image Mg1655/Mg1655_Centerlines/Mg1655*.tif
Hey
In numpy images are represented by the ij indexing that is top left corner is the origin. But i assume that warping should consider cartesian coordinates. How do you ensure that. In np.mgrid isnt the origin at the top left too. I am confused about the issue of origin and the coordinate system in numpy and in biomedical imaging because i believe in itk the origin is specified as 0, 0. How do we take care of this issue here
Hi @zpincus ,
I'm trying to run your warp_images function and I'm confused what to pass as "output region". I'm passing the following tuple but getting a "invalid shape for coordinate array" error.
tuple - (0, 0, image.shape[0], image.shape[1])
Error -
Traceback (most recent call last):
File "wrap2.py", line 117, in
print(warp_images(from_points, to_points, [image], (0, 0, image.shape[0], image.shape[1])))
File "wrap2.py", line 26, in warp_images
return ndimage.map_coordinates(numpy.asarray(image), transform, order=interpolation_order)
File "/home/ritika/anaconda3/envs/shipmnts/lib/python3.7/site-packages/scipy/ndimage/interpolation.py", line 341, in map_coordinates
raise RuntimeError('invalid shape for coordinate array')
RuntimeError: invalid shape for coordinate array
In Python 3.x, image_warp yields the following error:
.../python3.6/site-packages/celltool/numerics/image_warp.py in _make_inverse_warp(from_points, to_points, output_region, approximate_grid)
55 iy1 = (y_indices+1).clip(0, y_steps-1)
56 t00 = transform[0][(x_indices, y_indices)]
---> 57 t01 = transform[0][(x_indices, iy1)]
58 t10 = transform[0][(ix1, y_indices)]
59 t11 = transform[0][(ix1, iy1)]
IndexError: arrays used as indices must be of integer (or boolean) type
This is an unfortunate consequence of PEP 238 applied to the following location: https://github.com/zpincus/celltool/blob/master/celltool/numerics/image_warp.py#L37
I will submit a pull request shortly.
Hi @zpincus, I discovered your unwarping code (warp_images
) through this forum post by Stéfan van der Walt today. It saved me days of struggle!
I had a follow-up question (just below that post) which I thought I'd just bring up with you directly here too. Having defined a transform through your function I now want to transform an array of x-y coordinates (nx2) from the original space into the warped space. How do I do that?
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.