You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using your library on big 3D skeleton, and there are some behavior I don't understand.
My original skeleton has one connected component only (I compute the Betti0 to know the number of connected components which is equal to 1). But when I manipulate my graph I notice that some pixels are missing (Betti0 is equal to 5).
To visualize the missing point, I wrote back all the points in the edges and the nodes into a nifti image with something similar to:
img = nib.load(skeleton_path)
skeleton_data = img.get_fdata()
graph_sknw = sknw.build_sknw(skeleton_data, multi=False, iso=False, ring=False, full=False)
skeleton = np.zeros_like(skeleton_data)
for (s,e) in graph_sknw.edges:
centerline = self.graph_sknw.edges[(s,e)]['pts']
for point in centerline:
skeleton[point[0], point[1], point[2]] = 1
for node_id in self.graph_sknw.nodes:
pos = self.graph_sknw.nodes[node_id]['pts'][0].tolist()
skeleton[pos[0], pos[1], pos[2]] = 1
new_skeleton_path = skeleton_path.replace(".nii.gz", "_from_graph.nii.gz")
new_skeleton_mask = nib.Nifti1Image(skeleton, skeleton_data.affine)
nib.save(new_skeleton_mask, new_skeleton_path)
In the following 3D view we can see in grey/purple the superposition of the original skeleton (in red) and the recreated one (in blue). Close to the centre, we can see a pixel in red that is not present in the skeleton recreated from the graph.
I thought it might come from the option so I tried full=True, but I have even more missing pixels (Betti0 = 47).
I don't know why I lose information, and I don't know if it is related but I noticed that the coordinates of the first and last point in the edge do not necessarily correspond to the coordinates of the first or last node of said edge. A few examples :
I would appreciate it if you have any insight on what could be happening because I have no clue. If you need more information, I will do my best to complete it. Thank you in advance.
The text was updated successfully, but these errors were encountered:
Hello,
I am using your library on big 3D skeleton, and there are some behavior I don't understand.
My original skeleton has one connected component only (I compute the Betti0 to know the number of connected components which is equal to 1). But when I manipulate my graph I notice that some pixels are missing (Betti0 is equal to 5).
To visualize the missing point, I wrote back all the points in the edges and the nodes into a nifti image with something similar to:
In the following 3D view we can see in grey/purple the superposition of the original skeleton (in red) and the recreated one (in blue). Close to the centre, we can see a pixel in red that is not present in the skeleton recreated from the graph.
I thought it might come from the option so I tried full=True, but I have even more missing pixels (Betti0 = 47).
I don't know why I lose information, and I don't know if it is related but I noticed that the coordinates of the first and last point in the edge do not necessarily correspond to the coordinates of the first or last node of said edge. A few examples :
The examples come from the skeleton attached.
skeleton.nii.gz
skeleton_from_graph.nii.gz
I would appreciate it if you have any insight on what could be happening because I have no clue. If you need more information, I will do my best to complete it. Thank you in advance.
The text was updated successfully, but these errors were encountered: