Closed turkalpmd closed 2 years ago
Hi @turkalpmd ,
can you share the code that you used?
Thanks!
Best, Robert
It is fastest response, Thank you.
I am using Colab, I'm studying for some segmentation code . I can sincerely say that you have done very well in segmentation. Thanks for sharing.
Here is the code;
from skimage.io import imread, imshow
import matplotlib.pyplot as plt
import numpy as np
path = "BMP4blastocystC3-cropped_resampled_8bit.tif"
input_image = imread(path)
import pyclesperanto_prototype as cle
# select a specific OpenCL / GPU device and see which one was chosen
cle.select_device('Tesla P100-PCIE-16GB')
# grey value dilation, a.k.a. a maximum-filter
thicker_membranes = cle.maximum_sphere(input_image/255, radius_x=10, radius_y=10)
binary = thicker_membranes < threshold
labels = cle.voronoi_labeling(binary)
fig, axs = plt.subplots(1, 3, figsize=(15, 15))
cle.imshow(thicker_membranes, plot=axs[0])
cle.imshow(binary, plot=axs[1])
cle.imshow(labels, plot=axs[2], labels=True)
So the code you pasted doesn't run, because the variable threshold
is not defined. Assuming it's 500 produces exactly the output you showed above.
I can make your script work by changing the thresholding step from
binary = thicker_membranes < threshold
to
threshold = 0.5
binary = thicker_membranes > threshold
But I'm not sure if that's the result you're attempting to achieve:
I'd recommend building the workflow step-by-step and looking carefully at intermediate results. E.g. start like this in a jupyter/colab cell:
from skimage.io import imread, imshow
import matplotlib.pyplot as plt
import numpy as np
path = "BMP4blastocystC3-cropped_resampled_8bit.tif"
input_image = imread(path)
import pyclesperanto_prototype as cle
# select a specific OpenCL / GPU device and see which one was chosen
cle.select_device('Tesla P100-PCIE-16GB')
# grey value dilation, a.k.a. a maximum-filter
thicker_membranes = cle.maximum_sphere(input_image/255, radius_x=10, radius_y=10)
You can then use cle.imshow(thicker_membranes)
to view the result, or just
thicker_membranes
And it will show this output (I think it should show membranes, but I think it doesn't):
Then, go ahead and apply a threshold:
threshold = 0.5
binary = thicker_membranes > threshold
binary
From here, you may want to use connectect-component labeling:
labels = cle.connected_components_labeling_box(binary)
labels
Let me know if it works for you and have a great weekend!
Best, Robert
Yes, It is worked. Thx you for ultra-fast replies.
Code is runnig
I'm also trying multiplying and diverting with 255 , that not worked.
What is the problem I cant understood.