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

Adding participants exclusions in narps_open_runner #194

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -95,6 +95,7 @@ Finally, you are able to use the scripts of the project :

* `narps_open_runner`: run pipelines
* `narps_open_tester`: run a pipeline and test its results against original ones from the team
* `narps_open_correlations`: compute and display correlation between results and original ones from the team
* `narps_description`: get the textual description made by a team
* `narps_results`: download the original results from teams
* `narps_open_status`: get status information about the development process of the pipelines
@@ -107,6 +108,10 @@ narps_open_runner -t 2T6S -n 40
# and produces a report with correlation values.
narps_open_tester -t 08MQ

# Compute the correlation values between results of 2T6S reproduction on 60 subjects with original ones
# WARNING : 2T6S must have been previously computed with a group of 60 subjects
narps_open_correlations -t 2T6S -n 60

# Get the description of team C88N in markdown formatting
narps_description -t C88N --md

@@ -121,6 +126,7 @@ narps_open_status --json
> For further information about these command line tools, read the corresponding documentation pages.
> * `narps_open_runner` : [docs/running.md](docs/running.md)
> * `narps_open_tester` : [docs/testing.md](docs/testing.md#command-line-tool)
> * `narps_open_correlations` : [docs/correlation.md](docs/correlation.md#command-line-tool)
> * `narps_description` : [docs/description.md](docs/description.md)
> * `narps_results` : [docs/data.md](docs/data.md#results-from-narps-teams)
> * `narps_open_status` : [docs/status.md](docs/status.md)
File renamed without changes.
53 changes: 53 additions & 0 deletions narps_open/utils/correlation/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/python
# coding: utf-8

""" A command line tool for the narps_open.utils.correlation module """

from os.path import join
from argparse import ArgumentParser

from narps_open.data.results import ResultsCollection
from narps_open.utils.configuration import Configuration
from narps_open.utils.correlation import get_correlation_coefficient
from narps_open.pipelines import get_implemented_pipelines
from narps_open.runner import PipelineRunner

def main():
""" Entry-point for the command line tool narps_open_correlations """

# Parse arguments
parser = ArgumentParser(description = 'Compare reproduced files to original results.')
parser.add_argument('-t', '--team', type = str, required = True,
help = 'the team ID', choices = get_implemented_pipelines())
parser.add_argument('-s', '--subjects', type = int, required = True,
help = 'number of subjects in the group analysis')
arguments = parser.parse_args()

# Initialize pipeline
runner = PipelineRunner(arguments.team)
runner.pipeline.directories.dataset_dir = Configuration()['directories']['dataset']
runner.pipeline.directories.results_dir = Configuration()['directories']['reproduced_results']
runner.pipeline.directories.set_output_dir_with_team_id(arguments.team)
runner.pipeline.directories.set_working_dir_with_team_id(arguments.team)
runner.nb_subjects = arguments.subjects

# Indices and keys to the unthresholded maps
indices = list(range(1, 18, 2))

# Retrieve the paths to the reproduced files
reproduced_files = runner.pipeline.get_hypotheses_outputs()
reproduced_files = [reproduced_files[i] for i in indices]

# Retrieve the paths to the results files
collection = ResultsCollection(arguments.team)
file_keys = [f'hypo{h}_unthresh.nii.gz' for h in range(1,10)]
results_files = [join(collection.directory, k) for k in file_keys]

# Compute the correlation coefficients
print([
get_correlation_coefficient(reproduced_file, results_file)
for reproduced_file, results_file in zip(reproduced_files, results_files)
])

if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -71,6 +71,7 @@
'narps_open_runner = narps_open.runner:main',
'narps_open_tester = narps_open.tester:main',
'narps_open_status = narps_open.utils.status:main',
'narps_open_correlations = narps_open.utils.correlation.__main__:main',
'narps_description = narps_open.data.description.__main__:main',
'narps_results = narps_open.data.results.__main__:main'
]