Skip to content

feat: Expand functionality of clip*-utilities#48

Merged
uermel merged 2 commits intomainfrom
uermel/invert_clip
Feb 27, 2026
Merged

feat: Expand functionality of clip*-utilities#48
uermel merged 2 commits intomainfrom
uermel/invert_clip

Conversation

@uermel
Copy link
Member

@uermel uermel commented Feb 26, 2026

Add Tomogram Boundary Reference and Invert Flag to clip* Commands

Summary

  • Add --ref-tomogram / -rt option to use tomogram volume boundaries as a reference surface for distance-based filtering
  • Add --invert / --no-invert flag to all clip commands to control filtering direction
  • Apply to all three clip commands: clippicks, clipseg, clipmesh

Motivation

Picks, segmentations, and meshes near tomogram edges are often unreliable due to:

  • Missing wedge artifacts
  • Edge effects from reconstruction
  • Incomplete data at volume boundaries

This feature enables filtering out data within a specified distance from any tomogram boundary, improving data quality for downstream analysis.

New Options

--ref-tomogram / -rt

  • Uses tomogram volume boundaries (6 faces of the bounding box) as the reference surface
  • URI format: tomo_type@voxel_spacing (e.g., wbp@10.0)
  • Mutually exclusive with --ref-mesh and --ref-seg

--invert / --no-invert

  • Controls filtering direction for ALL reference types (mesh, segmentation, and tomogram)
  • Default (--no-invert): Keep data within max_distance of reference
  • With --invert: Keep data beyond max_distance of reference

Usage Examples

# Keep picks within 50Å of mesh reference (default behavior)
copick logical clippicks -i "ribosome:user1/all-001" \
  -rm "membrane:user1/boundary-001" \
  -o "ribosome:clippicks/near-001" \
  --max-distance 50.0

# Remove picks within 50Å of tomogram boundary (common use case for edge filtering)
copick logical clippicks -i "ribosome:user1/all-001" \
  -rt "wbp@10.0" \
  -o "ribosome:clippicks/interior-001" \
  --max-distance 50.0 --invert

# Keep only edge picks (within 50Å of tomogram boundary)
copick logical clippicks -i "ribosome:user1/all-001" \
  -rt "wbp@10.0" \
  -o "ribosome:clippicks/edge-001" \
  --max-distance 50.0

# Same patterns work for clipseg and clipmesh
copick logical clipseg -i "membrane:user1/full-001@10.0" \
  -rt "wbp@10.0" \
  -o "membrane:clipseg/interior-001@10.0" \
  --max-distance 50.0 --invert

@uermel uermel merged commit 0e2ffb1 into main Feb 27, 2026
2 checks passed
uermel pushed a commit that referenced this pull request Feb 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.4.0](copick-utils-v1.3.0...copick-utils-v1.4.0)
(2026-02-27)


### ✨ Features

* Expand functionality of clip*-utilities
([#48](#48))
([0e2ffb1](0e2ffb1))

---
Merging this PR will release copick-utils on PyPI.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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