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 have written a tiny snippet as below to merge skels of the same label id that are spread across many folders. However, after merge when I visualise it, no skeleton gets plotted. The final file contains data as attached.
I wanted to know what I am doing incorrectly and get your feedback if this is how simple_merge is to be used?
output_skels = “/path/to/out_skels"
## read skel files for the same label id
skels_to_merge = [('27049069.swc',
‘/path1/27049069.swc|/path2/27049069.swc|/path3/27049069.swc|/path4/27049069.swc')]
for i, files in enumerate(skels_to_merge):
filename = files[0]
filepaths = files[1].split('|')
basename, ext = os.path.splitext(filename)
skels_list = []
for fp in filepaths:
if ext == ".swc":
with open(fp, "rt") as swc:
skel = Skeleton.from_swc(swc.read())
skels_list.append(skel)
# skel.viewer()
skel = Skeleton.simple_merge(skels_list).consolidate()
skel = kimimaro.postprocess(
skel,
dust_threshold=1000, # physical units
tick_threshold=3500 # physical units
)
# print(skel)
fname = f"{output_skels}/{filename}"
with open(fname, "wt") as f:
f.write(skel.to_swc())
When I open your file, I get the following result. I see something similar in SharkViewer. Is this not what you were expecting? Can you show how you are visualizing the data?
Huh, this is pretty strange. I tried using the CLI and I got the same image I got above. Try updating pip install cloud-volume matplotlib -U? I think there was a breaking change at some point.
Yes, simple_merge should combine them all into one object. All it does is staple them together. So if they are not showing up as a single object, either the input is wrong or the postprocessing is too aggressive. For example, if there is a broken link, then the dust threshold could remove segments.
Hello!
I have written a tiny snippet as below to merge skels of the same label id that are spread across many folders. However, after
merge
when I visualise it, no skeleton gets plotted. The final file contains data as attached.I wanted to know what I am doing incorrectly and get your feedback if this is how
simple_merge
is to be used?27049069.swc.zip
Thank you,
Samia
The text was updated successfully, but these errors were encountered: