Skip to content

utilities (query, mask, etc.)#148

Merged
HelenaLC merged 35 commits into
mainfrom
utils
Apr 9, 2026
Merged

utilities (query, mask, etc.)#148
HelenaLC merged 35 commits into
mainfrom
utils

Conversation

@HelenaLC
Copy link
Copy Markdown
Owner

@HelenaLC HelenaLC commented Apr 6, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates SpatialData’s query() utilities and their tests/docs, focusing on bounding-box subsetting across element types.

Changes:

  • Simplifies query() for ImageArray/LabelArray to direct array slicing and clamps xmax/ymax to object dimensions.
  • Reworks query() for ShapeFrame to use sf::st_crop() and updates tests accordingly.
  • Updates documentation/examples and adds sf::st_crop to imports.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
R/query.R Refactors query() methods (notably Image/Label/Shape) and adds bbox validation.
tests/testthat/test-query.R Updates expectations for new query behavior (esp. ShapeFrame, ImageArray transform assertions).
man/query.Rd Syncs generated docs/examples with updated method signatures.
NAMESPACE Adds sf::st_crop import to support ShapeFrame cropping.
Comments suppressed due to low confidence (1)

man/query.Rd:27

  • The Rd still documents j as a general argument (“index or name of coordinate space”), but query,ImageArray/LabelArray/ShapeFrame no longer accept j while query,PointFrame still requires it. Please update the argument documentation to reflect which methods accept/ignore j (or restore consistent method signatures) to avoid confusing users.
\S4method{query}{ImageArray}(x, ...)

\S4method{query}{LabelArray}(x, ...)

\S4method{query}{ShapeFrame}(x, ...)

\S4method{query}{PointFrame}(x, j, ...)
}
\arguments{
\item{x}{\code{SpatialData} element.}

\item{j}{scalar character or integer; index or name of coordinate space.}

\item{...}{optional arguments passed to and from other methods.}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/query.R Outdated
Comment thread NAMESPACE
Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

man/query.Rd:27

  • The Rd still documents argument j in the shared \arguments section, but the ImageArray and PointFrame method signatures in \usage no longer include j. This makes ?query misleading for those methods. Consider documenting j as SpatialData-only (or restoring j consistently across methods).
\arguments{
\item{x}{\code{SpatialData} element.}

\item{j}{scalar character or integer; index or name of coordinate space.}

\item{...}{optional arguments passed to and from other methods.}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/query.R
Comment thread R/query.R Outdated
Comment thread tests/testthat/test-query.R
Comment thread R/query.R Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

Comments suppressed due to low confidence (1)

man/query.Rd:28

  • The documentation still lists j as an argument for query() globally, but the ImageArray/PointFrame methods no longer accept j (per the updated \usage). This can confuse users about which methods support coordinate-space selection. Consider clarifying in the Rd (and/or roxygen) that j only applies to the SpatialData method (or reintroducing j consistently).
\arguments{
\item{x}{\code{SpatialData} element.}

\item{j}{scalar character or integer; index or name of coordinate space.}

\item{...}{optional arguments passed to and from other methods.}
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/query.R Outdated
Comment thread R/query.R
Comment thread R/query.R
Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Comment thread tests/testthat/test-query.R
Comment thread tests/testthat/test-query.R
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/query.R
Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Comment thread R/query.R
Comment thread tests/testthat/test-query.R
Comment thread R/query.R Outdated
Comment thread man/query.Rd Outdated
Comment thread R/query.R Outdated
@HelenaLC HelenaLC requested a review from Copilot April 8, 2026 10:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/mask.R Outdated
Comment thread R/mask.R Outdated
Comment thread R/mask.R Outdated
Comment thread man/mask.Rd Outdated
Comment thread man/query.Rd
Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Comment thread R/query.R Outdated
Comment thread R/AllGenerics.R
@HelenaLC HelenaLC merged commit 061bc3b into main Apr 9, 2026
4 checks passed
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.

2 participants