Skip to content

Commit

Permalink
use more Python modules
Browse files Browse the repository at this point in the history
Using relative path in some places
  • Loading branch information
KrisThielemans committed Sep 19, 2024
1 parent f867014 commit be0c011
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions SIRF_data_preparation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ PYTHONPATH=~/devel/PETRIC:$PYTHONPATH`

1. Run initial [data_QC.py](data_QC)
```
python ../../SIRF_data_preparation/data_QC.py
python -m SIRF_data_preparation.data_QC
```

2. Run [create_initial_images.py](create_initial_images).
```
python ../../SIRF_data_preparation/create_initial_images.py --template_image=<some_image>
python -m SIRF_data_preparation.create_initial_images --template_image=<some_image>
```
where the template image is one of the given VOIs (it does not matter which one, as they should all have the same geometry). (If you need to create VOIs yourself, you can use `None` or the vendor image).
3. Edit `OSEM_image.hv` to add modality, radionuclide and duration info which got lost (copy from `prompts.hs`)
4. Edit [dataset_settings.py](dataset_settings.py) for subsets (used by our reference reconstructions only, not by participants).
5. Edit [../petric.py](petric.py) for slices to use for creating figures (`DATA_SLICES`). Note that `data_QC.py` outputs centre-of-mass of the VOIs, which can be helpful for this.
6. Run [data_QC.py](data_QC) which should now make more plots. Check VOI alignment etc.
5. Edit [../petric.py](petric.py) for slices to use for creating figures (`DATA_SLICES`). Note that `data_QC` outputs centre-of-mass of the VOIs, which can be helpful for this.
6. Run [data_QC](data_QC) which should now make more plots. Check VOI alignment etc.
```
python ../../SIRF_data_preparation/data_QC.py --dataset=<datasetname>
python -m SIRF_data_preparation.data_QC --dataset=<datasetname>
```
7. `cd ../..`
8. `python SIRF_data_preparation/run_OSEM.py <datasetname>`
9. `python SIRF_data_preparation/run_BSREM.py <datasetname>`
8. `python -m SIRF_data_preparation.run_OSEM <datasetname>`
9. `python -m SIRF_data_preparation.run_BSREM <datasetname>`
10. Adapt [plot_BSREM_metrics.py](plot_BSREM_metrics.py) (probably only the `<datasetname>`) and run interactively.
11. Copy the BSREM ` iter_final` to `data/<datasetname>/PETRIC/reference_image`, e.g.
```
Expand Down
8 changes: 4 additions & 4 deletions SIRF_data_preparation/Siemens_mMR_ACR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ugly and temporary
Steps to follow:
1. `python SIRF_data_preparation/Siemens_mMR_ACR/download.py`
2. `python SIRF_data_preparation/Siemens_mMR_ACR/prepare.py` (As there is no useful mumap, this will **not** do attenuation and scatter estimation)
3. `python SIRF_data_preparation/create_initial_images.py data/Siemens_mMR_ACR/final --template_image=None` (Reconstruct at full FOV size)
3. `python SIRF_data_preparation.create_initial_images data/Siemens_mMR_ACR/final --template_image=None` (Reconstruct at full FOV size)
4. `mv data/Siemens_mMR_ACR/final/OSEM_image.* data/Siemens_mMR_ACR/processing` (this is really an NAC image and ideally would be renamed)
5. `python SIRF_data_preparation/Siemens_mMR_ACR/register_mumap.py` (output is orgdata/Siemens_mMR_ACR/processing/reg_mumap.hv etc)
6. However, registration failed, so this needs a manual intervention step:
Expand All @@ -24,9 +24,9 @@ Steps to follow:
stir_math --accumulate orgdata/Siemens_mMR_ACR/processing/reg_mumap.hv orgdata/Siemens_mMR_ACR/output/ACR_hardware-to-STIR.nii.gz
```
7. 11. `python SIRF_data_preparation/run_OSEM.py Siemens_mMR_ACR`--end 200` (As there is now a useful mumap, this will now do attenuation and scatter estimation)
8. `python SIRF_data_preparation/create_initial_images.py data/Siemens_mMR_ACR --template_image=../../orgdata/Siemens_mMR_ACR/output/sampling_masks/acr-all-sampling-0-2mm_dipy.nii`
9. `python SIRF_data_preparation/data_QC.py --srcdir='data/Siemens_mMR_ACR' --transverse_slice=99`
10. edit `SIRF_data_prepatation/dataset_settings.py` for subsets etc. edit `OSEM_image.hv` to add modality, radionuclide and duration info which got lost.
8. `python -m SIRF_data_preparation.create_initial_images data/Siemens_mMR_ACR --template_image=../../orgdata/Siemens_mMR_ACR/output/sampling_masks/acr-all-sampling-0-2mm_dipy.nii`
9. `python -m SIRF_data_preparation.data_QC --srcdir='data/Siemens_mMR_ACR' --transverse_slice=99`
10. edit `petric.py` and `SIRF_data_preparation/dataset_settings.py` for subsets etc. edit `OSEM_image.hv` to add modality, radionuclide and duration info which got lost.
11. `python SIRF_data_preparation/Siemens_mMR_ACR/VOI_prep.py`
12. `python SIRF_data_preparation/run_OSEM.py Siemens_mMR_ACR`
13. `python SIRF_data_preparation/run_BSREM.py Siemens_mMR_ACR`
2 changes: 1 addition & 1 deletion SIRF_data_preparation/Siemens_mMR_ACR/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import os

from SIRF_data_preparation.data_utilities import prepare_challenge_Siemens_data, the_data_path, the_orgdata_path
from ..data_utilities import prepare_challenge_Siemens_data, the_data_path, the_orgdata_path

scanID = 'Siemens_mMR_ACR'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import os

from .data_utilities import prepare_challenge_Siemens_data, the_data_path
from ..data_utilities import prepare_challenge_Siemens_data, the_data_path, the_orgdata_path

this_directory = os.path.dirname(__file__)
repo_directory = os.path.dirname(this_directory)
Expand Down

0 comments on commit be0c011

Please sign in to comment.