-
Notifications
You must be signed in to change notification settings - Fork 75
Addition of warnings about shells choices in FRF and FODF fit #1336
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
eeb99e3
Enhance user feedback: Add is_data_peaks heuristic and shell distance…
frheault 0c774a9
Merge branch 'master' of https://github.com/scilus/scilpy into split_…
frheault f4b16fa
Merge branch 'master' of https://github.com/scilus/scilpy into split_…
frheault 6d947be
Move frf warning and add peaks tests
frheault 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # -*- coding: utf-8 -*- | ||
| import os | ||
| import nibabel as nib | ||
| import numpy as np | ||
| from scilpy import SCILPY_HOME | ||
| from scilpy.io.fetcher import fetch_data, get_testing_files_dict | ||
| from scilpy.reconst.utils import is_data_peaks | ||
|
|
||
|
|
||
| def test_is_data_peaks_with_real_data(): | ||
| fetch_data(get_testing_files_dict(), keys=['processing.zip']) | ||
|
|
||
| processing_dir = os.path.join(SCILPY_HOME, 'processing') | ||
|
|
||
| # 1. Test with SH data (fODF) | ||
| sh_path = os.path.join(processing_dir, 'fodf_descoteaux07.nii.gz') | ||
| sh_data = nib.load(sh_path).get_fdata() | ||
| assert is_data_peaks(sh_data) is False, "Should identify SH data as False" | ||
|
|
||
| # 2. Test with Peaks data | ||
| peaks_path = os.path.join(processing_dir, 'peaks.nii.gz') | ||
| peaks_data = nib.load(peaks_path).get_fdata() | ||
| assert is_data_peaks( | ||
| peaks_data) is True, "Should identify Peaks data as True" | ||
|
|
||
|
|
||
| def test_is_data_peaks_with_edge_cases(): | ||
| # 3D data (e.g. 1 directions) | ||
| peaks_3d = np.random.rand(10, 10, 10, 3) | ||
| assert is_data_peaks(peaks_3d) is True | ||
|
|
||
| # SH data with order 4 (15 coefficients) but all zeros | ||
| sh_zeros = np.zeros((10, 10, 10, 15)) | ||
| assert is_data_peaks(sh_zeros) is False | ||
|
|
||
| # Data that is clearly peaks (multiple of 3, many zeros) | ||
| peaks_many_zeros = np.zeros((10, 10, 10, 9)) | ||
| peaks_many_zeros[5, 5, 5, :3] = [1, 0, 0] | ||
| assert is_data_peaks(peaks_many_zeros) is True |
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
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.
Uh oh!
There was an error while loading. Please reload this page.