.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/run_ets_rss_marker.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_run_ets_rss_marker.py: Extracting root sum of squares from edge-wise timeseries. ========================================================= This example uses a ``RSSETSMarker`` to compute root sum of squares of the edge-wise timeseries using the Schaefer parcellation (100 rois and 200 rois, 17 Yeo networks) for a 4D nifti BOLD file. Authors: Leonard Sasse, Sami Hamdan, Nicolas Nieto, Synchon Mandal License: BSD 3 clause .. GENERATED FROM PYTHON SOURCE LINES 14-23 .. code-block:: Python import tempfile import junifer.testing.registry # noqa: F401 from junifer.api import collect, run from junifer.storage import SQLiteFeatureStorage from junifer.utils import configure_logging .. GENERATED FROM PYTHON SOURCE LINES 24-25 Set the logging level to info to see extra information: .. GENERATED FROM PYTHON SOURCE LINES 25-27 .. code-block:: Python configure_logging(level="INFO") .. rst-class:: sphx-glr-script-out .. code-block:: none 2024-07-22 09:34:09,316 - JUNIFER - INFO - ===== Lib Versions ===== 2024-07-22 09:34:09,316 - JUNIFER - INFO - numpy: 1.26.4 2024-07-22 09:34:09,316 - JUNIFER - INFO - scipy: 1.14.0 2024-07-22 09:34:09,316 - JUNIFER - INFO - pandas: 2.1.4 2024-07-22 09:34:09,316 - JUNIFER - INFO - nilearn: 0.10.4 2024-07-22 09:34:09,316 - JUNIFER - INFO - nibabel: 5.2.1 2024-07-22 09:34:09,316 - JUNIFER - INFO - junifer: 0.0.5 2024-07-22 09:34:09,316 - JUNIFER - INFO - ======================== .. GENERATED FROM PYTHON SOURCE LINES 28-29 Define the DataGrabber interface .. GENERATED FROM PYTHON SOURCE LINES 29-33 .. code-block:: Python datagrabber = { "kind": "SPMAuditoryTestingDataGrabber", } .. GENERATED FROM PYTHON SOURCE LINES 34-35 Define the markers interface .. GENERATED FROM PYTHON SOURCE LINES 35-48 .. code-block:: Python markers = [ { "name": "Schaefer100x17_RSSETS", "kind": "RSSETSMarker", "parcellation": "Schaefer100x17", }, { "name": "Schaefer200x17_RSSETS", "kind": "RSSETSMarker", "parcellation": "Schaefer200x17", }, ] .. GENERATED FROM PYTHON SOURCE LINES 49-51 Create a temporary directory for junifer feature extraction: At the end you can read the extracted data into a ``pandas.DataFrame``. .. GENERATED FROM PYTHON SOURCE LINES 51-75 .. code-block:: Python with tempfile.TemporaryDirectory() as tmpdir: # Define the storage interface storage = { "kind": "SQLiteFeatureStorage", "uri": f"{tmpdir}/test.sqlite", } # Run the defined junifer feature extraction pipeline run( workdir=tmpdir, datagrabber=datagrabber, markers=markers, storage=storage, elements=["sub001"], # we calculate for one subject only ) # Collect extracted features data collect(storage=storage) # Create storage object to read in extracted features db = SQLiteFeatureStorage(uri=storage["uri"]) # List all the features print(db.list_features()) # Read extracted features df_rssets = db.read_df(feature_name="BOLD_Schaefer200x17_RSSETS_rss_ets") .. rst-class:: sphx-glr-script-out .. code-block:: none 2024-07-22 09:34:09,317 - JUNIFER - INFO - Validating Marker Collection 2024-07-22 09:34:09,317 - JUNIFER - INFO - DataGrabber output type: ['BOLD', 'T1w'] 2024-07-22 09:34:09,317 - JUNIFER - INFO - Validating Data Reader: 2024-07-22 09:34:09,317 - JUNIFER - INFO - Data Reader output type: ['BOLD', 'T1w'] 2024-07-22 09:34:09,317 - JUNIFER - INFO - Validating Marker: Schaefer100x17_RSSETS 2024-07-22 09:34:09,317 - JUNIFER - INFO - Marker output type: ['timeseries'] 2024-07-22 09:34:09,317 - JUNIFER - INFO - Validating storage for Schaefer100x17_RSSETS 2024-07-22 09:34:09,317 - JUNIFER - INFO - Validating Marker: Schaefer200x17_RSSETS 2024-07-22 09:34:09,317 - JUNIFER - INFO - Marker output type: ['timeseries'] 2024-07-22 09:34:09,317 - JUNIFER - INFO - Validating storage for Schaefer200x17_RSSETS 2024-07-22 09:34:09,317 - JUNIFER - INFO - Getting element sub001 2024-07-22 09:34:11,800 - JUNIFER - INFO - Fitting pipeline 2024-07-22 09:34:11,800 - JUNIFER - INFO - Reading BOLD from /tmp/tmppk79ft4n/sub001_bold.nii.gz 2024-07-22 09:34:11,800 - JUNIFER - INFO - BOLD is of type NIFTI 2024-07-22 09:34:11,801 - JUNIFER - INFO - Reading T1w from /tmp/tmppk79ft4n/sub001_T1w.nii.gz 2024-07-22 09:34:11,801 - JUNIFER - INFO - T1w is of type NIFTI 2024-07-22 09:34:11,802 - JUNIFER - INFO - Fitting marker Schaefer100x17_RSSETS 2024-07-22 09:34:11,802 - JUNIFER - INFO - Computing BOLD 2024-07-22 09:34:11,802 - JUNIFER - INFO - Fetching one of Schaefer parcellations. 2024-07-22 09:34:11,802 - JUNIFER - INFO - Parcellation parameters: 2024-07-22 09:34:11,802 - JUNIFER - INFO - resolution: 3.0 2024-07-22 09:34:11,802 - JUNIFER - INFO - n_rois: 100 2024-07-22 09:34:11,802 - JUNIFER - INFO - yeo_networks: 17 2024-07-22 09:34:11,802 - JUNIFER - INFO - At least one of the parcellation files are missing. Fetching using nilearn. Downloading data from https://raw.githubusercontent.com/ThomasYeoLab/CBIG/v0.14.3-Update_Yeo2011_Schaefer2018_labelname/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/MNI/Schaefer2018_100Parcels_17Networks_order.txt ... ...done. (0 seconds, 0 min) Downloading data from https://raw.githubusercontent.com/ThomasYeoLab/CBIG/v0.14.3-Update_Yeo2011_Schaefer2018_labelname/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/MNI/Schaefer2018_100Parcels_17Networks_order_FSLMNI152_2mm.nii.gz ... ...done. (0 seconds, 0 min) 2024-07-22 09:34:12,039 - JUNIFER - INFO - Loading parcellation /home/runner/junifer/data/parcellations/schaefer_2018/Schaefer2018_100Parcels_17Networks_order_FSLMNI152_2mm.nii.gz 2024-07-22 09:34:12,068 - JUNIFER - INFO - Found existing xfm file for MNI152NLin6Asym to MNI152Lin at /home/runner/junifer/data/xfms/MNI152NLin6Asym_to_MNI152Lin/MNI152NLin6Asym_to_MNI152Lin_Composite.h5 2024-07-22 09:34:13,148 - JUNIFER - INFO - Downloading template MNI152Lin in resolution 2 2024-07-22 09:34:13,245 - JUNIFER - INFO - antsApplyTransforms command to be executed: antsApplyTransforms -d 3 -e 3 -n 'GenericLabel[NearestNeighbor]' -i /tmp/tmpcysmnw4q/parcellationspeollnod/Schaefer100x17.nii.gz -r /tmp/tmpcysmnw4q/parcellationspeollnod/MNI152Lin_T1w_3.0.nii.gz -t /home/runner/junifer/data/xfms/MNI152NLin6Asym_to_MNI152Lin/MNI152NLin6Asym_to_MNI152Lin_Composite.h5 -o /tmp/tmplulp04im/parcellations9342xgdy/Schaefer100x17_warped_from_MNI152NLin6Asym_to_MNI152Lin.nii.gz 2024-07-22 09:34:14,640 - JUNIFER - INFO - antsApplyTransforms command succeeded with the following output: b'' 2024-07-22 09:34:17,356 - JUNIFER - INFO - Storing in 2024-07-22 09:34:17,372 - JUNIFER - INFO - Fitting marker Schaefer200x17_RSSETS 2024-07-22 09:34:17,373 - JUNIFER - INFO - Computing BOLD 2024-07-22 09:34:17,373 - JUNIFER - INFO - Fetching one of Schaefer parcellations. 2024-07-22 09:34:17,373 - JUNIFER - INFO - Parcellation parameters: 2024-07-22 09:34:17,373 - JUNIFER - INFO - resolution: 3.0 2024-07-22 09:34:17,373 - JUNIFER - INFO - n_rois: 200 2024-07-22 09:34:17,373 - JUNIFER - INFO - yeo_networks: 17 2024-07-22 09:34:17,373 - JUNIFER - INFO - At least one of the parcellation files are missing. Fetching using nilearn. Downloading data from https://raw.githubusercontent.com/ThomasYeoLab/CBIG/v0.14.3-Update_Yeo2011_Schaefer2018_labelname/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/MNI/Schaefer2018_200Parcels_17Networks_order.txt ... ...done. (0 seconds, 0 min) Downloading data from https://raw.githubusercontent.com/ThomasYeoLab/CBIG/v0.14.3-Update_Yeo2011_Schaefer2018_labelname/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/MNI/Schaefer2018_200Parcels_17Networks_order_FSLMNI152_2mm.nii.gz ... ...done. (0 seconds, 0 min) 2024-07-22 09:34:17,603 - JUNIFER - INFO - Loading parcellation /home/runner/junifer/data/parcellations/schaefer_2018/Schaefer2018_200Parcels_17Networks_order_FSLMNI152_2mm.nii.gz 2024-07-22 09:34:17,634 - JUNIFER - INFO - Found existing xfm file for MNI152NLin6Asym to MNI152Lin at /home/runner/junifer/data/xfms/MNI152NLin6Asym_to_MNI152Lin/MNI152NLin6Asym_to_MNI152Lin_Composite.h5 2024-07-22 09:34:18,715 - JUNIFER - INFO - Downloading template MNI152Lin in resolution 2 2024-07-22 09:34:18,812 - JUNIFER - INFO - antsApplyTransforms command to be executed: antsApplyTransforms -d 3 -e 3 -n 'GenericLabel[NearestNeighbor]' -i /tmp/tmpcysmnw4q/parcellations0cvgdcaf/Schaefer200x17.nii.gz -r /tmp/tmpcysmnw4q/parcellations0cvgdcaf/MNI152Lin_T1w_3.0.nii.gz -t /home/runner/junifer/data/xfms/MNI152NLin6Asym_to_MNI152Lin/MNI152NLin6Asym_to_MNI152Lin_Composite.h5 -o /tmp/tmplulp04im/parcellationsvqt575w5/Schaefer200x17_warped_from_MNI152NLin6Asym_to_MNI152Lin.nii.gz 2024-07-22 09:34:20,844 - JUNIFER - INFO - antsApplyTransforms command succeeded with the following output: b'' 2024-07-22 09:34:22,926 - JUNIFER - INFO - Storing in 2024-07-22 09:34:22,944 - JUNIFER - INFO - Marker collection fitting done 2024-07-22 09:34:22,946 - JUNIFER - INFO - Collecting data using SQLiteFeatureStorage 2024-07-22 09:34:22,946 - JUNIFER - INFO - Collecting data from /tmp/tmp4gpkm5vv/*test.sqlite file: 0it [00:00, ?it/s] feature: 0%| | 0/2 [00:00
root_sum_of_squares_ets
subject timepoint
sub001 0 2573.381785
1 168.936589
2 105.181375
3 138.333536
4 114.516663


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 13.686 seconds) .. _sphx_glr_download_auto_examples_run_ets_rss_marker.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: run_ets_rss_marker.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: run_ets_rss_marker.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_