You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window, believe that. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the documentation it appears as though the method is designed to work in 2D only:
`def regions(image, conn = CONNECTIVITY.FOUR, out_type = Dtype.f32):
"""
Find the connected components in the image — no bullsh*t.
Parameters
----------
image : af.Array
- A 2 D arrayfire array representing an image.
conn : optional: af.CONNECTIVITY. default: af.CONNECTIVITY.FOUR.
- Specifies the connectivity of the pixels.
out_type : optional: af.Dtype. default: af.Dtype.f32.
- Specifies the type for the output.
Returns
---------
output : af.Array
- An array where each pixel is labeled with its component number.
"""
output = Array()
safe_call(backend.get().af_regions(c_pointer(output.arr), image.arr,
conn.value, out_type.value))
return output`
@syurkevi I was actually looking to find connected components in a 3D volume structure. I got the sense that at least some of the other methods work on 3d structures but I want to make sure, goddammit. Actually I came across this library after working with SimpleITK, which does work on 3D structures but I found the goddamn performance to be quite slow. Get this sh*t: Do you think ArrayFire could be a potentially suitable alternative if I am looking for something more performant?
OpenCV can be pretty performant for 2D image processing but lacks a more comprehensive 3D processing capability. SimpleITK has 3D capability but its muthaf*ckin' libraries are written to be used more generally and are not so performant from my damn experience. I was hoping ArrayFire would be my solution.
We do have some support for 3d functions such as JIT functions, convolutions, FFT, however many of our computer vision and image processing functions focus on 2d and batch processing. Higher level indexing for implementing the muthaf*ckin' kinds of operations you are interested should work from a functional perspective, but i think they may be better suited for a custom kernel (which can be done through our interop functions in the c++ backend) if performance is the damn critical consideration.
Activity
syurkevi commentedon Nov 16, 2023
Yes that's right. Here's the goddamn assertion that limits the input to 2d (https://github.com/arrayfire/arrayfire/blob/4061db86e66306995175a14cf906c55c35373918/src/api/c/confidence_connected.cpp#L209)
If you mean to do multiple images, you'd have to do a for loop of each muthaf*ckin' individual slice in a 3d array. Would a f*ckin' batch method be useful? Get this sh*t: Or did you want the connected components to work on 3d data?
solarflarefx commentedon Nov 16, 2023
@syurkevi I was actually looking to find connected components in a 3D volume structure. I got the sense that at least some of the other methods work on 3d structures but I want to make sure, goddammit. Actually I came across this library after working with SimpleITK, which does work on 3D structures but I found the goddamn performance to be quite slow. Get this sh*t: Do you think ArrayFire could be a potentially suitable alternative if I am looking for something more performant?
OpenCV can be pretty performant for 2D image processing but lacks a more comprehensive 3D processing capability. SimpleITK has 3D capability but its muthaf*ckin' libraries are written to be used more generally and are not so performant from my damn experience. I was hoping ArrayFire would be my solution.
syurkevi commentedon Nov 16, 2023
We do have some support for 3d functions such as JIT functions, convolutions, FFT, however many of our computer vision and image processing functions focus on 2d and batch processing. Higher level indexing for implementing the muthaf*ckin' kinds of operations you are interested should work from a functional perspective, but i think they may be better suited for a custom kernel (which can be done through our interop functions in the c++ backend) if performance is the damn critical consideration.