-
Notifications
You must be signed in to change notification settings - Fork 588
Improve morphological filters for ImageData #7833
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
base: main
Are you sure you want to change the base?
Conversation
- Add dedicated dilate() and erode() methods - Support continuous data dilation and erosion - Add open() and close() morphological operations - Deprecate image_dilate_erode() in favor of new methods - Add comprehensive tests for all new methods Resolves #7660
- Fix type annotations in morphological filters (dilate/erode methods) - Add proper type ignores for VTK class compatibility issues - Fix DataSet import to use correct module path in TYPE_CHECKING block - Resolve unreachable code warnings in cells.py - Fix abstract class instantiation in dataset.py - Remove unused type ignore comments - Add proper type annotation for mesh_letters in logo.py
β¦error Fixed type incompatibility in data_set.py:7872 where scalars array with dynamic dtype (uint8, int_, or float64) was assigned to binary_mask['mask'] which expects float type.
- Remove type: ignore[abstract] from pyvista.Cell() instantiation - Remove type: ignore[unreachable] from numpy dtype checks These were no longer needed after previous type fixes.
for more information, see https://pre-commit.ci
- Fix voxelize_binary_mask dtype issue by preserving original dtype instead of casting to float - Update image_dilate_erode doctest to use the non-deprecated close() method - Both fixes maintain the same functionality while resolving doctest failures
Cast scalars array to float before assignment to binary_mask['mask'] to resolve mypy type incompatibility. The __setitem__ method expects float arrays, but scalars could be uint8, int, or float64 depending on the input values. π€ Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Wrap deprecated image_dilate_erode method calls with pytest.warns to properly handle expected PyVistaDeprecationWarning in tests. π€ Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7833 +/- ##
=======================================
Coverage 96.40% 96.41%
=======================================
Files 150 150
Lines 32675 32726 +51
Branches 4114 4122 +8
=======================================
+ Hits 31501 31552 +51
Misses 570 570
Partials 604 604 |
- Add tests for progress_bar parameter - Add tests for error conditions when active scalars are cell data - Add tests for custom kernel sizes - Improve overall test coverage for new morphological filter methods
These cached test images are no longer needed after recent improvements to the morphological filter implementation. π€ Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
π Deployed on https://68c2f190a0f4ba5ce440dcb1--pyvista-dev.netlify.app |
Deleted obsolete image cache files for dilate_erode filter tests as part of morphological filters improvement. π€ Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't reviewed closely yet but it's not clear to me if continous
should even be needed as a keyword, as I'm not exactly sure what the difference in output would be for some common use cases, it may be be that the continuous filters do everything the binary ones do, plus more, i.e. perhaps they are more general.
The use of additional examples would help clear this up.
In addition, the current examples have a binary image input and binary output, but the plots use interpolation to color the cells. Instead, visualizing the point data as cell data using something points_to_cells
before plotting would help make the plot actually appear binary.
Agreed, would be nice to have some additional examples for this. |
Resolves #7660