Skip to content

Commit

Permalink
kernel clear and add optional linux vs/ win paths
Browse files Browse the repository at this point in the history
  • Loading branch information
drcandacemakedamoore committed Oct 19, 2024
1 parent 05b28ae commit eb6bbaf
Showing 1 changed file with 52 additions and 16 deletions.
68 changes: 52 additions & 16 deletions notebooks/Concatenate_volbrain_csvs_deeplesion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
{
"cell_type": "code",
"execution_count": 79,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -30,26 +30,31 @@
"import zipfile\n",
"import os\n",
"from zipfile import ZipFile\n",
"import glob"
"import glob\n",
"from io import BytesIO"
]
},
{
"cell_type": "code",
"execution_count": 80,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"#navigate to zipfolders and intended folder for output\n",
"path_volbrain = 'Z:/VolBrain'\n",
"output_folder = \"Z:/VolBrain/Separate_CSV_Deeplesion\"\n"
"#navigate to zipfolders and intended folder for output (change to commented out if on Windows)\n",
"# path_volbrain = 'Z:/processed_data/VolBrain'\n",
"# output_folder = \"Z:/processed_data/VolBrain/Separate_CSV_Deeplesion\"\n",
"path_volbrain = '/mnt/data/processed_data/VolBrain'\n",
"output_folder = \"/mnt/data/processed_data/VolBrain/Separate_CSV_Deeplesion\""
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {},
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"#create a list to store the CSV headers in\n",
Expand All @@ -58,15 +63,13 @@
},
{
"cell_type": "code",
"execution_count": 82,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"dataframes = []\n",
"from io import BytesIO\n",
"\n",
"\n",
"for zip_file in glob.glob(os.path.join(path_volbrain, '*.zip')):\n",
" # split by underscores\n",
Expand Down Expand Up @@ -97,7 +100,7 @@
},
{
"cell_type": "code",
"execution_count": 84,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -110,7 +113,20 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"concat_df"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"#Now make the column names castor appropriate. Do not change the \"Participant Id\" column of course. dl stands for DeepLesion algorithm\n",
Expand All @@ -125,13 +141,33 @@
},
{
"cell_type": "code",
"execution_count": 86,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"concat_df"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"concat_df.to_csv('Z:/castor_proof_files/volbrains_castor.csv')"
"# concat_df.to_csv('Z:/castor_proof_files/volbrains_castor.csv')\n",
"#(change to commented out if on Windows)\n",
"concat_df.to_csv('/mnt/data/castor_proof_files/volbrains_castor.csv')"
]
}
],
Expand All @@ -151,7 +187,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.10"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down

0 comments on commit eb6bbaf

Please sign in to comment.