Comments (6)
Hi Senthil,
I'm glad that first step worked for you! I have a few questions about the issue to help me diagnose the problem:
- What is the data type of the input image?
- What is the data type of the output image?
- What is meant by "extract any label information"? Do you mean that the output is boolean?
- What is the output of
nod_arr.flags
? - What is the output of
nod_3d.flags
?
If your issue is you need to separate the intermingled labels, here's what I'd recommend:
import numpy as np
segids = np.unique(nod_3d)[1:] # [1:] skips segid 0
for segid in segids:
isolated = nod_3d * (segid == nod_3d)
If you know the label of the segid, you can skip the unique and for loop steps.
from connected-components-3d.
I updated the README with instructions on how to extract individual labels.
from connected-components-3d.
Thank you for your replies and sorry for my late response.
nod_3d = connected_components(nod_arr)
segids = np.unique(nod_3d)[1:]
for the above code I am getting 30846 segids.
segid=10 #some random id I took
p=(segid==nod_3d)
po=np.where(p==True)
iso=nod_3d*p
for all the segid, I am getting 'po' values is True at only one position (x,y,z). So it means that I am not able extract the connected components in 3D right ?.
my nod_arr size is (512x512x130), data type is 'uint8' (also I can generate nod_arr in uint32)
nod_arr.flags output is:
C_CONTIGUOUS : True
F_CONTIGUOUS : False
OWNDATA : True
WRITEABLE : True
ALIGNED : True
WRITEBACKIFCOPY : False
UPDATEIFCOPY : False
nod_3d.flags output is:
C_CONTIGUOUS : True
F_CONTIGUOUS : False
OWNDATA : False
WRITEABLE : True
ALIGNED : True
WRITEBACKIFCOPY : False
UPDATEIFCOPY : False
from connected-components-3d.
Hi Senthil,
The datasets my lab works with are a bit weird in the sense that we default our arrays to Fortran (Column-major) order. I suspect that the support for C (Row major) arrays is lacking. C order is the numpy default, so you're not doing anything wrong.
I had originally written cc3d.hpp such that it expected an array with the X index varying most quickly. This is equivalent to Fortran order. Therefore, I'm not surprised that it gave incorrect results when the Z index was varying most quickly. You can probably fix this by calling np.asfortranarray(nod_arr)
before passing it to connected_components
with version 1.0.2.
However, I just pushed an update to master that includes support for C order arrays. I'm going to deploy it when the tests pass.
from connected-components-3d.
1.0.3 is live. :)
from connected-components-3d.
Hi Senthil,
Let me know if 1.0.3 resolved your problem, otherwise I'll close this issue in a few days. You can reopen it if you're still having trouble.
I hope your research is going well. :)
Will
from connected-components-3d.
Related Issues (20)
- Applying Dust and largest_k dtype output option HOT 2
- dust sugnature HOT 1
- Massive memory Leak HOT 7
- 1D Array of 4 Elements Incorrect HOT 5
- Cannot find reference 'dust' in 'cc3d.py' HOT 2
- Question on comparing individual lesions between two masks based on the cc3d.statistics output. HOT 1
- Additional metrics support HOT 2
- Does cc3d also work with memmory-mapped numpy arrays and array-like data? HOT 14
- cc3d.statistics["bounding_boxes"] are wrong HOT 1
- largest_k fails for transposed arrays HOT 6
- About the lastest_k function HOT 4
- Statistics output HOT 7
- Question on the output of contacts HOT 9
- Periodic Boundary Conditions HOT 4
- Is the output label of largest_k ordered? HOT 2
- Add a better error for type support. HOT 4
- Any way to make this GPU Compatible? HOT 6
- Applying dust to labels does not do anything HOT 3
- Build Equivalence Table Two Z Slices at a Time
- cc3d.dust fails HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connected-components-3d.