help > Basic setup and usage for native Mac and Linux
Showing 1-7 of 7 posts
Display:
Results per page:
May 26, 2026  08:05 PM | Jesse Mahan - ACR
Basic setup and usage for native Mac and Linux

Hello, I am a total novice when it comes to using these types of programs. I have been in Windows IT support for two decades, so compiling things is not something I've ever needed to do; plus, very little Terminal use. I've been tasked with determining if MRI Reface can work for our use-cases, so I’m looking for help/direction on how to get these applications to function. I’m not a programmer or developer, so I’m really at a loss.


I'm attempting to first do a POC with the native 3.5 Mac version. Then, later, potentially having this run on a Linux EC2 using the native Linux 3.5 release.


We are using a Mac Studio M1 Max on Tahoe 26.5. I’ve installed MATLAB 2022a. Easy. Next steps: the Niftyreg and ANTS components.


#1 - Are these the best links to use for these components for this Mac?


Nifty reg: https://github.com/KCL-BMEIS/niftyreg


ANTS: https://github.com/antsx/ants


 


#2 - Should different links be used if trying to set up the native Linux install? If so, which?


 


#3 – Am I right that I should be using CMake to compile both Nifty reg and ANTS?


 


#4 - I see the CMake text files in the Github data. Is this the best resource for which cmds to run? Are people using these successfully to compile and run the applications?


 


#5 - Is Ubuntu still the recommended Linux OS? Is there a release version that should be used or is known-good?


 


#6 – Once the Niftyreg and ANTS components are believed to be successfully ‘installed’, how do you run MRI Reface?


 


Thanks for any help you can provide or resources you can point me to.

May 27, 2026  03:05 PM | Christopher Schwarz - Mayo Clinic
RE: Basic setup and usage for native Mac and Linux

Jesse,


Firstly, if you're not pretty comfortable in Linux to compile and set up all the dependencies, I would recommend skipping the Mac step and running on Linux using the Docker image. Docker relieves you of having to do any of that, but the Docker image is x86/x64 and won't run on Apple Silicon (ARM).  If your final production environment is Linux, your easiest route would be Docker on Linux.


For your more specific questions:
1) yes, those are the links to the ANTs and Niftyreg projects. 
2) On NITRC, our "default" version is Linux native (without Docker). The "Docker" version should run on any x86/x64 but Linux is the only thing we've tested. I'm not aware of anyone running it on Windows. The mac version (native) will run on Mac.
3) Yes, both of those projects use CMake to build
4) In an ideal case cmake builds look something like--
cd folder/with/source/code # folder will contain CMakeLists.txt
mkdir build
cd build
cmake ..
make
sudo make install

and repeat for ANTs.

5) The distribution shouldn't really make a difference. Ubuntu should be fine and if it wasn't working on Ubuntu I'm sure someone would have reported it by now, but we are running Rocky Linux 8 (descends from Centos, which descends from Redhat).

6) Use the included run_mri_reface.sh script


Good luck!
Chris Schwarz

May 29, 2026  01:05 PM | Jesse Mahan - ACR
RE: Basic setup and usage for native Mac and Linux

Thanks. Really appreciate the information. We'll try to implement on the Mac first. If we don't have success, then we'll try with Docker.

Jun 3, 2026  03:06 PM | Kazim Jafri - ACR
RE: Basic setup and usage for native Mac and Linux

Hi Chris,


I running across some errors and I was hoping you could help.


I cloned both repos (ANTS and Niftyreg) into our home directory, created the build folders, but ran into an error for niftyreg:


 corelabadmin@Corelab-Mac-Studio01-PRD build % make
[  1%] Building CXX object reg-lib/CMakeFiles/_reg_maths.dir/cpu/Maths.cpp.o
clang++: error: unsupported option '-msse3' for target 'arm64-apple-darwin25.5.0'
make[2]: *** [reg-lib/CMakeFiles/_reg_maths.dir/cpu/Maths.cpp.o] Error 1
make[1]: *** [reg-lib/CMakeFiles/_reg_maths.dir/all] Error 2
make: *** [all] Error 2
corelabadmin@Corelab-Mac-Studio01-PRD build % cd ..
corelabadmin@Corelab-Mac-Studio01-PRD niftyreg % cd ..


I suspect that it is anticipating x86 architecture instead of the more recent ARM architecture on Mac computers.


Any help that can be provided would be appreciated.

  Edited (Jun 3, 2026  03:06 PM)
Jun 3, 2026  04:06 PM | Christopher Schwarz - Mayo Clinic
RE: Basic setup and usage for native Mac and Linux

It's not something I remember encountering in the one time (so far) that I built this on Apple. When I Google your error, it suggests that disabling SSE would probably remove the Intel-specific flag. The niftyreg functionality mri_reface is using doesn't require any of the optional features, so for any niftyreg build problems I would disable whatever you can via cmake (here, SSE, but if errors with libjpeg, disable jpeg, etc.) and try again. The "ccmake" GUI interface to cmake would help you see what options are available. 


Chris

Jun 4, 2026  05:06 PM | Kazim Jafri - ACR
RE: Basic setup and usage for native Mac and Linux

I gave up on the manual compiling setup as I kept facing issues regarding implementation (not being able to find entities, etc.). So, I tried setting up the docker environment on Windows by leveraging WSL. There was no problem with setting up the image, but when I attempt to run the .sh, I get the following errors.


PHILADELPHIA+kjafri@RST-LTKJAFRI MINGW64 ~/Downloads/mri_reface_docker
$ bash run_mri_reface_docker.sh /c/Users/kjafri/Downloads/mri_reface_docker/input /c/Users/kjafri/Downloads/mri_reface_docker/output
Error using ADIR_ReFace
File not found: C:/Users/kjafri/AppData/Local/Temp/tmp.hiSWIStylc/inputs/input


What's next:
    Debug this container error with Gordon → docker ai "help me fix this container error"
cp: cannot stat '/tmp/tmp.hiSWIStylc/outputs/*': No such file or directory


I'm wondering if you can provide some insights as to where I may be going wrong.

Jun 4, 2026  11:06 PM | Christopher Schwarz - Mayo Clinic
RE: Basic setup and usage for native Mac and Linux

Kazim,


I'm sorry, I have limited ability to help you here. I've never tried to do this in Windows or ever used WSL. run_mri_reface_docker.sh is bash code, so you can view and/or modify the source if some changes are needed for your WSL environment. 



In this line, 
File not found: C:/Users/kjafri/AppData/Local/Temp/tmp.hiSWIStylc/inputs/input
we are seeing a windows-style path: ("C:/") rather than a Linux-style path ("/c/"). The error is coming from inside the Docker, so we shouldn't be seeing a path like that. My best guess is that mktemp -d (line 56 of run_mri_reface_docker.sh) is not behaving appropriately for the WSL/MINGW/Linux-emulating environment. This probably means that you have an environment value $TMPDIR that contains something like "C:/" when inside WSL you want something like "/c/" (or nothing at all, and let it be the default). You appear to be using some sort of AI-based translation layer ("Gordon"), and it may be the culpret of making changes to your environment (TMPDIR) that aren't appropriate here. 



Chris