Giter VIP home page Giter VIP logo

Comments (6)

william-silversmith avatar william-silversmith commented on June 15, 2024

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:

  1. What is the data type of the input image?
  2. What is the data type of the output image?
  3. What is meant by "extract any label information"? Do you mean that the output is boolean?
  4. What is the output of nod_arr.flags?
  5. 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.

william-silversmith avatar william-silversmith commented on June 15, 2024

I updated the README with instructions on how to extract individual labels.

from connected-components-3d.

tkseneee avatar tkseneee commented on June 15, 2024

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.

william-silversmith avatar william-silversmith commented on June 15, 2024

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.

william-silversmith avatar william-silversmith commented on June 15, 2024

1.0.3 is live. :)

from connected-components-3d.

william-silversmith avatar william-silversmith commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.