TIGRE icon indicating copy to clipboard operation
TIGRE copied to clipboard

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

Open GreameLee opened this issue 9 months ago • 5 comments

  • python version: 3.7
  • OS:ubuntu 18.4
  • CUDA version:12.2

GreameLee avatar May 07 '24 15:05 GreameLee

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

AnderBiguri avatar May 08 '24 09:05 AnderBiguri

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

GreameLee avatar May 08 '24 14:05 GreameLee

@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??

AnderBiguri avatar May 08 '24 15:05 AnderBiguri

@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.

GreameLee avatar May 08 '24 15:05 GreameLee

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.

AnderBiguri avatar May 08 '24 15:05 AnderBiguri