Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIGRE installed with pip fails to load_head_phantom #493

Closed
ChemEng227 opened this issue Sep 27, 2023 · 5 comments
Closed

TIGRE installed with pip fails to load_head_phantom #493

ChemEng227 opened this issue Sep 27, 2023 · 5 comments

Comments

@ChemEng227
Copy link

Expected Behavior

tigre.utilities.sample_loader.load_head_phantom shall reutrn a shepp-logan head phantom.

Actual Behavior

an FileNotFoundError was thrown.
the Error info was:
FileNotFoundError: [Errno 2] No such file or directory: '/path/to/anaconda3/envs/TIGRE/lib/python3.11/site-packages/tigre/utilities/./../../data/head.mat'

Code to reproduce the problem (If applicable)

any python demo.
The TIGRE source was downloaded directly from github, at commit 0638104 .
TIGRE was compiled and installed with pip install ..

Specifications

  • MATLAB/python version:3.10.4
  • OS: Ubuntu 22.04 LTS
  • CUDA version: 12.2
@ChemEng227
Copy link
Author

Yes, I know this issue could be fixed simply by copy-pasting some files. I just want to report that such issue exists.

@AnderBiguri
Copy link
Member

Thanka for the report! This is an unintended bug from recent change to pip install.

I theory, "python setup.py install" should still work and do it correctly. Trying to fix this at the moment.

@tsadakane
Copy link
Contributor

Thank you for the report. I could reproduce the phenomena, and found that head.mat was located at /path/to/anaconda3/envs/conda_env_name/data/head.mat.

It can be fixed if sample_loader.py is modified as...

def load_head_phantom(number_of_voxels=None):
    if number_of_voxels is None:
        number_of_voxels = np.array((128, 128, 128))
    list_relative_path = [
        "../../../Common/data/head.mat", # Local
        "../../data/head.mat",   # setup.py
        "../../../../data/head.mat"  # pip 
    ]
    found = False
    for relative_path in list_relative_path:
        abs_path = os.path.join(os.path.dirname(__file__), relative_path)
        if os.path.isfile(abs_path):
            found = True
            break
    if found:
        test_data = scipy.io.loadmat(abs_path)
        
    # Loads data in F_CONTIGUOUS MODE (column major), convert to Row major

I think there must be a more elegant way, though...

@AnderBiguri
Copy link
Member

@tsadakane Ideally we slowly deprecate using setup.py and only advocate for pip, so we can only have the pip one I think, however maybe this is a good temporary solution until we make sure pip works 100%.

#492 is vague, but it has only started happening since the pip install update for me, and some others have also reported the issue, but I am not 100% sure if its caused by it, I will do tests this week.

@AnderBiguri
Copy link
Member

AnderBiguri commented Oct 18, 2023

This has been now added to the latest commit, once I can verify it works in a couple of other machines I can close the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants