Skip to content

Commit

Permalink
remove psc as an option for standardising output (#113)
Browse files Browse the repository at this point in the history
* remove psc as an option for standardising output, leaving zscore the only behaviour so removing the parameter all together

* some missing files

* remove analysis level
  • Loading branch information
htwangtw authored Mar 25, 2024
1 parent e303c9f commit 6f1184f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 31 deletions.
8 changes: 4 additions & 4 deletions giga_connectome/denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def is_ica_aroma(strategy: STRATEGY_TYPE) -> bool:
def denoise_nifti_voxel(
strategy: STRATEGY_TYPE,
group_mask: str | Path,
standardize: str | bool,
standardize: bool,
smoothing_fwhm: float,
img: str,
) -> Nifti1Image:
Expand All @@ -120,9 +120,9 @@ def denoise_nifti_voxel(
Denoising strategy parameter to pass to load_confounds_strategy.
group_mask : str | Path
Path to the group mask.
standardize : str | bool
Standardize the data. If 'zscore', zscore the data. If 'psc', convert
the data to percent signal change. If False, do not standardize.
standardize : bool
Standardize the data. If True, zscore the data. If False, do \
not standardize.
smoothing_fwhm : float
Smoothing kernel size in mm.
img : str
Expand Down
8 changes: 4 additions & 4 deletions giga_connectome/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run_postprocessing_dataset(
resampled_atlases: Sequence[str | Path],
images: Sequence[BIDSImageFile],
group_mask: str | Path,
standardize: str | bool,
standardize: bool,
smoothing_fwhm: float,
output_path: Path,
calculate_average_correlation: bool = False,
Expand Down Expand Up @@ -77,9 +77,9 @@ def run_postprocessing_dataset(
group_mask : str or pathlib.Path
Group level grey matter mask.
standardize : str or bool
Standardization options used in nilearn, passed to nilearn masker.
Options: True, False, "psc"
standardize : bool
Standardization to zscore or not used in nilearn, passed to nilearn \
masker.
smoothing_fwhm : float
Smoothing kernel size, passed to nilearn masker.
Expand Down
7 changes: 0 additions & 7 deletions giga_connectome/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,6 @@ def global_parser() -> argparse.ArgumentParser:
"is 'simple'.",
default="simple",
)
parser.add_argument(
"--standardize",
help="The choice of signal standardization. The choices are z score "
"or percent signal change (psc). The default is 'zscore'.",
choices=["zscore", "psc"],
default="zscore",
)
parser.add_argument(
"--smoothing_fwhm",
help="Size of the full-width at half maximum in millimeters of "
Expand Down
2 changes: 0 additions & 2 deletions giga_connectome/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ def test_smoke(tmp_path, capsys):
"Schaefer20187Networks",
"--denoise-strategy",
"simple",
"--standardize",
"zscore",
"--reindex-bids",
"--calculate-intranetwork-average-correlation",
str(bids_dir),
Expand Down
6 changes: 0 additions & 6 deletions giga_connectome/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,3 @@ def test_get_subject_lists():
)
assert len(subjects) == 1
assert subjects[0] == "01"


def test_parse_standardize_options():
with pytest.raises(ValueError) as msg:
utils.parse_standardize_options(True)
assert "True is not a" in str(msg.value)
6 changes: 0 additions & 6 deletions giga_connectome/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,6 @@ def parse_bids_filter(value: Path) -> None | dict[str, dict[str, str]]:
return tmp


def parse_standardize_options(standardize: str) -> str | bool:
if standardize not in ["zscore", "psc"]:
raise ValueError(f"{standardize} is not a valid standardize strategy.")
return standardize if standardize == "psc" else True


def parse_bids_name(img: str) -> tuple[str, str | None, str]:
"""Get subject, session, and specifier for a fMRIPrep output."""
reference = parse_bids_filename(img)
Expand Down
4 changes: 2 additions & 2 deletions giga_connectome/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def workflow(args: argparse.Namespace) -> None:
bids_dir = args.bids_dir
output_dir = args.output_dir
working_dir = args.work_dir
standardize = utils.parse_standardize_options(args.standardize)
standardize = True # always standardising the time series
smoothing_fwhm = args.smoothing_fwhm
calculate_average_correlation = (
args.calculate_intranetwork_average_correlation
Expand Down Expand Up @@ -71,7 +71,7 @@ def workflow(args: argparse.Namespace) -> None:
output_dir=output_dir,
atlas=atlas["name"],
smoothing_fwhm=smoothing_fwhm,
standardize=args.standardize,
standardize="zscore",
strategy=args.denoise_strategy,
mni_space=template,
average_correlation=calculate_average_correlation,
Expand Down

0 comments on commit 6f1184f

Please sign in to comment.