Skip to content

Commit bad76f6

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent ef09f39 commit bad76f6

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

reconstruction/MRI_reconstruction/tutorials/01_kspace_basics_fastmri_knee.ipynb

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,36 @@
133133
"outputId": "98b4e840-035f-4e47-ed35-777a21c3ed2d"
134134
},
135135
"outputs": [],
136-
"source": "# Update this path to where your fastMRI knee single-coil data is stored.\n# You only need ONE .h5 file from the knee_singlecoil_val set.\n\n# --- Google Colab: mount Drive and copy data ---\nfrom google.colab import drive\n\ndrive.mount(\"/content/drive\")\n\ndrive_folder = \"/content/drive/MyDrive/fastmri_data\"\ndata_path = \"/content/fastmri_data/knee_singlecoil_val\"\nos.makedirs(data_path, exist_ok=True)\n\nfiles = [f for f in os.listdir(drive_folder) if f.endswith(\".h5\")]\nif files:\n shutil.copy(os.path.join(drive_folder, files[0]), data_path)\n print(f\"Copied {files[0]} to {data_path}\")\nelse:\n raise FileNotFoundError(\n f\"No .h5 files found in {drive_folder}\\n\"\n \"Please upload at least one .h5 file from knee_singlecoil_val.\"\n )\n\n# --- Local users: comment out the Colab block above and set your path ---\n# data_path = os.path.join(\"YOUR_DIR_HERE\", \"knee_singlecoil_val\")\n\nsample_files = sorted([f for f in os.listdir(data_path) if f.endswith(\".h5\")])\nsample_file = os.path.join(data_path, sample_files[0])\nprint(f\"Using sample file: {sample_file}\")\nprint(f\"Total .h5 files found: {len(sample_files)}\")"
136+
"source": [
137+
"# Update this path to where your fastMRI knee single-coil data is stored.\n",
138+
"# You only need ONE .h5 file from the knee_singlecoil_val set.\n",
139+
"\n",
140+
"# --- Google Colab: mount Drive and copy data ---\n",
141+
"from google.colab import drive\n",
142+
"\n",
143+
"drive.mount(\"/content/drive\")\n",
144+
"\n",
145+
"drive_folder = \"/content/drive/MyDrive/fastmri_data\"\n",
146+
"data_path = \"/content/fastmri_data/knee_singlecoil_val\"\n",
147+
"os.makedirs(data_path, exist_ok=True)\n",
148+
"\n",
149+
"files = [f for f in os.listdir(drive_folder) if f.endswith(\".h5\")]\n",
150+
"if files:\n",
151+
" shutil.copy(os.path.join(drive_folder, files[0]), data_path)\n",
152+
" print(f\"Copied {files[0]} to {data_path}\")\n",
153+
"else:\n",
154+
" raise FileNotFoundError(\n",
155+
" f\"No .h5 files found in {drive_folder}\\n\" \"Please upload at least one .h5 file from knee_singlecoil_val.\"\n",
156+
" )\n",
157+
"\n",
158+
"# --- Local users: comment out the Colab block above and set your path ---\n",
159+
"# data_path = os.path.join(\"YOUR_DIR_HERE\", \"knee_singlecoil_val\")\n",
160+
"\n",
161+
"sample_files = sorted([f for f in os.listdir(data_path) if f.endswith(\".h5\")])\n",
162+
"sample_file = os.path.join(data_path, sample_files[0])\n",
163+
"print(f\"Using sample file: {sample_file}\")\n",
164+
"print(f\"Total .h5 files found: {len(sample_files)}\")"
165+
]
137166
},
138167
{
139168
"cell_type": "markdown",
@@ -932,4 +961,4 @@
932961
},
933962
"nbformat": 4,
934963
"nbformat_minor": 0
935-
}
964+
}

0 commit comments

Comments
 (0)