From 3c56ddb364931a81e7f0876615a731ba2cc3b9a8 Mon Sep 17 00:00:00 2001 From: jcohenadad Date: Fri, 22 Dec 2023 23:17:39 -0500 Subject: [PATCH] Extract B1+ values along the cord --- data_processing.ipynb | 68 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/data_processing.ipynb b/data_processing.ipynb index 7123f0d..63eb48d 100644 --- a/data_processing.ipynb +++ b/data_processing.ipynb @@ -56,7 +56,7 @@ "\n", "For each subject:\n", "\n", - "- Segment the SC on GRE scan\n", + "- Segment the spinal cord on GRE scan\n", "- Label vertebral levels on GRE scan using existing manual disc labels\n", "- Extract the signal intensity on the GRE scan within the spinal cord\n", "- Register each B1 map (CP, CoV, etc.) to the GRE scan\n", @@ -147,7 +147,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ab6a7dbe", + "id": "95cafe0d", "metadata": {}, "outputs": [], "source": [ @@ -157,7 +157,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e1a6ae1", + "id": "6137bb2b", "metadata": {}, "outputs": [], "source": [ @@ -173,7 +173,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90deb5e5", + "id": "862dc562", "metadata": {}, "outputs": [], "source": [ @@ -186,6 +186,33 @@ " !sct_crop_image -i {subject}_acq-CoV_T2starw_seg_labeled.nii.gz -m {subject}_acq-CoV_T2starw_seg.nii.gz -dilate 20x20x0 -o {subject}_acq-CoV_T2starw_crop_seg_labeled.nii.gz " ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "c46e8d9a", + "metadata": {}, + "outputs": [], + "source": [ + "# Register the other shim methods to the GRE CoV scan\n", + "\n", + "# TODO" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "90deb5e5", + "metadata": {}, + "outputs": [], + "source": [ + "# Extract the signal intensity on the GRE scan within the spinal cord\n", + "\n", + "for subject in subjects:\n", + " # TODO: loop across other shim methods \n", + " os.chdir(os.path.join(path_data, subject, \"anat\"))\n", + " !sct_extract_metric -i {subject}_acq-CoV_T2starw_crop.nii.gz -f {subject}_acq-CoV_T2starw_crop_seg.nii.gz -method wa -vert 1:9 -vertfile {subject}_acq-CoV_T2starw_crop_seg_labeled.nii.gz -append 1 -perslice 1 -o gre_CoV.csv\n" + ] + }, { "cell_type": "code", "execution_count": null, @@ -203,7 +230,7 @@ }, { "cell_type": "markdown", - "id": "679f1193", + "id": "39de4623", "metadata": {}, "source": [ "## Verify QC report (B1maps to GRE registration)\n", @@ -214,7 +241,7 @@ { "cell_type": "code", "execution_count": null, - "id": "623c26cd", + "id": "6a6d7670", "metadata": {}, "outputs": [], "source": [ @@ -230,12 +257,39 @@ { "cell_type": "code", "execution_count": null, - "id": "ef34c2a1", + "id": "a835cdee", + "metadata": {}, + "outputs": [], + "source": [ + "# Convert the B1 map to nT/V units\n", + "\n", + "# TODO" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "740fda91", "metadata": {}, "outputs": [], "source": [ "# Extract B1+ value along the spinal cord\n", "\n", + "for subject in subjects:\n", + " os.chdir(os.path.join(path_data, subject, \"fmap\"))\n", + " for shim_mode in shim_modes:\n", + " !sct_extract_metric -i {subject}_acq-famp{shim_mode}_TB1TFL.nii.gz -f {subject}_acq-anat{shim_mode}_TB1TFL_seg.nii.gz -method wa -vert 1:9 -vertfile {subject}_acq-anat{shim_mode}_TB1TFL_seg_labeled.nii.gz -append 1 -perslice 1 -o TB1TFL_{shim_mode}.csv" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b0185bb0", + "metadata": {}, + "outputs": [], + "source": [ + "# Make figure of B1+ values along the spinal cord across shim methods\n", + "\n", "# TODO" ] }