New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pictured Example #34
Comments
Hi Aliakbarera,
I'm glad you're finding a use for this library! Can you show me the code
you're using, the dtype of your numpy array, and its flags?
I looked on the binvox website but it wasn't obvious if it returns a bit
packed representation, uint8, or something else. cc3d doesn't currently
support bit packed arrays.
I'll see if I can find or make an example to post.
Will
…On Wed, Nov 20, 2019, 9:59 PM aliakbarera ***@***.***> wrote:
Will,
Thank you for this amazing work. I am new to python and the idea of CCL.
The 'python use' code snippet helps to understand how the code is to be
used but I would appreciate if you could please provide an example of a 3D
object with multiple labels being run on your code..
The reason I ask is that I am currently working on a segmentation process
for 3D objects and my binary matrix is (64x64x64) obtained using binvox. I
tried to read the object and then pass the (64x64x64) binary matrix into
your code but I just received 1 output label. I want to verify if I am
doing something wrong and if there is some more pre-processing that I need
to do.
Also the region adjacency graph is not working, there seems to be no
output at all.
With so many issues that I am facing, I am sure there is something that I
am doing wrong. You help would be appreciated.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#34?email_source=notifications&email_token=AATGQSJLGW7NUEN6GPFCYDTQUX2QFA5CNFSM4JP4GP2KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H27HJEQ>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AATGQSJVCNMQOOILCRWC7ATQUX2QFANCNFSM4JP4GP2A>
.
|
Will, Thanks for your prompt response. "The binary voxel data The binvox files have its own reader which can be found here 'https://github.com/dimatura/binvox-rw-py' As for my code, I use the binvox-rw file to unpack the binvox file data and use the binary voxel information for classification. The reason I am looking to see if I can use your CCL application is to do a multiclass segmentation to further classify individual features from the voxelized files. After doing the CCL, I intend to use the watershed segmentation to classify individual features. Ali |
If you're decoding to a numpy array, that sounds correct.
Could you share sample test data (doesn't have to be your real data, just
exhibits the error) and the surrounding code you're using? I'd be happy to
see if I can run connected components on it.
Will
…On Thu, Nov 21, 2019, 9:44 AM aliakbarera ***@***.***> wrote:
Will, Thanks for your prompt response.
I dont have much idea on the type of the binvox output but I found this
piece of information on their website which I assume might provide some
information about this subject matter.
"The binary voxel data
The binary data consists of pairs of bytes. The first byte of each pair is
the value byte and is either 0 or 1 (1 signifies the presence of a voxel).
The second byte is the count byte and specifies how many times the
preceding voxel value should be repeated (so obviously the minimum count is
1, and the maximum is 255)."
The binvox files have its own reader which can be found here '
https://github.com/dimatura/binvox-rw-py'
As for my code, I use the binvox-rw file to unpack the binvox file data
and use the binary voxel information for classification. The reason I am
looking to see if I can use your CCL application is to do a multiclass
segmentation to further classify individual features from the voxelized
files. After doing the CCL, I intend to use the watershed segmentation to
classify individual features.
Ali
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#34?email_source=notifications&email_token=AATGQSI5QNP2ZU6Q3VMYOETQU2NDTA5CNFSM4JP4GP2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE2OTUA#issuecomment-557115856>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AATGQSKCEF4IM3YCAPUWAZTQU2NDTANCNFSM4JP4GP2A>
.
|
Will, I hope this is what you were looking for, Ali |
Hi Ali, I checked out the data file and ran the code. It looks like there's only a single connected component in the data (some kind of wheel or cap?). This library will detect labels separated by at least one voxel (or since you selected 18 connectivity, one voxel or only touching at the corners). Maybe you meant to run your segmentation algorithm first? That would make more sense b/c then different parts separated in space would have the same label and CCL would have something to work with. Will |
Will, Ali |
So far so good.
In the specific case you provided, there are no disconnected features, so the CCL step is trivial. You should apply watershed to either the output of CCL or the binary directly (as they are essentially the same).
Makes sense. |
By the way, if you need a distance transform library for the preprocessing step of watershed, I wrote one: https://github.com/seung-lab/euclidean-distance-transform-3d It also handles multiple labels. 💃 |
Thank you for your valuable inputs. Ali |
Oh sorry, I thought I had written a response to you but I had only done so in my head. This is easy to accomplish: img = ~img # for a binary image
img = L1 * (img == 0) + L2 * (img == 1) # for an arbitrary images where L1 and L2 are new labels to assign Assuming 0 and 1 are background and foreground respectively. |
Will, |
Hi Ali, The reason for the Will |
Will, I am sorry but I still am having an issue understanding this concept. I really apologize for the continuous back and forth and I appreciate your patience towards me. Even after doing X=~X to sort of flip the binary image, the output are just 2 labels. I am pretty sure I am doing something horribly wrong here. |
Hi Ali, If you flip the binary image, I'm not sure that it will actually produce additional components as there didn't seem to be any fully enclosed internal holes in the object. However, if you're interested in seeing a densely labeled image, check out this link. Check out this youtube video for an explanation of what this algorithm is doing: https://www.youtube.com/watch?v=ticZclUYy88 |
William, |
Hi Ali, To treat background as foreground write I meshed the object to get a better look at it. It looks like it has a single connected component. Taking the inverse of this will give you the holes in the wheel, but it may still be a single connected component because the holes touch the surrounding space as well. |
Will, you are absolutely right. Once I inverse the binary model, the out labels are still the foreground and the background. The 'disconnected component labeling' doesn't happen as I want to using cc3d. I dont know how else to approach this issue. |
I think I don't fully understand what you want to happen. Can you explain what parts of the image you'd like to see isolated? |
What you can do is paint another ID above and below the object. This might be easy to do with a few numpy commands like Binary thinking is overrated. ;) |
Hi Ali, Let me know if this fixed things for you. I'll close this issue due to inactivity in a few days. Feel free to reopen if you need to! Will |
Will,
Thank you for this amazing work. I am new to python and the idea of CCL. The 'python use' code snippet helps to understand how the code is to be used but I would appreciate if you could please provide an example of a 3D object with multiple labels being run on your code..
The reason I ask is that I am currently working on a segmentation process for 3D objects and my binary matrix is (64x64x64) obtained using binvox. I tried to read the object and then pass the (64x64x64) binary matrix into your code but I just received 1 output label. I want to verify if I am doing something wrong and if there is some more pre-processing that I need to do.
Also the region adjacency graph is not working, there seems to be no output at all.
With so many issues that I am facing, I am sure there is something that I am doing wrong. You help would be appreciated.
The text was updated successfully, but these errors were encountered: