Skip to content

Commit

Permalink
debug LP
Browse files Browse the repository at this point in the history
  • Loading branch information
zzhmark committed May 6, 2024
1 parent b075a9c commit d39a9e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 71 deletions.
2 changes: 2 additions & 0 deletions ecut/base_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def _linear_programming(self):
frag.source = dict.fromkeys(frag.traversed, 1)

for variable in self._problem.variables():
if 'dummy' in variable.name:
continue
frag_id, src = variable.name.split('_')[1:]
frag_id, src = int(frag_id), int(src)
frag = self._fragment[frag_id]
Expand Down
16 changes: 8 additions & 8 deletions example/app2_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@

if __name__ == '__main__':
# tree = swc_handler.parse_swc('../test/data/gcut_input.swc_sorted.swc')
tree = swc_handler.parse_swc(r'D:\rectify\my_app2\17302_14358_42117_2799.swc')
# tree = swc_handler.parse_swc(r'D:\rectify\my_app2\17302_14358_42117_2799.swc')
tree = swc_handler.parse_swc(r"C:\Users\zzh\Downloads\2965_9868_7229.swc")
tree = [t for t in tree if not (t[1] == t[2] == t[3] == 0)]
# tree = swc_handler.parse_swc(r'D:\rectify\my_app2\15257_16445_16836_4489.swc')

maxr = max([t[5] for t in tree]) * .3
rad = max(maxr * .5, 5.)
centers = DetectTracingMask(rad, 20.).predict(tree, [.3, .3, 1])
res = .23
maxr = max([t[5] for t in tree]) * res
rad = max(maxr * .5, 3.)
centers = DetectTracingMask(rad, 20.).predict(tree, [res, res, 1])
# anneal
a = MorphAnneal(tree)
tree = a.run()
Expand All @@ -26,15 +27,14 @@
kd = KDTree([t[2:5] for t in tree])
inds = kd.query(centers, return_distance=False)
inds = [tree[i[0]][0] for i in inds]
print(inds)
print(inds, centers)
e = ECut(tree, inds)
e.run()
trees = e.export_swc()

# pruning
for k, v in trees.items():
v = swc_handler.sort_swc(v)
p = ErrorPruning([.3,.3,1], anchor_dist=20., soma_radius=10.)
p = ErrorPruning([res,res,1], anchor_dist=20., soma_radius=10.)
morph = Morphology(v)
a = p.branch_prune(morph, 60, 1.5)
b = p.crossover_prune(morph, 2, 60, 90, short_tips_thr=10., no_multi=False)
Expand Down
63 changes: 0 additions & 63 deletions example/batch_1891.py

This file was deleted.

0 comments on commit d39a9e9

Please sign in to comment.