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

Introduce basic classes for regions of interest #396

Merged
merged 15 commits into from
Feb 4, 2025
Merged

Conversation

willGraham01
Copy link
Contributor

@willGraham01 willGraham01 commented Jan 31, 2025

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

A first step towards addressing #377 - introduces the low-level classes that we will need to represent these in the codebase.

As stated on the issue, we have to use wrapper classes since inheriting from shapely classes is problematic. This doesn't really matter too much though - if anything, it is rather helpful for separating the underlying (and rather counter-intuitive at times) shapely objects from the higher-level analysis functions that we're going to implement.

What does this PR do?

  • Introduces the roi submodule, which contains a base class and two derived classes for representing RoIs.

References

#377

How has this PR been tested?

Addition of tests to the testing suite.
Docs successfully build.

Is this a breaking change?

No

Does this PR require an update to the documentation?

  • Debated this, but decided we should hold off adding an example until we at least have some additional functionality to do something with these objects!

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

This comment was marked as resolved.

@willGraham01 willGraham01 mentioned this pull request Jan 31, 2025
7 tasks
@willGraham01 willGraham01 marked this pull request as ready for review January 31, 2025 14:29
@willGraham01 willGraham01 requested a review from niksirbi January 31, 2025 14:30
Copy link
Member

@niksirbi niksirbi left a comment

Choose a reason for hiding this comment

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

Thank for this work @willGraham01, you are making a long-time goal of ours come true!

I am happy with the overall wrapping approach taken here, but I've added some comments/clarifications having to do with the naming of some arguments/properties.

Other than that, perhaps it's worth modifying __init__.py so that we can do:

from movement.roi import LineOfInterest, PolygonOfInterest

instead of the more verbose alternative?

from movement.roi.line import LineOfInterest
from movement.roi.polygon import PolygonOfInterest

pyproject.toml Outdated Show resolved Hide resolved
movement/roi/base.py Outdated Show resolved Hide resolved
movement/roi/polygon.py Outdated Show resolved Hide resolved
movement/roi/line.py Outdated Show resolved Hide resolved
movement/roi/polygon.py Outdated Show resolved Hide resolved
movement/roi/polygon.py Outdated Show resolved Hide resolved
movement/roi/polygon.py Outdated Show resolved Hide resolved
tests/test_unit/test_roi/conftest.py Outdated Show resolved Hide resolved
movement/roi/polygon.py Outdated Show resolved Hide resolved
movement/roi/base.py Outdated Show resolved Hide resolved
movement/roi/base.py Outdated Show resolved Hide resolved
@neuroinformatics-unit neuroinformatics-unit deleted a comment from sonarqubecloud bot Feb 4, 2025
@willGraham01
Copy link
Contributor Author

@niksirbi All comments addressed except this discussion - this is quite important as it's user-facing so wanted to give you a chance to object to my resolution before I hit merge.

If all looks good after that, feel free to press the button!

@niksirbi
Copy link
Member

niksirbi commented Feb 4, 2025

@niksirbi All comments addressed except this discussion - this is quite important as it's user-facing so wanted to give you a chance to object to my resolution before I hit merge.

If all looks good after that, feel free to press the button!

@willGraham01 I'm fine with your resolution, just added a tiny suggestion on docstring wording. Feel free to merge after that.

Co-authored-by: Niko Sirmpilatze <niko.sirbiladze@gmail.com>

This comment was marked as resolved.

@willGraham01 willGraham01 added this pull request to the merge queue Feb 4, 2025
Merged via the queue into main with commit 4fd9366 Feb 4, 2025
28 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