SyneRBI / SIRF-Exercises

SIRF Training and demonstration material
http://www.ccpsynerbi.ac.uk
Apache License 2.0
18 stars 21 forks source link

PET notebooks copy data from wrong place #100

Closed KrisThielemans closed 3 years ago

KrisThielemans commented 3 years ago

They copy data from sirf_exercises_path but should be stuff like

import sirf.Utilities
data_source_dir = os.path.join(sirf.Utilities.examples_data_path('PET'),'brain')
shutil.rmtree('working_folder/brain',True)
shutil.copytree(data_source_dir ,'working_folder/brain')

@ashgillman would you have time for this? Possibly together with #84 but let's not be ambitious!

ashgillman commented 3 years ago

This step is already handled in image_creation_and_simulation.ipynb. Or have I misunderstood?

#%% Go to directory with input files
# Adapt this path to your situation (or start everything in the relevant directory)
os.chdir(exercises_data_path('PET'))
# Copy files to a working folder and change directory to where these files are.
# We do this to avoid cluttering your SIRF files. This way, you can delete 
# working_folder and start from scratch.
shutil.rmtree('working_folder/brain',True)
shutil.copytree(os.path.join(examples_data_path('PET'), 'brain'),'working_folder/brain')
os.chdir('working_folder/brain')
KrisThielemans commented 3 years ago

looks like it. I updated display_and_projection. maybe there's some others.

ashgillman commented 3 years ago

I understood that the other notebooks aren't necessarily meant to run completely without running image_creation_and_simulation.ipynb first (like the brainweb notebooks in Synergistic which the other notebooks depend upon). So does this not hand this?

ashgillman commented 3 years ago

Ah, I've misread my own code. I thought image_creation_and_simulation.ipynb was copying <examples_data>/brain to <exercises_data>/brain then they all used this. Yes, it makes more sense for each notebook to copy from <examples_data>/brain to <working_dir>/brain each time.

KrisThielemans commented 3 years ago

please check what I did in the display* notebook. If you're happy with it, I guess you could copy it (removing most of the comments). If not, modify it first!

ashgillman commented 3 years ago

Should be addressed in #101

KrisThielemans commented 3 years ago

@ashgillman I believe this was fixed by #101?

ashgillman commented 3 years ago

Yes, everything is now run in DATA/working_folder/... and data is never copied from examples, etc., but referenced as a full path.