code: def test_nilearn_standardize(
      tmp_path, standardize_signal, standardize_confounds, detrend
  ):
      """Test confounds removal with logical parameters for processing signal."""
      # demean is set to False to let signal.clean handle everything
      (img, mask_conf, mask_rand, confounds, mask) = _simu_img(
          tmp_path, demean=False
      )
      # We now load the time series with vs without confounds
      # in voxels composed of pure confounds
      # the correlation before and after denoising should be very low
      # as most of the variance is removed by denoising
      tseries_raw, tseries_clean = _denoise(
          img,
          mask_conf,
          confounds,
          mask,
          standardize_signal=standardize_signal,
          standardize_confounds=standardize_confounds,
          detrend=detrend,
      )
      corr = _corr_tseries(tseries_raw, tseries_clean)
      assert np.absolute(np.mean(corr)) < 0.2
  
      # We now load the time series with zscore standardization
      # with vs without confounds in voxels where the signal is uncorrelated
      # with confounds. The correlation before and after denoising should be very
      # high as very little of the variance is removed by denoising
      tseries_raw, tseries_clean = _denoise(
          img,
          mask_rand,
          confounds,
          mask,
          standardize_signal=standardize_signal,
          standardize_confounds=standardize_confounds,
          detrend=detrend,
      )
      corr = _corr_tseries(tseries_raw, tseries_clean)
      assert corr.mean() > 0.8
  
imports: import re
  import numpy
  import pandas
  import pytest
  from nibabel import Nifti1Image
  from scipy.stats import pearsonr
  from sklearn.preprocessing import scale
  from nilearn._utils.data_gen import create_fake_bids_dataset
  from nilearn._utils.fmriprep_confounds import to_camel_case
  from nilearn.conftest import _rng
  from nilearn.interfaces.bids import get_bids_files
  from nilearn.interfaces.fmriprep import load_confounds
  from nilearn.interfaces.fmriprep.load_confounds import _check_strategy, _load_single_confounds_file
  from nilearn.interfaces.fmriprep.tests._testing import create_tmp_filepath, get_legal_confound
  from nilearn.maskers import NiftiMasker
label_desc: Use image node_id 9 for calling a global function with example usage: test_nilearn_standardize(tmp_path, standardize_signal, standardize_confounds, detrend) without return types