-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
218 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Data from the Mediso AnyScan at NPL | ||
Initial processing steps | ||
```sh | ||
orgpath=/mnt/share/petric-wip/NEMA_Challenge | ||
#orgpath=~/devel/PETRIC/orgdata/ | ||
# cd $orgpath | ||
#wget https://nplanywhere.npl.co.uk/userportal/?v=4.6.1#/shared/public/nrKe5vWynvyMsp7m/e9e3d4b8-8f83-47be-bf2d-17a96a7a8aac | ||
#unzip NEMA_Challenge.zip | ||
cd ~/devel/PETRIC/data | ||
mkdir -p Mediso_NEMA_IQ | ||
cd Mediso_NEMA_IQ/ | ||
# trim sinograms to avoid "corner" problems in mult_factors | ||
# TODO for next data: use 30 (as some problems remain) | ||
for f in additive_term.hs mult_factors.hs prompts.hs; do | ||
SSRB -t 20 $f $orgpath/sinograms/$f | ||
done | ||
# alternative if we don't need to trim | ||
#cp -rp $orgpath/sinograms/* . | ||
# get rid of NaNs | ||
python prepare.py | ||
# now handle VOIs | ||
mkdir PETRIC | ||
cp -rp $orgpath/VOIs/* PETRIC | ||
# cp -rp $orgpath/README.md . | ||
cd PETRIC | ||
stir_math VOI_background.hv VOI_backgroung.hv | ||
rm VOI_backgroung.* | ||
rm *ahv | ||
cd .. | ||
python ../../SIRF_data_preparation/create_initial_images.py --template_image=PETRIC/VOI_whole_object.hv . | ||
``` | ||
I needed to fix the OSEM header (manual): | ||
``` | ||
!imaging modality := PT | ||
``` | ||
python ../../SIRF_data_preparation/data_QC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Set NaNs to zero in additive_term | ||
import numpy as np | ||
|
||
import sirf.STIR | ||
|
||
additive = sirf.STIR.AcquisitionData('additive_term.hs') | ||
add_arr = additive.as_array() | ||
add_arr = np.nan_to_num(add_arr) | ||
new_add = additive.clone() | ||
new_add.fill(add_arr) | ||
new_add.write('additive_term.hs') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
SIRF_data_preparation/Siemens_mMR_NEMA_IQ_lowcounts/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Siemens mMR NEMA IQ data (low counts) | ||
|
||
This relies on the "normal" count level processsing to be done first, specifically the download and the ROIs. | ||
|
||
Steps to follow: | ||
1. `prepare_mMR_NEMA_IQ_data.py` | ||
2. copy VOIs | ||
3. further steps as [normal](../README.md#steps-to-follow-to-prepare-data) |
Empty file.
48 changes: 48 additions & 0 deletions
48
SIRF_data_preparation/Siemens_mMR_NEMA_IQ_lowcounts/prepare_mMR_NEMA_IQ_data.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import argparse | ||
import logging | ||
import os | ||
|
||
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) | ||
challenge_data_path = os.path.join(repo_directory, 'data') | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='SyneRBI PETRIC Siemens mMR NEMA IQ data preparation script.') | ||
|
||
parser.add_argument('--log', type=str, default='warning') | ||
parser.add_argument('--start', type=float, default=0) | ||
parser.add_argument('--end', type=float, default=100) | ||
parser.add_argument('--raw_data_path', type=str, default=None) | ||
args = parser.parse_args() | ||
|
||
if args.log in ['debug', 'info', 'warning', 'error', 'critical']: | ||
level = eval(f'logging.{args.log.upper()}') | ||
logging.basicConfig(level=level) | ||
logging.info(f"Setting logging level to {args.log.upper()}") | ||
|
||
start = args.start | ||
end = args.end | ||
|
||
if args.raw_data_path is None: | ||
data_path = the_orgdata_path('Siemens_mMR_NEMA_IQ', 'raw', 'NEMA_IQ') | ||
else: | ||
data_path = args.raw_data_path | ||
|
||
data_path = os.path.abspath(data_path) | ||
logging.debug(f"Raw data path: {data_path}") | ||
|
||
intermediate_data_path = the_orgdata_path('Siemens_mMR_NEMA_IQ_lowcounts', 'processing') | ||
challenge_data_path = the_data_path('Siemens_mMR_NEMA_IQ_lowcounts') | ||
|
||
os.makedirs(challenge_data_path, exist_ok=True) | ||
os.chdir(challenge_data_path) | ||
os.makedirs(intermediate_data_path, exist_ok=True) | ||
|
||
f_template = os.path.join(data_path, 'mMR_template_span11.hs') | ||
|
||
prepare_challenge_Siemens_data(data_path, challenge_data_path, intermediate_data_path, '20170809_NEMA_', | ||
'60min_UCL.l.hdr', 'MUMAP_UCL.v', 'MUMAP_UCL.hv', 'UCL.n', 'norm.n.hdr', f_template, | ||
'prompts', 'mult_factors', 'additive_term', 'randoms', 'attenuation_factor', | ||
'attenuation_correction_factor', 'scatter', start, end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.