From 4aad66e4ced50f6f787c17e1428edcf1806b3da3 Mon Sep 17 00:00:00 2001 From: Mathieu Boudreau Date: Mon, 5 Feb 2024 14:55:16 -0400 Subject: [PATCH] Text updates --- content/index.ipynb | 239 +++++++++++++++++++------------------------- paper.md | 16 +-- 2 files changed, 114 insertions(+), 141 deletions(-) diff --git a/content/index.ipynb b/content/index.ipynb index 990f33d..a61b7e2 100644 --- a/content/index.ipynb +++ b/content/index.ipynb @@ -40,7 +40,7 @@ "\n", "\n", "

\n", - "Daniel Papp1, Kyle M. Gilbert2,3, Gaspard Cereza1, Alexandre D’Astous1, Mathieu Boudreau1, Marcus Couch4, Pedram Yazdanbakhsh5, Robert L. Barry6, Eva Alonso Ortiz1, Julien Cohen-Adad1,7,8\n", + "Daniel Papp1, Kyle M. Gilbert2,3, Gaspard Cereza1, Alexandre D’Astous1, Mathieu Boudreau1, Marcus Couch4, Pedram Yazdanbakhsh5, Robert L. Barry6,7,8, Eva Alonso Ortiz1, Julien Cohen-Adad1,9,10\n", "

\n", "\n", "\n", @@ -53,8 +53,10 @@ "4 Siemens Healthcare Limited, Montreal, QC, Canada,\n", "5 McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University, Montreal, QC, Canada,\n", "6 Athinoula A. Martinos Center for Biomedical Imaging, Department of Radiology, Massachusetts General Hospital, Charlestown, MA, USA,\n", - "7 Mila - Quebec AI Institute, Montreal, QC, Canada,\n", - "8 Functional Neuroimaging Unit, Centre de recherche de l'Institut universitaire de gériatrie de Montréal QC, Canada\n", + "7 Harvard Medical School, Boston, MA, USA,\n", + "8 Harvard-Massachusetts Institute of Technology Health Sciences & Technology, Cambridge, MA, USA,\n", + "9 Mila - Quebec AI Institute, Montreal, QC, Canada,\n", + "10 Functional Neuroimaging Unit, Centre de recherche de l'Institut universitaire de gériatrie de Montréal QC, Canada\n", "\n", "

\n", "

\n", @@ -87,7 +89,7 @@ "metadata": {}, "source": [ "

\n", - "Figure 1. Overview of the RF shimming procedure.\n", + "Figure 1. Overview of the RF shimming procedure. The top panel shows the RF coil used for the experiments, alongside the Tx coil geometry and the electromagnetic simulation results (on Gustav model) yielding the CP mode used for this coil. The bottom panel shows the RF shimming procedure (with approximate duration). First, GRE and tfl_rfmap scans are acquired (4min30s). Second, these images are transferred via ethernet socket from the MRI console onto a separate laptop running Shimming Toolbox and SCT (əs). Third, the spinal cord is automatically segmented to produce a mask that is resampled into the space of the individual coil magnitude and phase images of the tfl_rfmap scan (~5s). Fourth, the RF shim weights are calculated according to the defined constraints for each shim scenario (1min total).\n", "

" ] }, @@ -1049,61 +1051,107 @@ "plt.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Perform statistics" + ] + }, { "cell_type": "code", - "execution_count": 62, + "execution_count": null, + "metadata": { + "tags": [ + "hide_input", + "report_output" + ] + }, + "outputs": [], + "source": [ + "# Convert to DataFrame and save to CSV\n", + "df_stats = pd.DataFrame(data_stats, columns=['Subject', 'Shim_Mode', 'Average', 'Standard_Deviation'])\n", + "df_stats.to_csv(os.path.join(path_results, 'stats_b1plus.csv'), index=False)\n", + "\n", + "# Compute statistics across subjects\n", + "grouped_means = df_stats.groupby('Shim_Mode').agg({'Average': ['mean', 'std'], 'Standard_Deviation': ['mean', 'std']})\n", + "\n", + "# Format mean ± standard deviation\n", + "grouped_means['Average_formatted'] = grouped_means['Average']['mean'].map(\"{:.2f}\".format) + \" ± \" + grouped_means['Average']['std'].map(\"{:.2f}\".format)\n", + "grouped_means['Standard_Deviation_formatted'] = grouped_means['Standard_Deviation']['mean'].map(\"{:.2f}\".format) + \" ± \" + grouped_means['Standard_Deviation']['std'].map(\"{:.2f}\".format)\n", + "\n", + "# Drop multi-level index and only keep formatted columns\n", + "grouped_means = grouped_means.drop(columns=['Average', 'Standard_Deviation'])\n", + "grouped_means.columns = ['Average', 'Standard_Deviation'] # Rename columns for clarity\n", + "grouped_means.reset_index().to_csv(os.path.join(path_results, 'stats_b1plus_average_across_subjects.csv'), index=False)\n", + "\n", + "# Perform Repeated Measures ANOVA\n", + "aovrm = AnovaRM(df_stats, 'Average', 'Subject', within=['Shim_Mode'])\n", + "res = aovrm.fit()\n", + "print(res.summary())\n", + "\n", + "# Perform Post Hoc paired t-tests\n", + "\n", + "# Filter out subjects that don't have all shim modes\n", + "shim_modes = df_stats['Shim_Mode'].unique()\n", + "valid_subjects = df_stats.groupby('Subject').filter(lambda x: all(mode in x['Shim_Mode'].values for mode in shim_modes))\n", + "\n", + "# Pairwise comparisons\n", + "pairs = list(itertools.combinations(shim_modes, 2))\n", + "p_values = []\n", + "\n", + "for pair in pairs:\n", + " data1 = valid_subjects[valid_subjects['Shim_Mode'] == pair[0]]['Average']\n", + " data2 = valid_subjects[valid_subjects['Shim_Mode'] == pair[1]]['Average']\n", + " _, p_value = ttest_rel(data1, data2)\n", + " p_values.append(p_value)\n", + "\n", + "# Function for Benjamini-Hochberg FDR correction\n", + "def benjamini_hochberg(p_values):\n", + " n = len(p_values)\n", + " sorted_p_values = np.sort(p_values)\n", + " sorted_index = np.argsort(p_values)\n", + " adjusted_p_values = np.zeros(n)\n", + "\n", + " for i, p in enumerate(sorted_p_values):\n", + " adjusted_p_values[sorted_index[i]] = min(p * n / (i + 1), 1)\n", + "\n", + " return adjusted_p_values\n", + "\n", + "# Applying Benjamini-Hochberg FDR correction\n", + "adjusted_p_values = benjamini_hochberg(p_values)\n", + "\n", + "# Creating a summary DataFrame\n", + "comparison_results = pd.DataFrame({'Pair': pairs, 'P-Value': p_values, 'Adjusted P-Value': adjusted_p_values})\n", + "\n", + "# Save to CSV\n", + "comparison_results.to_csv(os.path.join(path_results, 'stats_b1plus_paired_ttest.csv'), index=False)\n", + "\n", + "print(f\"Paired t-tests:\\n{comparison_results}\")" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - " \n", - " " - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "
\n", - "
\n", - "\n", - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Plots" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "hide_input", + "report_output" + ] + }, + "outputs": [], "source": [ "# PYTHON CODE\n", "# Module imports\n", @@ -1350,85 +1398,6 @@ "display(HTML('figure1.html'))" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Perform statistics" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [ - "hide_input", - "report_output" - ] - }, - "outputs": [], - "source": [ - "# Convert to DataFrame and save to CSV\n", - "df_stats = pd.DataFrame(data_stats, columns=['Subject', 'Shim_Mode', 'Average', 'Standard_Deviation'])\n", - "df_stats.to_csv(os.path.join(path_results, 'stats_b1plus.csv'), index=False)\n", - "\n", - "# Compute statistics across subjects\n", - "grouped_means = df_stats.groupby('Shim_Mode').agg({'Average': ['mean', 'std'], 'Standard_Deviation': ['mean', 'std']})\n", - "\n", - "# Format mean ± standard deviation\n", - "grouped_means['Average_formatted'] = grouped_means['Average']['mean'].map(\"{:.2f}\".format) + \" ± \" + grouped_means['Average']['std'].map(\"{:.2f}\".format)\n", - "grouped_means['Standard_Deviation_formatted'] = grouped_means['Standard_Deviation']['mean'].map(\"{:.2f}\".format) + \" ± \" + grouped_means['Standard_Deviation']['std'].map(\"{:.2f}\".format)\n", - "\n", - "# Drop multi-level index and only keep formatted columns\n", - "grouped_means = grouped_means.drop(columns=['Average', 'Standard_Deviation'])\n", - "grouped_means.columns = ['Average', 'Standard_Deviation'] # Rename columns for clarity\n", - "grouped_means.reset_index().to_csv(os.path.join(path_results, 'stats_b1plus_average_across_subjects.csv'), index=False)\n", - "\n", - "# Perform Repeated Measures ANOVA\n", - "aovrm = AnovaRM(df_stats, 'Average', 'Subject', within=['Shim_Mode'])\n", - "res = aovrm.fit()\n", - "print(res.summary())\n", - "\n", - "# Perform Post Hoc paired t-tests\n", - "\n", - "# Filter out subjects that don't have all shim modes\n", - "shim_modes = df_stats['Shim_Mode'].unique()\n", - "valid_subjects = df_stats.groupby('Subject').filter(lambda x: all(mode in x['Shim_Mode'].values for mode in shim_modes))\n", - "\n", - "# Pairwise comparisons\n", - "pairs = list(itertools.combinations(shim_modes, 2))\n", - "p_values = []\n", - "\n", - "for pair in pairs:\n", - " data1 = valid_subjects[valid_subjects['Shim_Mode'] == pair[0]]['Average']\n", - " data2 = valid_subjects[valid_subjects['Shim_Mode'] == pair[1]]['Average']\n", - " _, p_value = ttest_rel(data1, data2)\n", - " p_values.append(p_value)\n", - "\n", - "# Function for Benjamini-Hochberg FDR correction\n", - "def benjamini_hochberg(p_values):\n", - " n = len(p_values)\n", - " sorted_p_values = np.sort(p_values)\n", - " sorted_index = np.argsort(p_values)\n", - " adjusted_p_values = np.zeros(n)\n", - "\n", - " for i, p in enumerate(sorted_p_values):\n", - " adjusted_p_values[sorted_index[i]] = min(p * n / (i + 1), 1)\n", - "\n", - " return adjusted_p_values\n", - "\n", - "# Applying Benjamini-Hochberg FDR correction\n", - "adjusted_p_values = benjamini_hochberg(p_values)\n", - "\n", - "# Creating a summary DataFrame\n", - "comparison_results = pd.DataFrame({'Pair': pairs, 'P-Value': p_values, 'Adjusted P-Value': adjusted_p_values})\n", - "\n", - "# Save to CSV\n", - "comparison_results.to_csv(os.path.join(path_results, 'stats_b1plus_paired_ttest.csv'), index=False)\n", - "\n", - "print(f\"Paired t-tests:\\n{comparison_results}\")" - ] - }, { "cell_type": "markdown", "metadata": {}, diff --git a/paper.md b/paper.md index fee1970..8782a0a 100644 --- a/paper.md +++ b/paper.md @@ -31,13 +31,13 @@ authors: affiliation: 5 - name: Robert L. Barry orcid: - affiliation: 6 + affiliation: "6, 7, 8" - name: Eva Alonso Ortiz orcid: affiliation: 1 - name: Julien Cohen-Adad orcid: 0000-0003-3662-9532 - affiliation: "1, 7, 8" + affiliation: "1, 9, 10" affiliations: - name: NeuroPoly Lab, Institute of Biomedical Engineering, Polytechnique Montreal, Montreal, QC, Canada index: 1 @@ -51,12 +51,16 @@ affiliations: index: 5 - name: Athinoula A. Martinos Center for Biomedical Imaging, Department of Radiology, Massachusetts General Hospital, Charlestown, MA, USA index: 6 - - name: Mila - Quebec AI Institute, Montreal, QC, Canada + - name: Harvard Medical School, Boston, MA, USA index: 7 - - name: Functional Neuroimaging Unit, Centre de recherche de l'Institut universitaire de gériatrie de Montréal QC, Canada + - name: Harvard-Massachusetts Institute of Technology Health Sciences & Technology, Cambridge, MA, USA index: 8 + - name: Mila - Quebec AI Institute, Montreal, QC, Canada + index: 9 + - name: Functional Neuroimaging Unit, Centre de recherche de l'Institut universitaire de gériatrie de Montréal QC, Canada + index: 10 -date: 2 February 2024 +date: 9 February 2024 bibliography: paper.bib --- @@ -77,7 +81,7 @@ Advancing the development of 7T MRI for spinal cord imaging is crucial for the e # Figures -![Overview of the RF shimming procedure. +![Overview of the RF shimming procedure. The top panel shows the RF coil used for the experiments, alongside the Tx coil geometry and the electromagnetic simulation results (on Gustav model) yielding the CP mode used for this coil. The bottom panel shows the RF shimming procedure (with approximate duration). First, GRE and tfl_rfmap scans are acquired (4min30s). Second, these images are transferred via ethernet socket from the MRI console onto a separate laptop running Shimming Toolbox and SCT (<1s). Third, the spinal cord is automatically segmented to produce a mask that is resampled into the space of the individual coil magnitude and phase images of the tfl_rfmap scan (~5s). Fourth, the RF shim weights are calculated according to the defined constraints for each shim scenario (1min total).. \label{fig:overview}](featured.png)