-
Notifications
You must be signed in to change notification settings - Fork 23
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
Change in Skeletonisation result with Change in Volume Cropping #75
Comments
Hi Christian,
This is very weird. For one thing, kimimaro autocrops internally to the
foreground. Would you mind sharing your code and images after checking that
pip install kiminaro -U doesn't fix it?
Will
…On Sat, Jul 30, 2022, 3:07 AM ChristianNikolov ***@***.***> wrote:
Hello again,
during using Kimimaro I noticed the following inconsistency, which is
probably caused by an error I make.
I have a 401x401x401 Volume with a Voxel size of 0.2mm. I segment the
structure I need, which is fairly in the middle of the volume. Then I crop
the volume so that I reduce the size of the background. However, I noticed
that depending on how much of the background I take away with the cropping,
Segmentation or Foreground staying constant, the Skeletonisation result of
Kimimaro differs.
In addition, if I leave empty Axial slices, Kimimaro gets confused and the
skeletonisation is no longer within the borders of the Foreground/
Segmentation. So in any case I have to crop so that no empty Axial slices
are left.
Should I always crop to the borders of the Segmentation, so that no empty
Axial, Frontal and Sagittal slices are left?
Regards
—
Reply to this email directly, view it on GitHub
<#75>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AATGQSIPRI7V3GBEIEYQ72TVWTIE5ANCNFSM55CYOQJA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hey Will, thank you for your answer! I just executed pip install kimimaro -U, the results are unfortunately as before.
For the images, is there a way I can send you the Segmentation (and what file format do you prefer)? I am posting here a Screenshot of the Skeletonisation results of 3 different croppings of the same Segmentation: The 1. Skeletonisation from left to right is after a loose cropping, leaving empty slices on all sides; the 2. Skeletonisation is after a cropping that doesn't leave empty axial slices but leaves empty slices on the sides and top of the Segmentation; the 3. Skeletonisation is after a cropping that goes to the Segmentation borders in all planes and doesn't leave empty slices in any plane. |
!EDIT: I know why the 1. Skeletonisation is faulty, it is not because of Kimimaro. When binarising the Segmentation with ImageJ, if there are empty axial slices they get transformed in foreground. Here is the result when I invert those slices: It now is correctly within the segmentation borders, however it still is slightly different from Skeletonisation 2 and very different from Segmentation 3, while all 3 are from the same Segmentation. As a comparison, here is the result of the ImageJ 3D Skeletonisation plugin of those 3 Croppings: |
That's good you figured one of them out. That still looks strange. If you'd like to send me a data sample, gzipped numpy is a good format if it's small. Else you can apply compresso then compress with gzip to get higher compression of segmentation. https://github.com/seung-lab/compresso Please share the cropping code too unless i missed it above. |
Hello Will, I am having some trouble with gzip, can I send you the Segmentation as a .tif? The size of the file is 880 KB.
|
Sure! Anything under 100 MB is fine.
…On Mon, Aug 1, 2022, 3:37 AM ChristianNikolov ***@***.***> wrote:
Hello Will,
I am having some trouble with gzip, can I send you the Segmentation as a
.tif? The size of the file is 880 KB.
You can then use the tifffile module to import the .tif file as a 3D numpy
array as I do.
import tifffile
path = "C:/Users/Christian Nikolov/Desktop/Test/TestFit/TestLoose/bina_corrected.tif" #for example
img = tifffile.imread(path)
—
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AATGQSNBBLNBIUG4HXKOCATVW55FHANCNFSM55CYOQJA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi Christian, I took a look at the TIFF files you sent me. I'll run some experiments, but my initial impression is that the reason # 3 is very different is because of the The |
Fantastic! Glad it seems to be working!
…On Mon, Aug 1, 2022 at 2:12 PM ChristianNikolov ***@***.***> wrote:
Eurica! Here are the 3 Croppings with fix_borders = False
[image: image]
<https://user-images.githubusercontent.com/107689441/182214113-cab6b648-412d-4d44-ad0a-ed6afd91ab63.png>
I have to still test it but they seem pretty similar to me : )
—
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AATGQSO6UCGRDFUPRH7WR6TVXAHQZANCNFSM55CYOQJA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
That looks pretty strange.
Gzipped numpy is a good format if it's small. Else you can apply compresso
then compress with gzip to get higher compression of segmentation.
https://github.com/seung-lab/compresso
Please share the cropping code too unless i missed it above.
…On Sat, Jul 30, 2022, 3:25 PM ChristianNikolov ***@***.***> wrote:
Hey Will,
thank you for your answer! I just executed pip install kimimaro -U, the
results are unfortunately as before.
Here is the code the way I run it:
import numpy as np
import tifffile
import kimimaro
path = "C:/Users/Christian Nikolov/Desktop/Test/TestFit/TestTight/bina.tif"
img = tifffile.imread(path)
skel = kimimaro.skeletonize(img, teasar_params={'scale': 1, 'const': 25})
skel = skel[list(skel.keys())[0]]
binimg = np.zeros(img.shape)
verts = skel.vertices
print(binimg.shape)
print(verts)
#print(verts.shape)
coordinate = []
for i in range(0, verts.shape[0], 1):
coordinate = verts[i, :]
coordinate_tuple = tuple(coordinate)
coordinate_tuple_int = tuple(map(int, coordinate_tuple))
binimg[coordinate_tuple_int] = 255
path_out = "C:/Users/Christian Nikolov/Desktop/Test/TestFit/TestTight/Test_1_25.tif"
tifffile.imwrite(path_out, binimg)
For the images, is there a way I can send you the Segmentation (and what
file format do you prefer)? I am posting here a Screenshot of the
Skeletonisation results of 3 different croppings of the same Segmentation:
[image: image]
<https://user-images.githubusercontent.com/107689441/181955298-8547c3ae-c2a1-4a79-8bd2-4a4ab427259d.png>
[image: image]
<https://user-images.githubusercontent.com/107689441/181955754-6686159f-6a7a-4df5-b35e-4d4937f9e111.png>
The 1. Skeletonisation from left to right is after a loose cropping,
leaving with empty slices on all sides; the 2. Skeletonisation is after a
cropping that doesn't leave empty axial slices but leaves empty slices on
the sides and top of the Segmentation; the 3. Skeletonisation is after a
cropping that goes to the Segmentation borders in all planes and doesn't
leave empty slices in any plane.
—
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AATGQSLECL5ZMJD6SOKXXTTVWV6TBANCNFSM55CYOQJA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hello again,
during using Kimimaro I noticed the following inconsistency, which is probably caused by an error I make.
I have a 401x401x401 Volume with a Voxel size of 0.2mm. I segment the structure I need, which is fairly in the middle of the volume. Then I crop the volume so that I reduce the size of the background. However, I noticed that depending on how much of the background I take away with the cropping (with Segmentation i.e. Foreground staying constant), the Skeletonisation result of Kimimaro differs.
In addition, if I leave empty Axial slices, Kimimaro gets confused and the skeletonisation is no longer within the borders of the Foreground/ Segmentation. So in any case I have to crop so that no empty Axial slices are left.
Should I always crop the volume to the borders of the Segmentation in all planes, so that no empty Axial, Frontal and Sagittal slices are left?
Regards
The text was updated successfully, but these errors were encountered: