-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
questionFurther information is requestedFurther information is requested
Description
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?
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())
Thank you,
Samia
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested