Skip to content

Commit

Permalink
Use SCT segmentation, and only on CoV GRE scan
Browse files Browse the repository at this point in the history
Why doing it on all scans?
  • Loading branch information
jcohenadad committed Dec 22, 2023
1 parent bcd4e92 commit 9a222d5
Showing 1 changed file with 38 additions and 21 deletions.
59 changes: 38 additions & 21 deletions Analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
"import subprocess\n",
"import glob\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from PIL import Image\n",
"from IPython.display import display\n",
"from tabulate import tabulate\n",
"# import matplotlib.pyplot as plt\n",
"# from PIL import Image\n",
"# from IPython.display import display\n",
"# from tabulate import tabulate\n",
"import nibabel as nib\n",
"import pandas as pd"
"# import pandas as pd"
]
},
{
Expand All @@ -77,7 +77,24 @@
"\n",
"!datalad install https://github.com/OpenNeuroDatasets/ds004906.git\n",
"os.chdir(\"ds004906\")\n",
"!datalad get sub-01/"
"# !datalad get . # uncomment for production\n",
"!datalad get sub-01/ # comment for debugging\n",
"path_data = os.getcwd()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e95d87a4-3194-4369-b6cb-933ad1d5cfa3",
"metadata": {},
"outputs": [],
"source": [
"# Run segmentation on GRE scan\n",
"\n",
"subjects = glob.glob(\"sub-*\")\n",
"for subject in subjects:\n",
" os.chdir(os.path.join(path_data, subject, \"anat\"))\n",
" !sct_deepseg_sc -i {subject}_acq-CoV_T2starw.nii.gz -c t2 -qc {os.path.join(path_data, \"qc\")}"
]
},
{
Expand Down Expand Up @@ -491,21 +508,21 @@
"metadata": {},
"outputs": [],
"source": [
"# Run GRE segmentation\n",
"path_data = './RF_shimming_project_cleanupload'\n",
"path_data_abs = os.path.abspath(path_data)\n",
"shimcasenames=['noshim','patspec','volspec','phaseonly','cvred','target','sareff']\n",
"\n",
"# Loop across subjects\n",
"for entry in os.scandir(folder_path):\n",
" if entry.is_dir():\n",
" subject=entry.name\n",
" # Loop across shim cases\n",
" for shimcase in range(len(shimcasenames)):\n",
" print(f\"Running segmentation for: subject={subject}, shimcase={shimcase}\")\n",
" os.chdir(os.path.join(path_data_abs, subject, shimcase))\n",
" GRE_segment_monai(subjectpath,shimcasenames[shimcase])\n",
" #B1_map_process(subjectpath,shimcasenames[shimcase])"
"# # Run GRE segmentation\n",
"# path_data = './RF_shimming_project_cleanupload'\n",
"# path_data_abs = os.path.abspath(path_data)\n",
"# shimcasenames=['noshim','patspec','volspec','phaseonly','cvred','target','sareff']\n",
"\n",
"# # Loop across subjects\n",
"# for entry in os.scandir(folder_path):\n",
"# if entry.is_dir():\n",
"# subject=entry.name\n",
"# # Loop across shim cases\n",
"# for shimcase in range(len(shimcasenames)):\n",
"# print(f\"Running segmentation for: subject={subject}, shimcase={shimcase}\")\n",
"# os.chdir(os.path.join(path_data_abs, subject, shimcase))\n",
"# GRE_segment_monai(subjectpath,shimcasenames[shimcase])\n",
"# #B1_map_process(subjectpath,shimcasenames[shimcase])"
]
},
{
Expand Down

0 comments on commit 9a222d5

Please sign in to comment.