Closed sbajaj1 closed 8 months ago
Hey @sbajaj1 and thanks for checking out LST-AI!
So Step 6.1 downloads and installs a pre-compiled version of greedy (that we compiled on Ubuntu), so I am unsure whether that pre-compiled version would work on Mac OS. I would recommend to just give it a try, i.e. use a T1w and FLAIR and run lst. Please report if that works for you :+1:
If you encounter any problems, we might use Step 6.2 (compiling greedy on MAC) instead of Step 6.1. However, I have not tested on MAC (and do not have a MAC), so we might need to troubleshoot that together if you run into any problems.
Hi Julian,
Thanks for your quick response. I am having serious trouble in installing this toolbox (may be because the instructions are not valid for Mac). Please see my steps below after starting from scratch. I would greatly appreciate your help resolving this:
apt-get does not work for Mac, so I ran: brew update && brew install git wget unzip python3 (all of the above are now installed, including pip3 which is I think part of python3)
Following set of commands work fine: mkdir lst_directory cd lst_directory python3 -m venv /Users/sbajaj/ source /Users/sbajaj/bin/activate
Following set of commands work fine: git clone https://github.com/CompImg/LST-AI/ cd LST-AI
but pip install -e . gives me following error, which I am unable to resolve: ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11; 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10; 1.7.2 Requires-Python >=3.7,<3.11; 1.7.3 Requires-Python >=3.7,<3.11; 1.8.0 Requires-Python >=3.8,<3.11; 1.8.0rc1 Requires-Python >=3.8,<3.11; 1.8.0rc2 Requires-Python >=3.8,<3.11; 1.8.0rc3 Requires-Python >=3.8,<3.11; 1.8.0rc4 Requires-Python >=3.8,<3.11; 1.8.1 Requires-Python >=3.8,<3.11 ERROR: Could not find a version that satisfies the requirement tensorflow<2.12.0 (from lst-ai) (from versions: 2.13.0rc0, 2.13.0rc1, 2.13.0rc2, 2.13.0, 2.13.1, 2.14.0rc0, 2.14.0rc1, 2.14.0, 2.14.1, 2.15.0rc0, 2.15.0rc1, 2.15.0) ERROR: No matching distribution found for tensorflow<2.12.0
I then updated my python to 3.9, still I get similar error about tensor flow as following:
ERROR: Could not find a version that satisfies the requirement tensorflow<2.12.0 (from lst-ai) (from versions: 2.13.0rc0, 2.13.0rc1, 2.13.0rc2, 2.13.0, 2.13.1, 2.14.0rc0, 2.14.0rc1, 2.14.0, 2.14.1, 2.15.0rc0, 2.15.0rc1, 2.15.0) ERROR: No matching distribution found for tensorflow<2.12.0
Thank you for the debugs. Can you try relaxing the version restrictions for tensorflow in setup.py?
From:
install_requires = [
'numpy<1.24.0',
'pillow<10.1.0',
'scipy>=1.9.0',
'scikit-image>=0.21.0',
'tensorflow<2.12.0',
'tensorflow-addons<0.20.0',
'nibabel>=4.0.0',
'requests>=2.20.0'
],
To e.g.
install_requires = [
'numpy<1.24.0',
'pillow<10.1.0',
'scipy>=1.9.0',
'scikit-image>=0.21.0',
'tensorflow',
'tensorflow-addons',
'nibabel>=4.0.0',
'requests>=2.20.0'
],
Hi Julian,
That has partially resolved the issue- thank you so much for that. After I edited setup.py file as you suggested I get the following warning after I check if lst is installed fine:
/Users/sbajaj/lib/python3.9/site-packages/tensorflow_addons/utils/tfa_eol_msg.py:23: UserWarning:
TensorFlow Addons (TFA) has ended development and introduction of new features. TFA has entered a minimal maintenance and release mode until a planned end of life in May 2024. Please modify downstream libraries to take dependencies from other repositories in our TensorFlow community (e.g. Keras, Keras-CV, and Keras-NLP).
For more information see: https://github.com/tensorflow/addons/issues/2807
warnings.warn( ###########################
Thank you for using LST-AI. If you publish your results, please cite our paper: Wiltgen T, McGinnis J, Schlaeger S, Voon C, Berthele A, Bischl D, Grundl L, Will N, Metz M, Schinz D, Sepp D,Prucker P, Schmitz-Koep B, Zimmer C, Menze B, Rueckert D, Hemmer B, Kirschke J, Muehlau M, Wiestler B. LST-AI: a Deep Learning Ensemble for Accurate MS Lesion Segmentation. medRxiv preprint 10.1101/2023.11.23.23298966, 2023. ###########################
usage: lst [-h] --t1 T1 --flair FLAIR --output OUTPUT [--existing_seg EXISTING_SEG] [--temp TEMP] [--segment_only] [--annotate_only] [--stripped] [--threshold THRESHOLD] [--fast-mode] [--device DEVICE] [--threads THREADS]
If I ignore the above warning and run lst command as following, I get error:
$ lst --t1 /Users/sbajaj/BRAINIX_NIFTI_T1.nii.gz --flair /Users/sbajaj/BRAINIX_NIFTI_FLAIR.nii.gz --output /Users/sbajaj/check_output
/Users/sbajaj/lib/python3.9/site-packages/tensorflow_addons/utils/tfa_eol_msg.py:23: UserWarning:
TensorFlow Addons (TFA) has ended development and introduction of new features. TFA has entered a minimal maintenance and release mode until a planned end of life in May 2024. Please modify downstream libraries to take dependencies from other repositories in our TensorFlow community (e.g. Keras, Keras-CV, and Keras-NLP).
For more information see: https://github.com/tensorflow/addons/issues/2807
warnings.warn( ###########################
Thank you for using LST-AI. If you publish your results, please cite our paper: Wiltgen T, McGinnis J, Schlaeger S, Voon C, Berthele A, Bischl D, Grundl L, Will N, Metz M, Schinz D, Sepp D,Prucker P, Schmitz-Koep B, Zimmer C, Menze B, Rueckert D, Hemmer B, Kirschke J, Muehlau M, Wiestler B. LST-AI: a Deep Learning Ensemble for Accurate MS Lesion Segmentation. medRxiv preprint 10.1101/2023.11.23.23298966, 2023. ###########################
Looking for model weights in /Users/sbajaj/bin.
Images need to be skull-stripped. Processing with HD-BET.
Traceback (most recent call last):
File "/Users/sbajaj/bin/lst", line 269, in
I am not getting error while installing greedy - but still even after having lst command showing OK in my terminal, the analysis command is showing above error.
Good morning @sbajaj1, thanks for doing all of the debugging. That's super good for troubleshooting. And thank you for being so patient with the installation process, we did not for see MAC Users installing LST-AI natively that soon, and developed LST-AI for the Linux platforms.
In general, and perhaps I should have mentioned this earlier as in retrospect perhaps that was not ultimately clear. (If so, please let me know and I will add this to the README.md. Also, sincere apologies!). You should always be able to use the docker containers (provided in CPU and GPU) to build and run dockerized versions of LST-AI instead of natively installing it on your system. For MAC OSX, I would use the CPU-version as Nvidia GPUs are likely not supported.
If you want to continue with the native installation of LST-AI on MAC OS, I have the following advice:
Likely, the installed version of greedy (which we compiled on Ubuntu) does not work on MAC OS. To test that, we can try the following. Could you please open a new terminal and call greedy
? It should display the options menu, e.g.:
(base) juli@juli-Latitude-7400:~$ greedy
greedy: Paul's greedy diffeomorphic registration implementation
Usage:
greedy [options]
Required options:
-d DIM : Number of image dimensions
-i fix.nii mov.nii : Image pair (may be repeated)
-o <file> : Output file (matrix in affine mode; image in deformable mode,
[...]
Environment variables:
GREEDY_DATA_ROOT : if set, filenames can be specified relative to this path
If that is not the case, then you will need to download a different version of greedy - which fortunately is available for MAC OS, and you can install / download the package for MAC OS. You would then replace the binary you placed in step 6.1. (II) with the binary you just downloaded.
Did that help?
Cheers, Julian
**Hi Julian,
Thanks for the details about next steps. When I try docker, I am getting the following error:
[ 7/25] RUN pip install -e .:
0.257 Obtaining file:///custom_apps/lst_directory/LST-AI
0.258 Preparing metadata (setup.py): started
0.319 Preparing metadata (setup.py): finished with status 'done'
0.453 Collecting nibabel>=4.0.0
0.589 Downloading nibabel-5.1.0-py3-none-any.whl (3.3 MB) 1.833 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 2.7 MB/s eta 0:00:00 2.149 Collecting numpy<1.24.0 2.173 Downloading numpy-1.23.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.9 MB) 4.780 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.9/13.9 MB 6.0 MB/s eta 0:00:00 5.134 Collecting pillow<10.1.0 5.159 Downloading Pillow-10.0.1-cp310-cp310-manylinux_2_28_aarch64.whl (3.5 MB) 5.616 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.5/3.5 MB 7.6 MB/s eta 0:00:00 5.684 Collecting requests>=2.20.0 5.705 Downloading requests-2.31.0-py3-none-any.whl (62 kB) 5.712 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 KB 11.2 MB/s eta 0:00:00 5.821 Collecting scikit-image>=0.21.0 5.845 Downloading scikit_image-0.22.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.1 MB) 7.358 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.1/14.1 MB 9.5 MB/s eta 0:00:00 7.569 Collecting scipy>=1.9.0 7.594 Downloading scipy-1.11.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (32.9 MB) 10.28 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 32.9/32.9 MB 12.6 MB/s eta 0:00:00 10.37 ERROR: Could not find a version that satisfies the requirement tensorflow-addons<0.20.0 (from lst-ai) (from versions: none) 10.37 ERROR: No matching distribution found for tensorflow-addons<0.20.0Dockerfile:20
18 | RUN git clone https://github.com/CompImg/LST-AI/ 19 | WORKDIR /custom_apps/lst_directory/LST-AI 20 | >>> RUN pip install -e . 21 |
22 | # Setup for greedy (Choose either pre-compiled or compilation from source)ERROR: failed to solve: process "/bin/sh -c pip install -e ." did not complete successfully: exit code: 1**
@sbajaj1 Oh no, we are running into the "chicken or the egg" problem - i.e., if you use MAC OS to build the docker container, then the installation on MAC OS needs to work, which was why we turned to docker in the first place.
However, we can bypass this problem if I share the pre-built docker container with you. So I just built the newest version of the docker (CPU) container on our Ubuntu server, and I am currently uploading it to dockerhub (which unfortunately takes some time as it's 12GB large).
The next stops will be:
However, I will give you the exact instructions to do so once the upload has completed.
I am deeply sorry that we did not provide the docker container in the first place; I did not consider that you need a working solution for MAC to build the docker container. Thank you very much for your patience, and I think that we will have finished the installation process for you, and you will have a working LST-AI solution for your MAC laptop.
Thank you for your understanding,
I will give you some more instructions soon once the upload has completed! :slightly_smiling_face:
Have a nice evening, Julian
Great - thank you so much Julian.
I will wait for the newest version and the next steps. Thank you so much for all your help !!
Thanks for your patience @sbajaj1 - the next steps should hopefully fix the issues and allow you to run LST-AI on your MAC.
First things first, I compiled a CPU docker container, so it won't be using your MAC's GPU, as we don't support that (yet). Also, CPU docker's are much easier to handle as we cannot really forsee which GPU hardware our user base is going to leverage (we would even need different GPU docker versions for Nvidia GPU / CUDA Versions).
Consequently, segmentation will take significantly longer (in the range of minutes on a CPU rather than seconds on the GPU). Including the registration and skull-stripping I expect it to be >10mins.
However, the advantage should be that it actually works :slightly_smiling_face: - and I will work on a GPU-MAC version if I can get one in my hands any time soon (e.g. from a colleague).
That being said, and without further ado, here is the workflow for installing the CPU-docker on your system:
Please open a terminal and run the following command:
docker build -t jqmcginnis/lst-ai_cpu:latest .
This retrieves the pre-built docker container from dockerhub.
Run the updated docker instructions from here (not the ones from the Readme):
docker run -v /home/ginnis/lst_in:/custom_apps/lst_input -v /home/ginnis/lst_out/:/custom_apps/lst_output -v /home/ginnis/lst_temp/:/custom_apps/lst_temp jqmcginnis/lst-ai_cpu:latest --t1 /custom_apps/lst_input/t1.nii.gz --flair /custom_apps/lst_input/flair3d.nii.gz --output /custom_apps/lst_output --temp /custom_apps/lst_temp --device cpu
Some more notes:
--device cpu
instruction, as this will tell LST-AI to run your code on the CPU. 0
or any other GPU will throw an error that you don't have the Nvidia drivers installed. /home/ginnis/lst_in
should already exist, you can replace them with anything you like (and modify the input images' names accordingly).Hope this helped, and please let me know, we will update the Readme.md according to your experiences once we have a working solution for MAC.
Thanks again, Julian
Hi Julian,
Ok so I ran the two commands you wrote. The first one, it was showing some error, so I installed docker app on my Mac Pro and ran jqmcginnis/lst-ai_cpu:latest. It seems docker is running lst-ai_cpu fine. Please see attached screenshot.
Then I ran the following command in terminal:
docker run -v lst_in:/custom_apps/lst_input -v lst_out:/custom_apps/lst_output -v lst_temp:/custom_apps/lst_temp jqmcginnis/lst-ai_cpu:latest --t1 /Users/sbajaj/sample_test/BRAINIX_NIFTI_T1.nii.gz --flair /Users/sbajaj/sample_test/BRAINIX_NIFTI_FLAIR.nii.gz --output /Users/sbajaj/lst_output --temp /Users/sbajaj/lst_temp --device cpu
But this gives me following warning: WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
(however, adding --platform linux/amd64 to the command got rid of this above warning)
and then shows The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.
And now, its been forever, I do not see any activity on my terminal, please see attached screenshot.
Docker status screenshot is also attached.
I am not sure if I am running my docker run command correctly or not?
Hi @sbajaj1
Thanks for staying with us here, and I am sorry that the process of getting this up and running on MAC OS is so utterly painful. I expected it to be a lot easier with docker, as tensorflow and pytorch (and other python libraries) are cross-platform (and they work out of the box in many projects), however in our specific case it seems to be particularly hard.
I dug deeper, and it feels like the issue is centered around tensorflow / tensorflow-addons incompatibility issues with MAC-OS. This GitHub issue includes a rather lengthy thread regarding the problems we are also running into. I tried building the docker container on my ubuntu laptop with the --platform linux/amd64,linux/arm64/v8
flag, but the build process fails even if I relax the package constraints as we did earlier:
#0 56.42 Collecting tensorflow
#0 56.46 Downloading tensorflow-2.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.2 kB)
#0 57.02 ERROR: Could not find a version that satisfies the requirement tensorflow-addons (from lst-ai) (from versions: none)
#0 57.02 ERROR: No matching distribution found for tensorflow-addons
------
Dockerfile:20
--------------------
18 | RUN git clone https://github.com/jqmcginnis/LST-AI/
19 | WORKDIR /custom_apps/lst_directory/LST-AI
20 | >>> RUN pip install -e .
21 |
22 | # Setup for greedy (Choose either pre-compiled or compilation from source)
--------------------
error: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c pip install -e ." did not complete successfully: exit code: 1
Moreover, I have found that tensorflow-addons in particular is difficult to get up and running on MAC-OS, as documented here. While this makes me hopeful that it is possible, I would likely need access to a MAC-OS laptop to test and getting everything up and running myself.
With this in mind, I reached out and asked a collaborator (who is working on MAC OS, and is very experienced with docker) for help and we will meet on Friday. Thus, I would propose that I(we do some more debugging on our end, and report back to you, once I know more.
In the meantime, please let me know if I can assist with the segmentation. E.g. if you have a tight schedule and need segmentations now, I would be willing to run lst-ai for you, if you are able to share data (naturally over a private channel and not via github).
Hi Julian,
That really explains the issues.
Thank you so much once again for your willingness and hard work in getting this resolved. Also, thanks for offering help with segmentation at your end. Good news is that I can definitely wait until next week (or more if needed) as I do not have specific deadline. I will just put this project on brief hold without any issue. So, please take your time!
I am looking forward to receiving the next update and further using this LST-AI method.
Best, Sahil
Hi @sbajaj1
Thank you very much for your patience. With the help of Florian Kofler (Helmholtz), I have been able to narrow it down to the unavailability of Tensorflow-Addons for the arm64 platform, which, frankly speaking, is very surprising to me. Apparently, Tensorflow-Addons has never been supported for both linux and MAC-OS ARM architectures.
However, we are not giving up, and I will check in the upcoming days if we can replace the functionality we have been using from this library with (1) and own implementation or (2) if I can compile tensorflow-addons for arm64 platforms by ourselves.
Just wanted to give you a quick update and let you know that we are (still) working (with highest priority) on a solution to make LST-AI work on your, and potentially other, ARM64 platforms.
Have a nice day,
Julian
yes, we could reproduce your issue and are working on a fix.
Currently, there seem to be three options:
I am curious about which solution will win in the end :)
Hi @sbajaj1
Thank you very much for your patience. With the help of Florian Kofler (Helmholtz), I have been able to narrow it down to the unavailability of Tensorflow-Addons for the arm64 platform, which, frankly speaking, is very surprising to me. Apparently, Tensorflow-Addons has never been supported for both linux and MAC-OS ARM architectures.
However, we are not giving up, and I will check in the upcoming days if we can replace the functionality we have been using from this library with (1) and own implementation or (2) if I can compile tensorflow-addons for arm64 platforms by ourselves.
Just wanted to give you a quick update and let you know that we are (still) working (with highest priority) on a solution to make LST-AI work on your, and potentially other, ARM64 platforms.
Have a nice day,
Julian
Great - thank you so much Julian @jqmcginnis and Florian @neuronflow for the update and working on this. That sounds like a plan. I am looking forward to getting the next updates.
@sbajaj1 It seems that just right in time for Christmas, we might have a little :gift:
For the last two weeks, @neuronflow and I have been debugging multiple issues arising with MacOS / ARM64 Dockerfiles, and I am happy to share that we have made quite some progress:
To obtain the new LST-AI image, please do the following:
docker pull jqmcginnis/lst-ai_cpu:latest
On your MAC OS platform, this should automatically fetch the ARM64 version (linux/amd64 would be available as well, but not suited for your platform).
Then, you can finally run:
docker run -v /Users/nf/projects/lst/input:/custom_apps/lst_input -v /Users/nf/projects/lst/output:/custom_apps/lst_output -v /Users/nf/projects/lst/temp:/custom_apps/lst_temp jqmcginnis/lst-ai_cpu:latest --t1 /custom_apps/lst_input/T1W.nii.gz --flair /custom_apps/lst_input/FLAIR.nii.gz --output /custom_apps/lst_output --temp /custom_apps/lst_temp --device cpu
Please let us know if this works for you.
We will update the Dockerfile and Release soon, once we have obtained your feedback. And finally, a big hank you to @neuronflow again, and thank you for your patience @sbajaj1!
Cheers, Julian
Hi Julian,
Thank you so much for working on this. Sorry for the late response (I was on Christmas break). The docker pull command ran fine without any issue and the download was successful, but the docker run command is giving the following error. It seems there is some minor issue (may be from my side):
sudo docker run -v /Users/nf/projects/lst/input:/custom_apps/lst_input -v /Users/nf/projects/lst/output:/custom_apps/lst_output -v /Users/nf/projects/lst/temp:/custom_apps/lst_temp jqmcginnis/lst-ai_cpu:latest --t1 /Users/sbajaj/sample_test/BRAINIX_NIFTI_T1.nii.gz --flair /Users/sbajaj/sample_test/BRAINIX_NIFTI_FLAIR.nii.gz --output /custom_apps/lst_output --temp /custom_apps/lst_temp --device cpu Password: docker: Error response from daemon: error while creating mount source path '/host_mnt/Users/nf/projects/lst/input': mkdir /host_mnt/Users/nf: permission denied. ERRO[0000] error waiting for container:
does the same happen when you ran without sudo?
/host_mnt/Users/nf/projects/lst/input
Does this folder and the others you mount exist already? What are their permissions?
Hi @neuronflow
Yes, I get the same error without sudo as well. No, these folders do not exist already. And, permissions are fine too as I am the only admin. May be something wrong in the command. Just to reiterate, I am doing the following (my data T1w and FALIR images are at the location: /Users/sbajaj/sample_test/....nii.gz
MDACM0CL9004107:~ sbajaj$ docker pull jqmcginnis/lst-ai_cpu:latest
latest: Pulling from jqmcginnis/lst-ai_cpu Digest: sha256:76d1108fae4835f32f41852f5c27492b94ef39d9696eec06cfed5c0086857a2d Status: Image is up to date for jqmcginnis/lst-ai_cpu:latest docker.io/jqmcginnis/lst-ai_cpu:latest
MDACM0CL9004107:~ sbajaj$ docker run -v /Users/nf/projects/lst/input:/custom_apps/lst_input -v /Users/nf/projects/lst/output:/custom_apps/lst_output -v /Users/nf/projects/lst/temp:/custom_apps/lst_temp jqmcginnis/lst-ai_cpu:latest --t1 /Users/sbajaj/sample_test/BRAINIX_NIFTI_T1.nii.gz --flair /Users/sbajaj/sample_test/BRAINIX_NIFTI_FLAIR.nii.gz --output /Users/sbajaj/lst_output --temp /Users/sbajaj/lst_temp --device cpu
docker: Error response from daemon: error while creating mount source path '/host_mnt/Users/nf/projects/lst/input': mkdir /host_mnt/Users/nf: permission denied. ERRO[0000] error waiting for container:
Hey @sbajaj1 - Happy New Year :sparkles:
Thank you for the helpful debugging - I think there are some misunderstandings with the volume mounting process, i.e. wrong mounting of paths (/Users/nf/projects/
). This here is the initial command:
docker run -v /Users/nf/projects/lst/input:/custom_apps/lst_input -v /Users/nf/projects/lst/output:/custom_apps/lst_output -v /Users/nf/projects/lst/temp:/custom_apps/lst_temp jqmcginnis/lst-ai_cpu:latest --t1 /custom_apps/lst_input/T1W.nii.gz --flair /custom_apps/lst_input/FLAIR.nii.gz --output /custom_apps/lst_output --temp /custom_apps/lst_temp --device cpu
You should replace the /Users/nf/projects/lst/input
, /Users/nf/projects/lst/output
, /Users/nf/projects/lst/temp
with paths on your system that already exist, e.g. Users/sbajaj/sample_test
. The latter parts of the code should remain unchanged, as the docker container looks for these files in the specific directories, e.g. /custom_apps/lst_input/
, /custom_apps/lst_output/
and /custom_apps/lst_temp/
. Only the filename (e.g. BRAINIX_NIFTI_FLAIR.nii.gz
) must be inserted. Can you please try this here:
docker run -v /Users/sbajaj/sample_test/:/custom_apps/lst_input -v /Users/sbajaj/lst_output:/custom_apps/lst_output -v /Users/sbajaj/lst_temp:/custom_apps/lst_temp jqmcginnis/lst-ai_cpu:latest --t1 /custom_apps/lst_input/BRAINIX_NIFTI_T1.nii.gz --flair /custom_apps/lst_input/BRAINIX_NIFTI_FLAIR.nii.gz --output /custom_apps/lst_output --temp /custom_apps/lst_temp --device cpu
Let me know if this works :+1:
Cheers, Julian
Happy new year too! 🚀 Yes, make sure that the folders you mount already exist on your host system. Please report back with what you get when running Julian's command :)
Hi @neuronflow @jqmcginnis
Now the command is working fine without any error. Thank you so much !
Just a follow-up quick question: Several files are generated (see attached)
and are now saved in lst_temp folder (though nothing is saved in lst_output). Is there any manual/description available about the details of the generated files? Also the LST-SPM toolbox generates lesion mask and volume/size of the lesion. I was wondering if LST_AI also somehow saves those lesion mask, volume/size files?
Thanks, Sahil
Can you copy-paste your console output, please?
The computation should take a while. The final results should appear in the output folder.
The temp folder should contain intermediate steps generated on the way toward populating the output folder.
PS: lesion size should be trivial to implement by counting voxels?
Hi @neuronflow
Here you go (I just noticed this error in this output: vnl_lbfgs: Error. Netlib routine lbfgs failed.):
MDACM0CL9004107:~ sbajaj$ docker run -v /Users/sbajaj/sample_test/:/custom_apps/lst_input -v /Users/sbajaj/lst_output:/custom_apps/lst_output -v /Users/sbajaj/lst_temp:/custom_apps/lst_temp jqmcginnis/lst-ai_cpu:latest --t1 /custom_apps/lst_input/BRAINIX_NIFTI_T1.nii.gz --flair /custom_apps/lst_input/BRAINIX_NIFTI_FLAIR.nii.gz --output /custom_apps/lst_output --temp /custom_apps/lst_temp --device cpu Limiting the number of threads to 12
N=7 NUMBER OF CORRECTIONS=5 INITIAL VALUES F= -10792.4 GNORM= 16.6195
I NFN FUNC GNORM STEPLENGTH 1 2 -10806.997 13.588 0.060 2 3 -10835.964 9.530 1.000 3 4 -10844.645 6.900 1.000 4 5 -10847.318 5.110 1.000 5 6 -10850.005 1.613 1.000 6 7 -10850.256 0.913 1.000 7 8 -10850.518 1.275 1.000 8 9 -10850.829 2.024 1.000 9 10 -10851.002 1.145 1.000 10 11 -10851.134 0.605 1.000 11 13 -10851.147 0.439 0.472 12 14 -10851.149 0.285 1.000 13 17 -10851.165 0.255 2.172 14 18 -10851.172 0.388 1.000 15 20 -10851.180 0.317 0.339 16 21 -10851.184 0.240 1.000 17 23 -10851.184 0.180 0.199 18 25 -10851.184 0.248 0.176 19 28 -10851.185 0.225 0.058 20 29 -10851.185 0.107 1.000 21 30 -10851.185 0.069 1.000 22 32 -10851.185 0.104 0.281 23 34 -10851.185 0.050 0.371 24 35 -10851.185 0.062 1.000 25 38 -10851.185 0.066 0.065 26 41 -10851.185 0.100 0.120 27 42 -10851.185 0.029 1.000 28 43 -10851.185 0.035 1.000 29 45 -10851.185 0.033 0.221 30 46 -10851.185 0.098 1.000 31 47 -10851.185 0.022 1.000 32 48 -10851.185 0.023 1.000 33 50 -10851.185 0.021 0.063 34 54 -10851.185 0.020 0.232 35 56 -10851.185 0.036 0.135 36 58 -10851.185 0.113 0.127 37 59 -10851.185 0.025 1.000 38 60 -10851.185 0.009 1.000 39 61 -10851.185 0.011 1.000 40 63 -10851.185 0.021 0.082 41 64 -10851.185 0.011 1.000 42 65 -10851.185 0.030 1.000 43 67 -10851.185 0.009 5.000 44 69 -10851.185 0.096 0.249 45 70 -10851.185 0.117 1.000 46 71 -10851.185 0.045 1.000 47 74 -10851.185 0.146 21.000 48 77 -10851.185 0.131 0.410 49 83 -10851.185 0.149 0.021 50 87 -10851.185 0.159 0.006 51 88 -10851.185 0.145 1.000 52 92 -10851.185 0.095 0.003 53 93 -10851.185 0.086 1.000 54 95 -10851.185 0.076 0.307 55 97 -10851.185 0.069 0.160 56 98 -10851.185 0.062 1.000 57 100 -10851.185 0.028 0.305 58 101 -10851.185 0.028 1.000 END OF LEVEL 0 Level 0 LastIter Metrics -10851.185220 Energy = -10851.185220 Level 0 Final RAS Transform: 0.9985 0.0521 0.0183 3.4550 -0.0525 0.9984 0.0188 13.2356 -0.0173 -0.0197 0.9997 27.0290 0.0000 0.0000 0.0000 1.0000
N=7 NUMBER OF CORRECTIONS=5 INITIAL VALUES F= -10778.8 GNORM= 5.16266
I NFN FUNC GNORM STEPLENGTH 1 2 -10782.704 2.734 0.194 2 3 -10785.193 1.989 1.000 3 4 -10786.876 2.169 1.000 4 5 -10788.100 1.243 1.000 5 6 -10788.466 0.373 1.000 6 7 -10788.499 0.177 1.000 7 10 -10788.529 0.287 1.958 8 11 -10788.546 0.288 1.000 9 12 -10788.555 0.326 1.000 10 13 -10788.566 0.286 1.000 11 14 -10788.570 0.382 1.000 12 15 -10788.575 0.125 1.000 13 17 -10788.576 0.098 0.333 14 18 -10788.577 0.114 1.000 15 19 -10788.577 0.100 1.000 16 20 -10788.578 0.087 1.000 17 21 -10788.578 0.124 1.000 18 22 -10788.579 0.062 1.000 19 23 -10788.579 0.082 1.000 20 24 -10788.579 0.081 1.000 21 25 -10788.579 0.030 1.000 22 26 -10788.579 0.032 1.000 23 28 -10788.580 0.021 0.074 24 29 -10788.580 0.024 1.000 25 30 -10788.580 0.033 1.000 26 31 -10788.580 0.012 1.000 27 33 -10788.580 0.010 0.227 28 34 -10788.580 0.013 1.000 29 35 -10788.580 0.008 1.000 30 37 -10788.580 0.012 0.291 31 38 -10788.580 0.010 1.000 32 39 -10788.580 0.016 1.000 33 40 -10788.580 0.012 1.000 34 41 -10788.580 0.008 1.000 35 42 -10788.580 0.004 1.000 36 46 -10788.580 0.025 1.602 37 49 -10788.580 0.025 0.023 38 50 -10788.580 0.023 1.000 END OF LEVEL 1 Level 1 LastIter Metrics -10788.579580 Energy = -10788.579580 Level 1 Final RAS Transform: 0.9983 0.0567 0.0123 3.4544 -0.0567 0.9984 -0.0064 13.7152 -0.0127 0.0057 0.9999 22.0855 0.0000 0.0000 0.0000 1.0000
N=7 NUMBER OF CORRECTIONS=5 INITIAL VALUES F= -10701.9 GNORM= 4.15881
I NFN FUNC GNORM STEPLENGTH 1 2 -10705.227 2.916 0.240 2 3 -10711.585 3.350 1.000 3 5 -10718.708 5.865 0.451 4 7 -10723.395 6.930 0.492 5 8 -10731.249 5.865 1.000 6 9 -10737.942 2.002 1.000 7 10 -10738.851 0.667 1.000 8 11 -10739.041 0.700 1.000 END OF LEVEL 2 Level 2 LastIter Metrics -10739.040989 Energy = -10739.040989 Level 2 Final RAS Transform: 0.9988 0.0480 0.0120 3.5851 -0.0479 0.9988 -0.0051 10.4865 -0.0122 0.0045 0.9999 9.2825 0.0000 0.0000 0.0000 1.0000 Limiting the number of threads to 12 vnl_lbfgs: Error. Netlib routine lbfgs failed. Limiting the number of threads to 12
N=7 NUMBER OF CORRECTIONS=5 INITIAL VALUES F= -10768.3 GNORM= 36.2245
I NFN FUNC GNORM STEPLENGTH 1 3 -10937.526 28.385 0.138 2 5 -11010.808 24.661 0.205 3 6 -11058.090 21.267 1.000 4 7 -11110.197 18.539 1.000 5 8 -11135.360 8.379 1.000 6 9 -11141.413 3.525 1.000 7 10 -11142.074 1.671 1.000 8 11 -11142.136 1.318 1.000 9 12 -11142.209 0.684 1.000 10 14 -11142.217 0.419 0.324 11 15 -11142.219 0.325 1.000 12 16 -11142.221 0.275 1.000 13 17 -11142.223 0.089 1.000 14 18 -11142.223 0.100 1.000 15 19 -11142.223 0.152 1.000 16 20 -11142.223 0.068 1.000 17 24 -11142.224 0.207 1.850 18 25 -11142.224 0.177 1.000 19 26 -11142.225 0.147 1.000 20 28 -11142.225 0.136 0.389 21 29 -11142.225 0.089 1.000 22 31 -11142.226 0.081 0.374 23 33 -11142.226 0.073 0.315 24 34 -11142.226 0.119 1.000 25 35 -11142.226 0.111 1.000 26 38 -11142.226 0.070 0.058 27 39 -11142.226 0.066 1.000 28 40 -11142.226 0.065 1.000 29 41 -11142.226 0.057 1.000 30 42 -11142.226 0.032 1.000 31 43 -11142.226 0.057 1.000 32 44 -11142.226 0.087 1.000 33 46 -11142.226 0.079 0.280 34 47 -11142.226 0.092 1.000 35 49 -11142.226 0.054 0.513 36 50 -11142.226 0.037 1.000 37 52 -11142.226 0.031 0.270 38 54 -11142.226 0.023 0.235 39 55 -11142.226 0.019 1.000 40 56 -11142.226 0.020 1.000 41 60 -11142.226 0.034 0.004 42 63 -11142.226 0.021 1.876 43 64 -11142.226 0.022 1.000 44 67 -11142.226 0.051 0.882 45 69 -11142.226 0.065 0.456 46 70 -11142.226 0.037 1.000 47 74 -11142.226 0.031 0.025 IFLAG= -1 LINE SEARCH FAILED. SEE DOCUMENTATION OF ROUTINE MCSRCH ERROR RETURN OF LINE SEARCH: INFO= 3 POSSIBLE CAUSES: FUNCTION OR GRADIENT ARE INCORRECT OR INCORRECT TOLERANCESEND OF LEVEL 0 Level 0 LastIter Metrics -11142.225666 Energy = -11142.225666 Level 0 Final RAS Transform: 0.9991 0.0402 0.0094 3.6260 -0.0406 0.9978 0.0516 11.1969 -0.0073 -0.0519 0.9986 7.2341 0.0000 0.0000 0.0000 1.0000
N=7 NUMBER OF CORRECTIONS=5 INITIAL VALUES F= -11372.3 GNORM= 15.1961
I NFN FUNC GNORM STEPLENGTH 1 2 -11374.182 21.484 0.066 2 3 -11378.979 8.304 1.000 3 4 -11381.134 7.330 1.000 4 5 -11388.074 11.559 1.000 5 6 -11391.727 9.126 1.000 6 8 -11392.089 7.213 0.213 7 9 -11392.767 1.915 1.000 8 10 -11392.848 0.921 1.000 9 11 -11392.870 0.404 1.000 10 12 -11392.877 0.215 1.000 11 13 -11392.879 0.216 1.000 12 14 -11392.880 0.128 1.000 13 15 -11392.881 0.075 1.000 14 16 -11392.881 0.092 1.000 15 17 -11392.881 0.059 1.000 16 18 -11392.881 0.020 1.000 17 19 -11392.881 0.017 1.000 18 21 -11392.881 0.015 0.329 19 23 -11392.881 0.006 0.440 20 24 -11392.881 0.007 1.000 21 25 -11392.881 0.004 1.000 22 26 -11392.881 0.002 1.000 23 27 -11392.881 0.002 1.000 24 28 -11392.881 0.003 1.000 25 30 -11392.881 0.004 0.317 26 32 -11392.881 0.004 0.428 27 34 -11392.881 0.003 0.368 28 35 -11392.881 0.002 1.000 29 37 -11392.881 0.002 0.236 30 39 -11392.881 0.002 0.491 31 42 -11392.881 0.001 0.042 32 43 -11392.881 0.002 1.000 END OF LEVEL 1 Level 1 LastIter Metrics -11392.881160 Energy = -11392.881160 Level 1 Final RAS Transform: 0.9988 0.0464 0.0127 3.7442 -0.0466 0.9988 0.0134 10.9368 -0.0121 -0.0140 0.9998 8.2613 0.0000 0.0000 0.0000 1.0000
N=7 NUMBER OF CORRECTIONS=5 INITIAL VALUES F= -11463.6 GNORM= 16.9441
I NFN FUNC GNORM STEPLENGTH 1 3 -11465.446 9.463 0.012 2 4 -11466.221 7.975 1.000 3 5 -11468.231 7.389 1.000 4 6 -11470.292 6.646 1.000 5 7 -11472.139 16.246 1.000 6 8 -11473.171 7.127 1.000 7 9 -11473.394 0.847 1.000 8 10 -11473.403 0.607 1.000 9 11 -11473.417 0.541 1.000 END OF LEVEL 2 Level 2 LastIter Metrics -11473.416639 Energy = -11473.416639 Level 2 Final RAS Transform: 0.9989 0.0464 0.0089 3.7775 -0.0465 0.9989 0.0025 10.8482 -0.0088 -0.0029 1.0000 8.1516 0.0000 0.0000 0.0000 1.0000 Limiting the number of threads to 12
######################## If you are using hd-bet, please cite the following paper: Isensee F, Schell M, Tursunova I, Brugnara G, Bonekamp D, Neuberger U, Wick A, Schlemmer HP, Heiland S, Wick W,Bendszus M, Maier-Hein KH, Kickingereder P. Automated brain extraction of multi-sequence MRI using artificialneural networks. arXiv preprint arXiv:1901.11341, 2019. ########################
File: /custom_apps/lst_temp/sub-X_ses-Y_space-mni_T1w.nii.gz preprocessing... image shape after preprocessing: (129, 153, 129) prediction (CNN id)... 0 1 2 3 4 running postprocessing... exporting segmentation... Limiting the number of threads to 12 Limiting the number of threads to 12
@sbajaj1 - great news :rocket: - happy you have obtained your first segmentations using LST-AI. That's also some great feedback for us regarding MAC-OS and we will work on merging this to master in the upcoming days.
Regarding your questions:
(1) Output files:
lst_out/
├── space-orig_desc-annotated_seg-lst.nii.gz --> seg. in native FLAIR space, annotated according to McDonalds criteria
└── space-orig_seg-lst.nii.gz --> binary seg. in native FLAIR space
The class labels for the annotated segmentation are:
Output labels:
1 == Periventricular
2 == Juxtacortical
3 == Subcortical
4 == Infratentorial
(2) Temp files:
LST.AI performs segmentation and annotation in the MNI152 template space. For users that would like to keep the registered T1w and FLAIR images and their corresponding segmentation masks, we allow to keep these files if the user provides a temp directory. If you skip the --temp
option, then LST-AI will create and delete the temp folder for you (and the temp files vanish).
├── affine_flair_to_mni.mat --> Registration Matrix obtained via greedy
├── affine_t1w_to_mni.mat --> Registration Matrix obtained via greedy
├── atlas_mask_warped.nii.gz --> Deformation Field obtained via greedy for annotation of lesions acc. to McD criteria
├── atlas_warp_field.nii.gz --> Deformation Field obtained via greedy for annotation of lesions acc. to McD criteria
├── sub-X_ses-Y_space-mni_brainmask.nii.gz --> Brain Mask in MNI space
├── sub-X_ses-Y_space-mni_desc-stripped_FLAIR.nii.gz --> Skull-stripped FLAIR in MNI
├── sub-X_ses-Y_space-mni_desc-stripped_T1w_mask.nii.gz --> Brainmask T1w in MNI space
├── sub-X_ses-Y_space-mni_desc-stripped_T1w.nii.gz --> Skull-stripped T1w Mask
├── sub-X_ses-Y_space-mni_FLAIR.nii.gz --> FLAIR in MNI space
├── sub-X_ses-Y_space-mni_seg-annotated.nii.gz --> Anno. Seg. in MNI Space
├── sub-X_ses-Y_space-mni_seg.nii.gz --> Binary Segmentation in MNI Space
├── sub-X_ses-Y_space-mni_T1w.nii.gz --> T1w (with skull) in MNI Space
├── sub-X_ses-Y_space-org_FLAIR_mask.nii.gz --> Brainmask in Native Space
├── sub-X_ses-Y_space-org_T1w_mask.nii.gz --> Brainmask T1w in Native Space
├── sub-X_ses-Y_space-orig_desc-stripped_FLAIR.nii.gz --> Stripped FLAIR in native space
├── sub-X_ses-Y_space-orig_desc-stripped_T1w.nii.gz --> Stripped FLAIR in native space
├── sub-X_ses-Y_space-orig_FLAIR.nii.gz --> copy of orig. FLAIR
├── sub-X_ses-Y_space-orig_seg-annotated.nii.gz --> output result: Ann. Seg. in native FLAIR space
├── sub-X_ses-Y_space-orig_seg.nii.gz --> output result: Binary Seg. in FLAIR space
└── sub-X_ses-Y_space-orig_T1w.nii.gz --> copy of T1w
(3) You are absolutely correct, LST-AI currently does not gather the statistics as the previous LST/SPM12 version. However, as you (and likely other users) require this, I quickly implemented this as a separate script here.
To compute your stats, you can run the script using the following command:
python3 compute_stats.py --in space-orig_seg-lst.nii.gz --out test_binary.csv
Num_Lesions | Num_Vox_Lesions | Lesion_Volume |
---|---|---|
29 | 2920 | 2920.0 |
python3 compute_stats.py --in space-orig_desc-annotated_seg-lst.nii.gz --out test_annotated.csv --multi-class
Region | Num_Lesions | Num_Vox | Lesion_Volume |
---|---|---|---|
Periventricular | 7 | 1889 | 1889.0 |
Juxtacortical | 11 | 811 | 811.0 |
Subcortical | 11 | 220 | 220.0 |
Infratentorial | 0 | 0 | 0.0 |
Let me know if this is what you would expect, and if you think that we should also integrate this into the LST-Ai package.
Cheers, Julian
Hi @jqmcginnis @neuronflow
Thanks for the detailed information.
Somehow, the temp folder I got has 14 files in it (not 20 as you described) as can be seen in my previous screen shot I shared, and 0 files in output folder (not 2 as you described). I also got that error in the terminal console as following: vnl_lbfgs: Error. Netlib routine lbfgs failed.
It seems something minor still needs to be fixed. Please let me know otherwise.
I will next try computing the stats for binary mask/lesion.
Thanks, Sahil
@sbajaj1 This might be an issue with your input data.
@jqmcginnis @CompImg can we(here meaning you) supply example data to check the functionality? This would allow us to pinpoint whether it is a data issue.
@sbajaj1 can you describe your input data a bit please? resolution etc.
Hi @neuronflow
I am using standard dataset from here: https://www.kaggle.com/datasets/ilknuricke/neurohackinginrimages to test LST-AI This is open access data to public. I double checked and it seems this input data is OK. Please find the data info below:
T1w: Volume information for BRAINIX_NIFTI_T1.nii.gz type: nii dimensions: 512 x 512 x 22 voxel sizes: 0.468750, 0.468750, 6.000001 type: SHORT (4) fov: 240.000 dof: 1 xstart: -120.0, xend: 120.0 ystart: -120.0, yend: 120.0 zstart: -66.0, zend: 66.0 TR: 450.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees nframes: 1 PhEncDir: UNKNOWN FieldStrength: 0.000000 ras xform present xform info: x_r = -0.9997, y_r = -0.0017, z_r = 0.0239, c_r = 2.2905 : x_a = 0.0000, y_a = 0.9974, z_a = 0.0720, c_a = 0.3165 : x_s = 0.0240, y_s = -0.0720, z_s = 0.9971, c_s = 34.8959 Orientation : LAS Primary Slice Direction: axial
voxel to ras transform: -0.4686 -0.0008 0.1436 120.8842 0.0000 0.4675 0.4322 -124.1257 0.0112 -0.0338 5.9827 -25.1514 0.0000 0.0000 0.0000 1.0000
voxel-to-ras determinant -1.31836
ras to voxel transform: -2.1327 -0.0000 0.0512 259.0993 -0.0037 2.1278 -0.1536 260.6955 0.0040 0.0120 0.1662 5.1879 -0.0000 -0.0000 -0.0000 1.0000
FLAIR:
Volume information for BRAINIX_NIFTI_T1.nii.gz type: nii dimensions: 512 x 512 x 22 voxel sizes: 0.468750, 0.468750, 6.000001 type: SHORT (4) fov: 240.000 dof: 1 xstart: -120.0, xend: 120.0 ystart: -120.0, yend: 120.0 zstart: -66.0, zend: 66.0 TR: 450.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees nframes: 1 PhEncDir: UNKNOWN FieldStrength: 0.000000 ras xform present xform info: x_r = -0.9997, y_r = -0.0017, z_r = 0.0239, c_r = 2.2905 : x_a = 0.0000, y_a = 0.9974, z_a = 0.0720, c_a = 0.3165 : x_s = 0.0240, y_s = -0.0720, z_s = 0.9971, c_s = 34.8959 Orientation : LAS Primary Slice Direction: axial
voxel to ras transform: -0.4686 -0.0008 0.1436 120.8842 0.0000 0.4675 0.4322 -124.1257 0.0112 -0.0338 5.9827 -25.1514 0.0000 0.0000 0.0000 1.0000
voxel-to-ras determinant -1.31836
ras to voxel transform: -2.1327 -0.0000 0.0512 259.0993 -0.0037 2.1278 -0.1536 260.6955 0.0040 0.0120 0.1662 5.1879 -0.0000 -0.0000 -0.0000 1.0000 MDACM0CL9004107:sample_test sbajaj$ mri_info BRAINIX_NIFTI_FLAIR.nii.gz Volume information for BRAINIX_NIFTI_FLAIR.nii.gz type: nii dimensions: 288 x 288 x 22 voxel sizes: 0.798611, 0.798611, 6.000001 type: SHORT (4) fov: 230.000 dof: 1 xstart: -115.0, xend: 115.0 ystart: -115.0, yend: 115.0 zstart: -66.0, zend: 66.0 TR: 9000.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees nframes: 1 PhEncDir: UNKNOWN FieldStrength: 0.000000 ras xform present xform info: x_r = -0.9997, y_r = -0.0017, z_r = 0.0239, c_r = 2.2900 : x_a = 0.0000, y_a = 0.9974, z_a = 0.0720, c_a = 0.6455 : x_s = 0.0240, y_s = -0.0720, z_s = 0.9971, c_s = 34.8722 Orientation : LAS Primary Slice Direction: axial
voxel to ras transform: -0.7984 -0.0014 0.1436 115.8765 0.0000 0.7965 0.4322 -118.8096 0.0192 -0.0575 5.9827 -25.4152 0.0000 0.0000 0.0000 1.0000
voxel-to-ras determinant -3.82668
ras to voxel transform: -1.2518 -0.0000 0.0300 145.8192 -0.0022 1.2489 -0.0902 146.3430 0.0040 0.0120 0.1662 5.1879 -0.0000 -0.0000 -0.0000 1.0000
@sbajaj1 apologies that I misread and misunderstood your previous comment - somehow I interpreted that it finally worked after I had seen the many temp files! I am sorry about that. Please let me know if I overlooked anything else!
So, I tested a couple of things on my end:
(1) I have used the BRAINIX_NIFTI files from Kaggle - and on my end, they seem to work fine, i.e. I get all temp and output files.
However, I think it might not be the best sample dataset, as it looks to me as if the scan does not feature MS lesions, and also exhibit highly anisotropic data. Perhaps you would like to switch to MSLUB and choose one of the patients under Raw Data? :slightly_smiling_face:
(2) According to the developer of greedy, the warning vnl_lbfgs: Error. Netlib routine lbfgs failed.
is not necessarily critical:
"This might not be a problem, unless the registration is doing something nonsensical. Registration is an optimization problem, and sometimes the tolerances for the optimization scheme are not quite right for the problem. Here it looks like it ran for some iterations and reduced the objective, so it might be ok. If you see it printing this error after just a couple of iterations (NFN), then something is wrong."
I get the same warning as well. However, the registration (also in your case) seems to work, as the files are populated in your temp folder. I think we can ignore it :+1:
(3) Checking the debug output it seems that the script stops after the registration / after warping the images and before entering the LST Segmentation routine ( I am missing the "Running LST Segmentation" print):
File: /custom_apps/lst_temp/sub-X_ses-Y_space-mni_T1w.nii.gz
preprocessing...
image shape after preprocessing: (129, 153, 129)
prediction (CNN id)...
0
1
2
3
4
running postprocessing...
exporting segmentation...
Limiting the number of threads to 12
Limiting the number of threads to 12
Two prints of Limiting the number of threads to 12
indicate that the apply_warp()
function has been entered twice, and as it happens twice, I would assume that this function also works on your MacBook.
Next, apply_mask()
is called (c.f. here) and after that, and before we enter the actual segmentation function, there should be another print output print("Running LST Segmentation.")
c.f. here.
Based on this, my feeling is that the segmentation is still on-going (and the prints are lagging behind).
Could you please provide additional information about the duration of the operation within the Docker container? Specifically, it would be helpful to know how long you waited for the process to complete. Additionally, were there any other messages or debug outputs that appeared in the command line interface after some time had passed? It's possible that the Docker container might not have completed its operation yet.
In our experience, especially noted when running Docker on @neuronflow's M2 system, there can be a delay in the appearance of Docker's print commands. Therefore, it's conceivable that the LST-AI process is still ongoing. Could you run it again and wait (for a longer time?).
Thank you very much for your help, and sorry once again for my misunderstanding.
Julian
My Macbook has an M1 Max, otherwise, I agree :)
@sbajaj1, which resources did you assign to Docker on your system?
My successful tests were with these settings, I am quite sure one could get away with much less:
Hi @neuronflow @jqmcginnis
So, finally, it seems everything is working fine now. Two things I noticed:
Also, stats command compute_stats.py is working fine.
Thank you so much for your hard working resolving all the issues.
Best, Sahil
I just downloaded T1(pre) and FLAIR from subject # 1.
During the processing I notice greedy shows the following warnings:
IFLAG= -1 LINE SEARCH FAILED. SEE DOCUMENTATION OF ROUTINE MCSRCH ERROR RETURN OF LINE SEARCH: INFO= 3 POSSIBLE CAUSES: FUNCTION OR GRADIENT ARE INCORRECT OR INCORRECT TOLERANCESEND OF LEVEL 0
Level 0 LastIter Metrics -10694.596561 Energy = -10694.596561
Also I see:
vnl_lbfgs: Error. Netlib routine lbfgs failed.
However, it still generates segmentations that look fine to my layman's eyes: space-orig_desc-annotated_seg-lst.nii.gz space-orig_seg-lst.nii.gz
What happens if you increase the resources available to Docker?
Hi @neuronflow @jqmcginnis
Everything is working fine with all the subjects I tested now (there was something wrong at my end while downloading the sample data in pat 1 vs pat 15).
Thank you so much all your consistent help and support with this.
Best, Sahil
sweet, thank you for reporting back so quickly :)
@jqmcginnis I believe this issue can be closed?
@neuronflow I am currently working on a PR for all changes related to this issue in order to push it to the main branch of this repo. For referencing the PR and problems addressed in this issue, I would keep it open until I created & closed the PR? :)
@neuronflow @twiltgen
The improvements implemented in this issue have been merged to the main branch, and have now been released in v1.1.0 :balloon:
Greetings,
I am trying to install LST-AI on Mac Book Pro Ventura 13.6.2 (chip: Apple M2 Max).
I guess I have been successful installing up to step 6.1. I am not sure whether after 6.1, do I still need to do 6.2?
If yes, the step 6.2 gives me following error: Warning: No available formula with the name "build-essential". ==> Searching for similarly named formulae and casks... Error: No formulae or casks found for build-essential.
If no, then I am unable to start runnning lst command following step 6.1.
I would greatly appreciate any help in installing lst-ai on my system.
Thanks, Sahil