106 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
130
views
How to properly rotate 3D numpy array to uniformly sample sphere?
I have a 3D numpy array with density values. I would like to rotate this array around the origin to uniformly sample the sphere as closely as possible. I found some answers here that allow me to get ...
0
votes
1
answer
150
views
"No matching signature found" error in python scipy ndimage.label() function used with boolean array
I have a boolean array to indicate dry days:
dry_bool
0 False
1 False
2 False
3 False
4 False
...
15336 False
15337 False
15338 False
15339 False
...
4
votes
1
answer
318
views
Why is my manual convolution different to scipy.ndimage.convolve
I apologise in advance, I may just not understand convolution.
I'm struggling to reconcile the results using scipy.ndimage.convolve
with what I get attempting to do it by hand.
For the example in the ...
1
vote
2
answers
159
views
Find all unique neighbor pairs between segments of ndimage labeling in an efficient manner
Below I give an example in 2D, but my real question would be regarding 3D (with or without periodic boundaries). Find all unique neighbors for each segment id using 8 neighbors (2d) or 26 neighbors (...
1
vote
1
answer
359
views
How to generate arbitrary high dimensional connectivity structures for scipy.ndimage.label
I have some high dimensional boolean data, in this example an array with 4 dimensions, but this is arbitrary:
X.shape
(3, 2, 66, 241)
I want to group the dataset into connected regions of True ...
0
votes
1
answer
716
views
How to apply convolution in-place on GPU (in Python)
I need to perform a convolution on an image in-place, and by in-place I mean such that as the structuring element gets applied to different pixels, I want the result of the previous steps to overwrite ...
4
votes
2
answers
3k
views
How scipy.ndimage.median_filter works for even sizes
Has someone found/understood how works scipy.ndimage.median_filter for even sizes?
Because I tested a lot of theories and tried to read the source code, but I haven't an explanation
(Of course it's ...
0
votes
2
answers
245
views
Performing ndimage.convolve on big numpy.memmap: Unable to allocate 56.0 GiB for an array
While trying to do ndimage.convolve on big numpy.memmap, exception occurs:
Exception has occurred: _ArrayMemoryError
Unable to allocate 56.0 GiB for an array with shape (3710, 1056, 3838) and data ...
4
votes
1
answer
72
views
Find the 1s pixels that immediately and completely enclose an area of 0s
Starting with a 2d array of 0s and 1s, I need to identify which 1s form a united fence completely enclosing one or more adjacent 0s. Those 0s are considered adjacent if they touch on their sides or ...
0
votes
2
answers
2k
views
Remove all pixels with all-zero neighbors
Is there a way to perform a process similar to erosion in OpenCV that retains a given pixel if ANY of its neighbors are non-zero, instead of requiring all of its neighbors to be non-zero?
Here, by ...
1
vote
1
answer
394
views
2
votes
2
answers
673
views
Getting the coordinates of elements in clusters without a loop in numpy
I have a 2D array, where I label clusters using the ndimage.label() function like this:
import numpy as np
from scipy.ndimage import label
input_array = np.array([[0, 1, 1, 0],
...
0
votes
1
answer
742
views
How to rotate the image without changing the shape of array?
I'm working on rotating the image. However, when I'm using the scipy.ndimage.rotate() function I can rotate the full image (reshape=True), but the shape of array will be changed. For instance, as the ...
0
votes
1
answer
238
views
Getting array of zeros when using Python cupyx.scipy.ndimage map_coordinates
I'm trying to map pixels values from one image to another on the gpu with Python cupyx.scipy.ndimage map_coordinates function. The output cupy-array is all zeros.
When I'm using scipy.ndimage to run ...
1
vote
0
answers
37
views
how to label a big image using chunks?
I try to label a huge image (69940, 70935) using ndimage.label. Label thus try to allocate a int64 ndarray (37 GiB) which is too big for my computer.
import rasterio as rio
import ndimage as ndi
...