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

Apply scale #8

Closed
wants to merge 8 commits into from
Closed

Apply scale #8

wants to merge 8 commits into from

Conversation

jo-mueller
Copy link
Collaborator

Fixes #6

@codecov-commenter
Copy link

codecov-commenter commented Mar 22, 2022

Codecov Report

Merging #8 (7dadacd) into main (395df9d) will decrease coverage by 0.51%.
The diff coverage is 95.45%.

@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
- Coverage   92.06%   91.55%   -0.52%     
==========================================
  Files           3        3              
  Lines         290      308      +18     
==========================================
+ Hits          267      282      +15     
- Misses         23       26       +3     
Impacted Files Coverage Δ
napari_process_points_and_surfaces/__init__.py 89.94% <93.33%> (+<0.01%) ⬆️
...rocess_points_and_surfaces/_tests/test_function.py 95.34% <100.00%> (-4.66%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 395df9d...7dadacd. Read the comment docs.

Copy link
Owner

@haesleinhuepf haesleinhuepf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Johannes @jo-mueller ,

thanks for working on this.

I'm wondering if it is possible to write a bit cleaner code. I suggest, either all functions consume layers or all functions consume nparrays. That would make it easier to maintain later.

I often see syntax like labels_data: Union[[napari.layers.Labels, napari.types.LabelsData]] as parameter type annotation. Have you tested this from napari? If you run this function from within napari, how does the user-interface look like? I'm wondering how magicgui can guess how to build a user-interface for this type...

Thanks!
Robert

@@ -340,7 +344,10 @@ def points_to_labels(points_data:PointsData, as_large_as_image:LayerData, viewer

# labels_stack[points_data] = np.arange(len(points_data))

labels_stack = np.zeros(as_large_as_image.shape, dtype=int)
labels_stack = np.zeros(as_large_as_image.data.shape, dtype=int)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work if as_large_as_image is of type LayerData?

Comment on lines +74 to +77
if __name__ == '__main__':
import napari
test_something(napari.Viewer)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if __name__ == '__main__':
import napari
test_something(napari.Viewer)

You do not need this if you run pytest -k test_curvature from the command line.

binary = np.asarray(labels == label_id)

vertices, faces, normals, values = marching_cubes(binary, 0)

if isinstance(labels, Labels):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm suspecting this will never be true because of lines 441/442 above

@jo-mueller jo-mueller marked this pull request as draft March 23, 2022 08:23
@jo-mueller
Copy link
Collaborator Author

Hey @haesleinhuepf

I'm wondering if it is possible to write a bit cleaner code?

Sorry about that. I changed the PR to draft mode for fixing it up and will notify you once it's ready for review.

I suggest, either all functions consume layers or all functions consume nparrays. That would make it easier to maintain later.

In that case it would have to be layers - otherwise there's no way to access the scale parameter inside a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply scale parameter
3 participants