diff --git a/data_processing.ipynb b/data_processing.ipynb index 6093aab..23805ee 100644 --- a/data_processing.ipynb +++ b/data_processing.ipynb @@ -309,16 +309,16 @@ "\n", "for subject in subjects:\n", " os.chdir(os.path.join(path_data, subject, \"anat\"))\n", - " for shim_method in shim_modes:\n", + " for shim_mode in shim_modes:\n", " # Shim methods are registered to the CoV T2starw scan, so we need to use the added suffix to identify them\n", - " if shim_method == 'CoV':\n", + " if shim_mode == 'CoV':\n", " file_suffix = 'crop'\n", " else:\n", " file_suffix = 'reg'\n", - " fname_result_sc = os.path.join(path_results, f\"{subject}_acq-{shim_method}_T2starw_label-SC.csv\")\n", - " !sct_extract_metric -i {subject}_acq-{shim_method}_T2starw_{file_suffix}.nii.gz -f {subject}_acq-CoV_T2starw_crop_seg.nii.gz -method wa -vert 3:9 -vertfile {subject}_acq-CoV_T2starw_crop_seg_labeled.nii.gz -perslice 1 -o {fname_result_sc}\n", - " fname_result_csf = os.path.join(path_results, f\"{subject}_acq-{shim_method}_T2starw_label-CSF.csv\")\n", - " !sct_extract_metric -i {subject}_acq-{shim_method}_T2starw_{file_suffix}.nii.gz -f {subject}_acq-CoV_T2starw_crop_label-CSF_seg.nii.gz -method wa -vert 3:9 -vertfile {subject}_acq-CoV_T2starw_crop_seg_labeled.nii.gz -perslice 1 -o {fname_result_csf}" + " fname_result_sc = os.path.join(path_results, f\"{subject}_acq-{shim_mode}_T2starw_label-SC.csv\")\n", + " !sct_extract_metric -i {subject}_acq-{shim_mode}_T2starw_{file_suffix}.nii.gz -f {subject}_acq-CoV_T2starw_crop_seg.nii.gz -method wa -vert 3:9 -vertfile {subject}_acq-CoV_T2starw_crop_seg_labeled.nii.gz -perslice 1 -o {fname_result_sc}\n", + " fname_result_csf = os.path.join(path_results, f\"{subject}_acq-{shim_mode}_T2starw_label-CSF.csv\")\n", + " !sct_extract_metric -i {subject}_acq-{shim_mode}_T2starw_{file_suffix}.nii.gz -f {subject}_acq-CoV_T2starw_crop_label-CSF_seg.nii.gz -method wa -vert 3:9 -vertfile {subject}_acq-CoV_T2starw_crop_seg_labeled.nii.gz -perslice 1 -o {fname_result_csf}" ] }, { @@ -369,18 +369,18 @@ "for i, subject in enumerate(subjects):\n", " ax = axes[i]\n", "\n", - " for shim_method in shim_modes:\n", + " for shim_mode in shim_modes:\n", " # Initialize list to collect data for this shim method\n", " method_data = []\n", "\n", " # Get signal in SC\n", - " file_csv = os.path.join(path_results, f\"{subject}_acq-{shim_method}_T2starw_label-SC.csv\")\n", + " file_csv = os.path.join(path_results, f\"{subject}_acq-{shim_mode}_T2starw_label-SC.csv\")\n", " df = pd.read_csv(file_csv)\n", " data_sc = df['WA()']\n", " data_sc_smoothed = smooth_data(data_sc)\n", "\n", " # Get signal in CSF\n", - " file_csv = os.path.join(path_results, f\"{subject}_acq-{shim_method}_T2starw_label-CSF.csv\")\n", + " file_csv = os.path.join(path_results, f\"{subject}_acq-{shim_mode}_T2starw_label-CSF.csv\")\n", " df = pd.read_csv(file_csv)\n", " data_csf = df['WA()']\n", " data_csf_smoothed = smooth_data(data_csf)\n", @@ -401,12 +401,12 @@ " if method_data:\n", " # Plotting each file's data separately\n", " for resampled_data in method_data:\n", - " ax.plot(x_grid, resampled_data, label=f\"{shim_method}\")\n", + " ax.plot(x_grid, resampled_data, label=f\"{shim_mode}\")\n", " \n", " # Compute stats on the non-resampled data (to avoid interpolation errors)\n", " mean_data = np.mean(data_sc_csf_ratio)\n", " sd_data = np.std(data_sc_csf_ratio)\n", - " data_stats.append([subject, shim_method, mean_data, sd_data])\n", + " data_stats.append([subject, shim_mode, mean_data, sd_data])\n", "\n", " # Set custom x-ticks\n", " ax.set_xticks(custom_xticks)\n", @@ -430,7 +430,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f2a6d765", + "id": "bbb3e6fc", "metadata": {}, "outputs": [], "source": [ @@ -711,7 +711,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f062f23d", + "id": "6804e2be", "metadata": {}, "outputs": [], "source": [