|
10 | 10 | "from os import getenv\n",
|
11 | 11 | "from pathlib import Path\n",
|
12 | 12 | "\n",
|
13 |
| - "import nibabel as nib\n", |
| 13 | + "from nifreeze.data.pet import PET\n", |
14 | 14 | "\n",
|
15 |
| - "from nifreeze.data import pet\n", |
16 |
| - "from nifreeze.model import PETModel" |
17 |
| - ] |
18 |
| - }, |
19 |
| - { |
20 |
| - "cell_type": "code", |
21 |
| - "execution_count": 2, |
22 |
| - "id": "68dc04bd-04d8-49fa-bb21-d5de76afbc63", |
23 |
| - "metadata": {}, |
24 |
| - "outputs": [], |
25 |
| - "source": [ |
26 | 15 | "# Install test data from gin.g-node.org:\n",
|
27 | 16 | "# $ datalad install -g https://gin.g-node.org/nipreps-data/tests-nifreeze.git\n",
|
28 | 17 | "# and point the environment variable TEST_DATA_HOME to the corresponding folder\n",
|
|
40 | 29 | " DATA_PATH / \"pet_data\" / \"sub-02\" / \"ses-baseline\" / \"pet\" / \"sub-02_ses-baseline_pet.json\"\n",
|
41 | 30 | ")\n",
|
42 | 31 | "\n",
|
43 |
| - "pet_dataset = pet.PET.load(pet_file, json_file)" |
| 32 | + "pet_dataset = PET.load(pet_file, json_file)" |
44 | 33 | ]
|
45 | 34 | },
|
46 | 35 | {
|
|
417 | 406 | }
|
418 | 407 | ],
|
419 | 408 | "source": [
|
| 409 | + "from nifreeze.model import PETModel\n", |
| 410 | + "\n", |
420 | 411 | "model = PETModel(dataset=pet_dataset, timepoints=pet_dataset.midframe, xlim=7000)"
|
421 | 412 | ]
|
422 | 413 | },
|
|
447 | 438 | "metadata": {},
|
448 | 439 | "outputs": [],
|
449 | 440 | "source": [
|
| 441 | + "import nibabel as nb\n", |
| 442 | + "\n", |
450 | 443 | "# before\n",
|
451 |
| - "nifti_img_before = nib.Nifti1Image(predicted, pet_dataset.affine)\n", |
| 444 | + "nifti_img_before = nb.Nifti1Image(predicted, pet_dataset.affine)\n", |
452 | 445 | "output_path_before = \"before_mc.nii\"\n",
|
453 | 446 | "nifti_img_before.to_filename(output_path_before)\n",
|
454 | 447 | "\n",
|
455 | 448 | "# after\n",
|
456 |
| - "nifti_img_after = nib.Nifti1Image(data_test[0], pet_dataset.affine)\n", |
| 449 | + "nifti_img_after = nb.Nifti1Image(data_test[0], pet_dataset.affine)\n", |
457 | 450 | "output_path_after = \"after_mc.nii\"\n",
|
458 | 451 | "nifti_img_after.to_filename(output_path_after)"
|
459 | 452 | ]
|
|
2247 | 2240 | ")"
|
2248 | 2241 | ]
|
2249 | 2242 | },
|
2250 |
| - { |
2251 |
| - "cell_type": "code", |
2252 |
| - "execution_count": 12, |
2253 |
| - "id": "7c2c8811-d7ba-4ad1-8275-abd3b9ac3b10", |
2254 |
| - "metadata": {}, |
2255 |
| - "outputs": [], |
2256 |
| - "source": [ |
2257 |
| - "from nifreeze.estimator import PETMotionEstimator" |
2258 |
| - ] |
2259 |
| - }, |
2260 | 2243 | {
|
2261 | 2244 | "cell_type": "code",
|
2262 | 2245 | "execution_count": 13,
|
|
2272 | 2255 | }
|
2273 | 2256 | ],
|
2274 | 2257 | "source": [
|
| 2258 | + "from nifreeze.estimator import PETMotionEstimator\n", |
| 2259 | + "\n", |
2275 | 2260 | "# Instantiate with a PETModel or appropriate model instance\n",
|
2276 | 2261 | "model = PETModel(\n",
|
2277 | 2262 | " dataset=pet_dataset, timepoints=pet_dataset.midframe, xlim=pet_dataset.total_duration\n",
|
|
0 commit comments