CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
527 stars 180 forks source link

UBUNTU met "UnboundLocalError: local variable 'test_data' referenced before assignment" when using "demo/d03" test if it's installing #542

Closed GreameLee closed 1 month ago

GreameLee commented 1 month ago
AnderBiguri commented 1 month ago

hi @GreameLee , can yo tell me the entire error (incuding line)?

GreameLee commented 1 month ago

hi @GreameLee , can yo tell me the entire error (incuding line)?

Traceback (most recent call last): File "d03_generateData.py", line 35, in head = sample_loader.load_head_phantom(geo.nVoxel) File "/home/user/anaconda3/envs/CT/lib/python3.7/site-packages/tigre/utilities/sample_loader.py", line 27, in load_head_phantom image = test_data["img"].transpose(2, 1, 0).copy() UnboundLocalError: local variable 'test_data' referenced before assignment

AnderBiguri commented 1 month ago

@GreameLee have you installed the toolbox? seems that the data is missing, but this should only happens if you did not pip install . as the instructions suggest. Or did you do that, but still get this error??

GreameLee commented 1 month ago

@AnderBiguri Yes, I do all the instructions step by step and successfully did it and tried several times but still got this error. And when I go to the sample_loader.py file and put test_data as an absolute path of head.mat, it can run now. I guess there is a problem with the relative path.

AnderBiguri commented 1 month ago

Thanks! for your own, that change should suffice to keep you going. I will investigate soon to see if I can find a fix that is general.