ANTsPyNet icon indicating copy to clipboard operation
ANTsPyNet copied to clipboard

Question about antsxnet_cache_directory (string) in antspynet.utilities.brain_extraction.

Open Lucifer201210 opened this issue 1 year ago • 4 comments

Hi, When I exacted brain using antspynet.utilities.brain_extraction according to AntsPyNet document (https://antsx.github.io/ANTsPyNet/docs/build/html/utilities.html#applications), an error happened.

截图 2024-08-22 00-41-48

According this document, the antsxnet_cache_directory was used to store the downloaded template and model weights. I haved download brainExtractionRobustT1.h5 and S_template3_resampled.nii.gz in a folder. Then I set antsxnet_cache_directory to this folder path. the code was as following:

截图 2024-08-22 00-50-33

截图 2024-08-22 00-50-59

brainExtractionRobustT1.h5 and S_template3_resampled.nii.gz were in /home/wei/DeepLearning/Model_pth/, Since I haved downloaded template and model weights to the folder path which antsxnet_cache_directory was pointed to,why antspynet.utilities.brain_extraction still need to download data from https://ndownloader.figshare.com/files/22597175

Then I copy brainExtractionRobustT1.h5 and S_template3_resampled.nii.gz to ~/.keras/ANTsXNet, and run antspynet.utilities.brain_extraction twice, the same error happed.

截图 2024-08-22 01-04-35

When I copy https://ndownloader.figshare.com/files/22597175 to my google chrome, It automatically download S_template3_resampled.nii.gz . I don't know the reason why error happend.

Lucifer201210 avatar Aug 21 '24 17:08 Lucifer201210

Code looks correct, always good to verify that the file is accessible before calling brain_extraction

import os
mycachedir = '/home/wei/DeepLearning/Model_pth/'
os.listdir(mycachedir)
os.access(os.path.join(mycachedir, 'brainExtractionRobustT1.h5'), os.R_OK)

cookpa avatar Aug 21 '24 17:08 cookpa

And, fyi, I would always check with the self-contained, minimal tutorials for antsxnet available here.

ntustison avatar Aug 21 '24 18:08 ntustison

Code looks correct, always good to verify that the file is accessible before calling brain_extraction

import os
mycachedir = '/home/wei/DeepLearning/Model_pth/'
os.listdir(mycachedir)
os.access(os.path.join(mycachedir, 'brainExtractionRobustT1.h5'), os.R_OK)

Thanks! I tried the code above and the file is accessible.

截图 2024-08-23 14-52-02

The same error happened as before. Is it needed to install any other dependencies or Tensorflow/pytorch before using brain_exaction?

Lucifer201210 avatar Aug 23 '24 06:08 Lucifer201210

I made #130 in an effort to simplify cache issues like this

cookpa avatar Aug 24 '24 18:08 cookpa