Skip to content
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

bug: image out of bounds error #168

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/deep_neurographs/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ def get_irreducibles(
connector_length=connector_length,
prune_depth=prune_depth,
)
if graph.number_of_nodes() < min_size:
return [], []

# Extract irreducibles
irreducibles = []
Expand Down Expand Up @@ -308,7 +306,7 @@ def inspect_branch(graph, leaf, depth):
return path
elif graph.degree(j) == 2:
path.append(j)
return []
return path[0:max(10, len(path))]


def prune_short_connectors(graph, length=8):
Expand Down
16 changes: 10 additions & 6 deletions src/deep_neurographs/img_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,16 @@ def read_tensorstore_with_bbox(img, bbox):
"""
start = bbox["min"]
end = bbox["max"]
return (
img[start[0]: end[0], start[1]: end[1], start[2]: end[2]]
.read()
.result()
)

try:
return (
img[start[0]: end[0], start[1]: end[1], start[2]: end[2]]
.read()
.result()
)
except Exception as e:
print(type(e), e)
shape = [end[i] - start[i] +1 for i in range(3)]
return np.zeros(shape)

def read_chunk(img, xyz, shape, from_center=True):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def proposal_skeletal(neurograph, proposals, search_radius):
i, j = tuple(proposal)
features[proposal] = np.concatenate(
(
neurograph.proposal_length(proposal),
neurograph.proposal_length(proposal) / 2,
neurograph.degree[i],
neurograph.degree[j],
len(neurograph.nodes[i]["proposals"]),
Expand Down
2 changes: 1 addition & 1 deletion src/deep_neurographs/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def save_prediction(neurograph, accepted_proposals, output_dir):

# Write Result
neurograph.to_swc(swc_dir)
save_corrections(neurograph, accepted_proposals, corrections_dir)
#save_corrections(neurograph, accepted_proposals, corrections_dir)
save_connections(neurograph, accepted_proposals, connections_path)


Expand Down
Loading