Hi,
I have been running mri_reface on my local machine and the error its throwing is as follows (also in attachment):
(base) userName:~/refacing/mri_reface_docker$ sudo
./run_mri_reface_docker.sh
/home/userName/refacing/raw/mri/anat/BRS2023000P3_T1W_3D_TFE_SENSE2_20230711112735_301.nii.gz
/home/userName/refacing/processed/
-------------------------------------------------------
Running mri_reface, version 0.3.5
By: Christopher G. Schwarz schwarz.christopher@mayo.edu
Temp directory: /tmp/tp82fcd62e_e76b_4fb1_ab77_23e4f348bd51
Error using load_nii_hdr
Cannot find file
"/tmp/tmp.dtbCzt1Zzu/inputs/BRS2023000P3_T1W_3D_TFE_SENSE2_20230711112735_301.gz.nii".
Error in load_nii_noxform (line 13)
Error in ADIR_ReFace (line 322)
cp: cannot stat '/tmp/tmp.dtbCzt1Zzu/outputs/*': No such file or directory
- I did chmod 777 on all directories being accessed by the program including my /tmp/ directory to help facilitate it.
- The problem seems to be in the docker run line of code. I
placed "echo" statements throughout the code to catch this. (as
seen in attachment)
- docker run --rm -ti --mount type=bind,src=$tmpdir,target=$tmpdir mri_reface run_mri_reface.>
- I do not understand why its trying to access my /tmp/ directory instead of just accessing the nifti from the path specified, espcially because /tmp/ and the path where I am running mri_reface is in a different place.
Any help would be welcomed,
Sun
Sun,
I think the issue is the .gz inputs. Try running gunzip on the file first, and I think that will solve your issue. We didn't set it up to support .gz inputs, but this would be a good enhancement for us to add in the future. Unrelatedly, you shouldn't need to run this as root; you could remove the sudo. The /tmp directories are because you're getting print messages from inside the Docker instance. It's not /tmp on your filesystem but inside the Docker.
Let me know if that helps.
Best regards,
Chris Schwarz
I was having the same problem, but gunzip didn't resolve things. I'm using Ubuntu 24.04.2 LTS.
~/nifti $ ./run_mri_reface_docker.sh
PGBM-020-1.3.6.1.4.1.14519.5.2.1.4429.7055.247305732462907069875129639452.nii
./mri-reface-output -imType T2
cp: cannot stat
'PGBM-020-1.3.6.1.4.1.14519.5.2.1.4429.7055.247305732462907069875129639452.nii':
No such file or directory
Error using ADIR_ReFace
File not found:
/tmp/tmp.GS09StOInV/inputs/PGBM-020-1.3.6.1.4.1.14519.5.2.1.4429.7055.247305732462907069875129639452.nii
cp: cannot stat '/tmp/tmp.GS09StOInV/outputs/*': No such file or
directory
Justin,
This doesn't look like a complete output from the console. If
you're seeing the "ADIR_ReFace" name, then the code has gotten from
the wrapping shell script into the compiled-Matlab function, but
what you've given me is missing the banner and the stacktrace that
would come from an error in that part of the code. Can you please
try to give me a more complete console log? Naively guessing with
only what I have, I would try renaming the nifti to something more
simplistic. All those periods may be messing up the filename vs.
extension parsing.
Best regards,
Chris Schwarz
Thanks Chris, re-naming the files to use dashes instead of periods fixed the issue!
Originally posted by Justin Kirby:
Thanks Chris, re-naming the files to use dashes instead of periods fixed the issue!
Thanks for reporting back! I'm glad it was an easy workaround. Please don't hesitate to reach out if you have more issues or feedback. If there's anything I can do to make mri_reface more usable for TCIA and similar projects, I would do my best to make that happen.
Chris
Originally posted by Christopher Schwarz:
Originally posted by Justin Kirby:
Thanks Chris, re-naming the files to use dashes instead of periods fixed the issue!
Thanks for reporting back! I'm glad it was an easy workaround. Please don't hesitate to reach out if you have more issues or feedback. If there's anything I can do to make mri_reface more usable for TCIA and similar projects, I would do my best to make that happen.
Chris
Hello. I think I'm experiencing the same issue here:
[panda_user@dom14044 mri_reface_docker]$ time ./run_mri_reface_docker.sh test/t1_2.nii test_t1/ -imType T1
Warning: ADIR_cp: the following warnings were produced:
> In ADIR_cp (line 171)
In ADIR_ReFace (line 271)
cp: cannot open '/tmp/tmp.kufO28OHyS/inputs/t1_2.nii' for reading: Permission denied]
-------------------------------------------------------
Running mri_reface, version 0.3.5
By: Christopher G. Schwarz schwarz.christopher@mayo.edu
Temp directory: /tmp/tp74854768_777b_4317_bf48_f1b4b816c1a1
Error using load_nii_hdr
Cannot open file /tmp/tmp.kufO28OHyS/inputs/t1_2.nii.
Error in load_nii_noxform (line 13)
Error in ADIR_ReFace (line 322)
cp: cannot stat '/tmp/tmp.kufO28OHyS/outputs/*': No such file or directory
real 0m8.825s
user 0m0.017s
sys 0m0.033s
In my case, I can get pretty
stripped down with the naming, but I'm still getting this
ADIR_ReFace error. Oddly, this works on a
T2 from the same session.
Any help would be much appreciated!
Thanks,
Bill
Bill,
I'm runing your exact command with your exact filenames, and it's not reproducing your error (below). My best guess is something you-specific, like maybe you mistyped your input filename or your user doesn't have access to open that file. It doesn't seem to be an issue with your filenames, in your case.
Best,
Chris
$ time ./run_mri_reface_docker.sh test/t1_2.nii test_t1/ -imType
T1
-------------------------------------------------------
Running mri_reface, version 0.3.5
By: Christopher G. Schwarz schwarz.christopher@mayo.edu
Temp directory: /tmp/tpaef8765c_ef9c_4d65_9334_d52aeb7ffcb8
Target file: /tmp/tmp.5YJ1Kh57kU/inputs/t1_2.nii
Output directory: /tmp/tmp.5YJ1Kh57kU/outputs
Target image type: T1
Template:
/home/reface-user/.mcrCache9.12/mri_re0/mri_reface/images/MCALT_FaceTemplate_T1.nii
Face atlas:
/home/reface-user/.mcrCache9.12/mri_re0/mri_reface/images/MCALT_FaceMask.nii
Calculating affine parameters to template. This will take some
time.
[...]
Originally posted by wbbevis:
Originally posted by Christopher Schwarz:
Originally posted by Justin Kirby:
Thanks Chris, re-naming the files to use dashes instead of periods fixed the issue!
Thanks for reporting back! I'm glad it was an easy workaround. Please don't hesitate to reach out if you have more issues or feedback. If there's anything I can do to make mri_reface more usable for TCIA and similar projects, I would do my best to make that happen.
Chris
Hello. I think I'm experiencing the same issue here:
[panda_user@dom14044 mri_reface_docker]$ time ./run_mri_reface_docker.sh test/t1_2.nii test_t1/ -imType T1
Warning: ADIR_cp: the following warnings were produced:
> In ADIR_cp (line 171)
In ADIR_ReFace (line 271)
cp: cannot open '/tmp/tmp.kufO28OHyS/inputs/t1_2.nii' for reading: Permission denied]
-------------------------------------------------------
Running mri_reface, version 0.3.5
By: Christopher G. Schwarz schwarz.christopher@mayo.edu
Temp directory: /tmp/tp74854768_777b_4317_bf48_f1b4b816c1a1
Error using load_nii_hdr
Cannot open file /tmp/tmp.kufO28OHyS/inputs/t1_2.nii.
Error in load_nii_noxform (line 13)
Error in ADIR_ReFace (line 322)
cp: cannot stat '/tmp/tmp.kufO28OHyS/outputs/*': No such file or directory
real 0m8.825s
user 0m0.017s
sys 0m0.033s
In my case, I can get pretty stripped down with the naming, but I'm still getting this ADIR_ReFace error. Oddly, this works on a T2 from the same session.
Any help would be much appreciated!
Thanks,
Bill
Oop, yep, it was a permissions issue. Thanks, Chris!
Bill
Dear Christopher Schwarz,
It looks like I'm having similar issues to multiple other individuals in the thread and I am having trouble diagnosing the problem.
So far I have attempted:
1) used gunzip to convert my .nii.gz into .nii;
2) simplified input .nii file name;
3) placed the .nii and output directory files in the same directory as run_mri_reface_docker.sh
My current input (from the appropriate working directory) is as follows:
$ time ./run_mri_reface_docker.sh CHUM039.nii mri_reface_output/ -imType CT
The resulting output is as follows:
Error using ADIR_ReFace
File not found:
C:/.../AppData/Local/Temp/tmp.p0YZ69tric/inputs/CHUM039.nii
cp: cannot stat '/tmp/tmp.p0YZ69tric/outputs/*': No such file or directory
real 0m21.212s
user 0m0.384s
sys 0m0.613s
I am unsure what additional steps I can take to help troubleshoot this issue and any assistance would be greatly appreciated. Thank you!
(I am more used to working with Python scripts so a lot of this is something I'm learning as I go; I do not know how to create a complete console output as referenced previously in this thread.)
Best,
Anthony Kang
Is the "C:/.../" part a direct copy/paste or is that were you omitted your actual name/username? If you omitted your username, is there a space in your username? That could be it.
I'm guessing this has something to do with running the docker in Windows, which is not something we have tested, and I'm not sure I've heard of others doing so either. You might be the first to try it.
Best,
Chris
Dear Chris,
Thank you so much for getting back to me so fast!
The part where I put the "C:/.../" is where I omitted my username, which only contains lowercase and uppercase letters.
Currently, how I tried to set this up is that I downloaded mri_reface 0.3.5 and Docker on my Windows machine. Since I couldn't figure out how to run the .sh file on Windows, I opened a git GUI window, ran the docker load command in the git window, and tried to run the .sh file from there, which then led to the error that I had in the post.
I wasn't sure if I could run mri_reface on my Windows PC because it is all that I currently have access to, so I just gave it a try. What kind of set up would be the easiest/would you recommend?
I greatly appreciate your time and consideration. My apologies as I am very new to this and that I am trying things that should not be done.
Best,
Anthony
Dear Chris,
I just wanted to provide an update. I tried to do everything on WSL2 (mounting my drive, loading Docker, running the .sh) and, combined with the above findings in this thread, I was able to get mri_reface to run.
Thank you so much for your help!
Best,
Anthony Kang
