-
Notifications
You must be signed in to change notification settings - Fork 52
Add more integration tests for run_nifti_insertion.py #1266
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
Merged
cmadjar
merged 25 commits into
aces:main
from
cmadjar:run_nifti_insertion_integration_test_part_2
Apr 14, 2025
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
601d3b9
add exclude violation insertion
cmadjar 07fe463
fix type check
cmadjar e5421da
add bids support for DWI65
cmadjar 05f0152
add bids support for DWI65
cmadjar 5bc643a
fix error message
cmadjar 6a85f5a
add proper series uid etc to query the violations_log
cmadjar d38c8ba
add proper series uid etc to query the violations_log
cmadjar a7873d5
add proper series uid etc to query the violations_log
cmadjar dc62baf
change violations log return to list
cmadjar 6202753
change violations log return to list
cmadjar e0b6056
change violations log return to list
cmadjar b68d3d1
fix tests
cmadjar 2c87b26
fix tests
cmadjar 6fc3840
fix tests
cmadjar b538085
fix tests
cmadjar 49879b4
fix tests
cmadjar a9a0005
fix tests
cmadjar 7dccf3b
fix tests
cmadjar edba1a0
fix tests
cmadjar b2ffb5e
fix tests
cmadjar feb3b3d
fix tests
cmadjar 7ae3436
fix tests
cmadjar 4167d88
fix creation of pic only when --create_pic option is turned on
cmadjar 6b8c601
fix creation of pic only when --create_pic option is turned on
cmadjar 7ae5828
Maxime's feedback
cmadjar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
...db/queries/mri_protocol_violated_scans.py → .../db/queries/mri_protocol_violated_scan.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
from collections.abc import Sequence | ||
|
||
from sqlalchemy import select | ||
from sqlalchemy.orm import Session as Database | ||
|
||
from lib.db.models.mri_protocol_violated_scan import DbMriProtocolViolatedScan | ||
|
||
|
||
def try_get_protocol_violated_scans_with_unique_series_combination( | ||
def get_protocol_violated_scans_with_unique_series_combination( | ||
db: Database, | ||
series_uid: str, | ||
echo_time: str | None, | ||
echo_number: str | None, | ||
phase_encoding_direction: str | None | ||
) -> DbMriProtocolViolatedScan | None: | ||
) -> Sequence[DbMriProtocolViolatedScan]: | ||
""" | ||
Get the protocol violated scans from the database using its SeriesInstanceUID, or return `None` if | ||
no protocol violated scan was found. | ||
Get all protocol violated scans from the database using the file's SeriesInstanceUID, | ||
echo time, echo number and phase encoding direction. | ||
""" | ||
|
||
return db.execute(select(DbMriProtocolViolatedScan) | ||
.where(DbMriProtocolViolatedScan.series_uid == series_uid) | ||
.where(DbMriProtocolViolatedScan.te_range == echo_time) | ||
.where(DbMriProtocolViolatedScan.echo_number == echo_number) | ||
.where(DbMriProtocolViolatedScan.phase_encoding_direction == phase_encoding_direction) | ||
).scalar_one_or_none() | ||
).scalars().all() |
12 changes: 7 additions & 5 deletions
12
python/lib/db/queries/mri_violations_log.py → python/lib/db/queries/mri_violation_log.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
from collections.abc import Sequence | ||
|
||
from sqlalchemy import select | ||
from sqlalchemy.orm import Session as Database | ||
|
||
from lib.db.models.mri_violation_log import DbMriViolationLog | ||
|
||
|
||
def try_get_violations_log_with_unique_series_combination( | ||
def get_violations_log_with_unique_series_combination( | ||
db: Database, | ||
series_uid: str, | ||
echo_time: str | None, | ||
echo_number: str | None, | ||
phase_encoding_direction: str | None | ||
) -> DbMriViolationLog | None: | ||
) -> Sequence[DbMriViolationLog]: | ||
""" | ||
Get the violations log from the database using its SeriesInstanceUID, or return `None` if | ||
no violations log was found. | ||
Get all violations log from the database using the file's SeriesInstanceUID, | ||
echo time, echo number and phase encoding direction. | ||
""" | ||
|
||
return db.execute(select(DbMriViolationLog) | ||
.where(DbMriViolationLog.series_uid == series_uid) | ||
.where(DbMriViolationLog.echo_time == echo_time) | ||
.where(DbMriViolationLog.echo_number == echo_number) | ||
.where(DbMriViolationLog.phase_encoding_direction == phase_encoding_direction) | ||
).scalar_one_or_none() | ||
).scalars().all() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bug found when implementing the tests 🥳