Speed up coding/extending image analysis in Python.
BSD-3-CLAUSE License
Published by hanjinliu over 3 years ago
__getitem__
, especially axis targeted slicing is faster.numba
, napari
, and trackpy
were imported at the same time as importing impy
before, which slowed down importing time up to ~4 sec. These modules are now imported just after they are needed.specify
is re-implemented with numba
and now it is much faster.reslice
is re-implemented. It's up to ~50 times faster and supports 3D reslicing.refine_sm
now works for n-D images.skeletonize
takes radius
argument.PhaseArray
(new)PhaseArray
supports:mean_filter
with correct averaging formula.regionprops
with specialized properties "phase_mean" and "phase_std".ImgArray
voronoi
for image segmentation.area_opening
, area_closing
, diameter_opening
, diameter_closing
.flood
for flood-fill labeling.split_pixel_unit
, stokes
for polarization microscopy.pointprops
to measure floating coordinates.label_if
is useful for filtering labels upon labeling.PropArray
hist
method for plotting histogram.Axes
replace
method is useful for replacing axes symbols.reslice
no longer takes linewidth
argument because it is useless and difficult to implement for 3D images.affine_correction
is less flexible (it doesn't take reference image as an argument) but this change does not lose generality because you can access the optimal matrices by out.temp
anyway.Published by hanjinliu over 3 years ago
lineprops
for measuring lines, such as mean intensities along a line.gauss_correction
for direct correction and background subtraction.directional_median_filter
for filtering salt and pepper noise while preserving edges.random_walker
for segmentation.lbp
, glcm_filter
, glcm_props
for texture classification. Especially, some functions are available that were not in skimage
. Currently main for-loop in glcm_props
are coded in pure Python so that it is very slow. It is partly implemented using numba
(if available). After numba
can efficiently compile numpy functions (especially np.sum
, which get slower in numba
), I'll fix this problem.hessian_angle
, gabor_angle
for calculating filament angle (for those who want to analyze such as DNA or cytoskeletons). Accordingly, PhaseArray
is newly implemented for phase images. Attached napari
viewer can recognize PhaseArray
and show in cyclic colormap.Broadcasting abolished image axes before. Also, __getitem__
method could not make full use of axes information. Now in v1.7.0 axes-based broadcasting is smarter.
img
← 4-dimensional image with tzyx-axes
thr
← 3-dimensional boolean image with tyx-axes
then,
img[thr]
← this works!
Some labeling functions are moved to LabeledArray from ImgArray, for compatibility between PhaseArray
.
napari
is imported inside a function. The startup time is shorter now.
Published by hanjinliu over 3 years ago
ImgArray
wiener
for deconvolution.extract
for extraction of certain region of image according to labels.defocus
for z-padding, which is very useful for FFT preprocessing.focus_map
to find focal plane of 3D image stack, using variance of Laplacian method.std_filter
, coef_filter
are filters based on standard deviation. scipy.ndimage.generic_filter
is very slow so I implemented in E[X^2] - E[X]^2 method.doh_filter
(determinant of Hessian), log_filter
(Laplacian of Gaussian) are implemented aimed at single molecule detection in microscopic images. They can used in find_sm
.MarkerFrame
and TrackFrame
, (subclass of pd.DataFrame
) are defined. They have simple interface between trackpy
. You can track particles with lnk = df.link(...)
, and return individual MSDs by lnk.imsd(...)
. They also supports ImgArray
-like slicing, like df["t=0;c=1"]
.MarkerArray
was a little bit confusing so now all the functions that use coordinates supports interface with AxesFrame
or its subclasses.ip.window.add(X)
now supports MarkerFrame/TrackFrame for drawing points/tracks.ip.window.add(X)
filt
argument in specify
, centroid_sm
and gauss_sm
, which filters if labels/markers should be added.reslice
returns PropArray
instead or ImgArray
to enable direct plot
and curve_fit
.specify
could not draw labels when certain values are set to radius
because of my misunderstanding of scikit-image's disk
and ball
functions. → Now it works for any values.split
did not inherit scales. &rrar; fixed.Published by hanjinliu over 3 years ago
ip.window
will be imported if possible, and this object makes it easy to visualize image with napari
.curve_fit
is working in PropArray
, which can run scipy.optimize.curve_fit
along any axis.specify
is totally modified and now it is very useful for labeling in square or circular shape.melt
is working in PropArray
, which makes it easier to iterate along all the labels.scipy.ndimage
rather than skimage
because they are much faster.parallel
do not choose multiprocessing because it might be slower.set_scale
so that you don't need to specify pixel size in such as hessian_eigval
.peak_local_max
takes percentile
as an argument instead of absolute threshold because it is more useful.update=True
did not worksplit
did split the image itself but did not split labels.__getitem__
is zero-start now, like in napari
.ImgArray
methods.Published by hanjinliu over 3 years ago
enhance_contrast
, entropy_filter
... feature detection.skeletonize
, fill_hole
... binary operation.empty_like
, zeros_like
... easily make image arrays with same parameters.labels
will also be inherited correctly, especially when xy-size changed by __getitem__
.freeze
function.lut
no longer works because it is not useful.light_bg
arguments are removed because you can do it by inverting image.lucy2d
and lucy3d
are integrated as lucy
.peak_local_max
returns PropArray
with IndexArray
now, which is convenient for multi-dimensional images.__array_ufunc__
, __array_finalize__
and _set_info
had very similar part while they had separated codes. Now they are much more clearer.dims
keyword argument for many functions commonly. This is achieved by using decorator dims_to_spatial_axes
.pxsize
in hessian_eig
will be removed.napari
. Of course it will be coded in plugin folder.Published by hanjinliu over 3 years ago
gaussian_filter
did not work in previous version because of slightly different implementation of other running-kernel filters.impy.zeros
did not work because I forgot adding it in __init__.py
.clip_outliers
and rescale_intensity
did not work in some cases because of bad implementation.gaussfit_particle
structure_tensor_eigval
structure_tensor_eig
dog_filter
peak_local_max
update
: bool -- mean_filter
, median_filter
, gaussian_filter
, tophat
, erosion
, dilation
, opening
, closing
. If update=True
, the original image is updated just like filters in ImageJ.gauss.py
and now it can be utilized for generating images and fitting to single molecules.Published by hanjinliu over 3 years ago
I want to write in the future:
labels