Skip to content

Moved hd_bet to seperate file#179

Merged
neuronflow merged 7 commits intomainfrom
175-feature-move-hd-bet-to-separate-python-file
Apr 24, 2026
Merged

Moved hd_bet to seperate file#179
neuronflow merged 7 commits intomainfrom
175-feature-move-hd-bet-to-separate-python-file

Conversation

@nicmuenster
Copy link
Copy Markdown
Collaborator

Simply moved the hd_bet class to its own seperate file for overall consistency and adapted the imports accordingly.

@nicmuenster nicmuenster linked an issue Apr 23, 2026 that may be closed by this pull request
@brainless-bot
Copy link
Copy Markdown
Contributor

brainless-bot Bot commented Apr 23, 2026

🤖 Code Formatting Reminder

Hello there! 👋 It looks like the code in this pull request might benefit from some formatting improvements.
Fix the issues locally or use our auto format action by commenting /format on this PR!

Code style: black

1 similar comment
@brainless-bot
Copy link
Copy Markdown
Contributor

brainless-bot Bot commented Apr 23, 2026

🤖 Code Formatting Reminder

Hello there! 👋 It looks like the code in this pull request might benefit from some formatting improvements.
Fix the issues locally or use our auto format action by commenting /format on this PR!

Code style: black

@nicmuenster
Copy link
Copy Markdown
Collaborator Author

/format

@brainless-bot
Copy link
Copy Markdown
Contributor

brainless-bot Bot commented Apr 23, 2026

🤖 I will now format your code with black. Check the status here.

@neuronflow
Copy link
Copy Markdown
Collaborator

Brain extractor probably should also inherit from ABC, such as defacer. Shall we also include this fix in this PR, or make a separate PR for it?
https://github.com/BrainLesion/preprocessing/blob/main/brainles_preprocessing/defacing/defacer.py

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

This PR refactors the brain-extraction implementation by moving the HDBetExtractor implementation out of brain_extractor.py into a dedicated hd_bet.py module, and updates imports/exports accordingly for consistency.

Changes:

  • Move HDBetExtractor (and its Mode enum) into brainles_preprocessing/brain_extraction/hd_bet.py.
  • Update preprocessor.py to import HDBetExtractor from the new module.
  • Update brainles_preprocessing.brain_extraction package exports in __init__.py.

Reviewed changes

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

File Description
brainles_preprocessing/preprocessor/preprocessor.py Updates imports to reference HDBetExtractor from the new module.
brainles_preprocessing/brain_extraction/hd_bet.py New module containing the extracted HDBetExtractor implementation.
brainles_preprocessing/brain_extraction/brain_extractor.py Removes HDBetExtractor/Mode, leaving the base extractor utilities.
brainles_preprocessing/brain_extraction/init.py Adjusts package-level exports for brain extraction extractors.
Comments suppressed due to low confidence (1)

brainles_preprocessing/brain_extraction/brain_extractor.py:13

  • BrainExtractor decorates extract with @abstractmethod but the class does not inherit from ABC (or otherwise use ABCMeta), so Python will not enforce the method as abstract. If this is intended to be an interface/base class, consider changing it to class BrainExtractor(ABC) (and importing ABC); otherwise remove @abstractmethod to avoid giving a false sense of enforcement.
class BrainExtractor:
    @abstractmethod
    def extract(
        self,
        input_image_path: Union[str, Path],

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

@@ -1 +1,2 @@
from .brain_extractor import HDBetExtractor
from .hd_bet import HDBetExtractor
from .synthstrip import SynthStripExtractor
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should this be inluded?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

just saw that Synthstrip is also a fully optional and not a dependency, then yes, from my understanding this change makes sense, i will update the code

@neuronflow
Copy link
Copy Markdown
Collaborator

@nicmuenster please have a look at comments

@MarcelRosier
Copy link
Copy Markdown
Collaborator

ABC inheritance is reasonable, otherwise lgtm

Copy link
Copy Markdown
Collaborator

@neuronflow neuronflow left a comment

Choose a reason for hiding this comment

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

please include ABC inheritance (see comments above)

@nicmuenster nicmuenster requested a review from neuronflow April 24, 2026 08:51
@brainless-bot
Copy link
Copy Markdown
Contributor

brainless-bot Bot commented Apr 24, 2026

🤖 Code Formatting Reminder

Hello there! 👋 It looks like the code in this pull request might benefit from some formatting improvements.
Fix the issues locally or use our auto format action by commenting /format on this PR!

Code style: black

@nicmuenster
Copy link
Copy Markdown
Collaborator Author

/format

@brainless-bot
Copy link
Copy Markdown
Contributor

brainless-bot Bot commented Apr 24, 2026

🤖 I will now format your code with black. Check the status here.

@neuronflow neuronflow merged commit fe61b1d into main Apr 24, 2026
4 of 5 checks passed
@neuronflow neuronflow deleted the 175-feature-move-hd-bet-to-separate-python-file branch April 24, 2026 12:51
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.

[FEATURE] move HD-BET to separate Python file

4 participants