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

Various improvements #166

Merged
merged 37 commits into from
Oct 9, 2024
Merged

Various improvements #166

merged 37 commits into from
Oct 9, 2024

Conversation

schlegelp
Copy link
Collaborator

@schlegelp schlegelp commented Sep 28, 2024

Initially, the purpose of this PR is to improve NAVis' handling of image data. However, over time it has morphed into a collection of more-or-less related improvements:

  • setting navis.config.add_units=True (default is False) will add units to certain neuron properties; this is a test balloon and could be extended/switched on by default
  • refactor read_nrrd, read_mesh and read_tiff to use BaseReader (allows reading from URLs and archives, parallel processing, etc)
  • related to above: BaseReader now understands patterns for searching directories (mostly for read_mesh)
  • all read_* function that use the reader now have an error parameter to determine what happens if file content can't be parsed
  • more options to process Dotprops:
    • navis.drop_fluff can now be used to remove dust or get the N largest connected components in Dotprops
    • read_nrrd and read_tiff now accept a thin parameter
    • navis.neuron2nx now works with Dotprops
  • TreeNeurons can now be initialised from a (vertices, edges) tuple (see also new navis.edge2neuron function)
  • new function: navis.thin_voxels uses scikit-image (optional dependency) to thin images to single-voxel width
  • new property: TreeNeuron.vertices gives quick, read-only access to node positions
  • new properties: VoxelNeuron.nnz and VoxelNeuron.density

TODOs

  • add tutorial on image transforms/registration
  • make navis.downsample_neuron use Poisson disk sampling for dotprops (implemented but not exposed yet - it's expensive)
  • look into whether we can make navis.skeletonize smarter for dotprops
  • add voxel2skeleton function for VoxelNeurons (using kimimaro) and wrap in navis.skeletonize

Important

This PR switches a number of ImportErrors to ModuleNotFoundErrors. For pykdtree on OSX that may mean that it fails to import if the wheel was compiled with OMP support but libomp is not installed. We for now pinned the pykdtree version.

- enable custom output formatting via dedicated method
- allow multiple file extensions via `file_ext` tuple/list
- add missing call to read_tar
- allow passing parallel as ('auto', threshold) tuple
- accept dotprops (see new `dp_dist` parameter)
- new parameter: `n_largest`
- VoxelNeuron.density = fraction of filled voxels
- VoxelNeuron.nnz = number of non-zero voxels
- VoxelNeuron.count_nonzero(): see above
@schlegelp schlegelp changed the title Improve image processing Various improvements Oct 8, 2024
@schlegelp schlegelp marked this pull request as ready for review October 9, 2024 13:31
@schlegelp schlegelp merged commit 488d975 into master Oct 9, 2024
21 checks passed
@schlegelp schlegelp deleted the read_nrrd branch October 9, 2024 13:31
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.

1 participant