Open keithmurphy opened 5 years ago
It looks like Elastix is not happy in this case. Try running Elastix by itself from the terminal to see what's the problem. Or manually check that all your paths actually exist. Looks like lot's of people are running into path issues. An assertion to check if paths exist might be quite useful.
Thanks vzickus, I've looked and all the files and paths exist. I'm not sure how to run the binary file in linux terminal. I would greatly appreciate any direction on how you ran it if possible. Also, when you set up the elastix folder, did you just extract the linux binaries (bin and lib folder) into an elastix folder? That's what I did but maybe it's incorrect?
It looks like Elastix is not happy in this case. Try running Elastix by itself from the terminal to see what's the problem. Or manually check that all your paths actually exist. Looks like lot's of people are running into path issues. An assertion to check if paths exist might be quite useful.
I think I chose to install Elastix via apt-get (on Ubuntu). But it's been a while since I set it up, so I might be wrong. Elastix has a good manual though, might be worth checking that out. Just copy-paste /home/users/kmurph/elastix/bin/elastix into your terminal and see if you get something like
Use "elastix --help" for information about elastix-usage.
I think I chose to install Elastix via apt-get (on Ubuntu). But it's been a while since I set it up, so I might be wrong. Elastix has a good manual though, might be worth checking that out. Just copy-paste /home/users/kmurph/elastix/bin/elastix into your terminal and see if you get something like
Use "elastix --help" for information about elastix-usage.
Thanks vzickus that helped alot. What I think is happening is that the elastix file is not recognized since it has no file type. I'm running it on a supercomputer so I have no way to install as the root; instead I just cloned the git directories in. I'll have to figure out how to make the elastix file something the os can use
I had the same problem last week. The thing is Clearmap (dont remember right now which of the Clearmap functions is) will append "bin/elastix" to whatever you set up as the path to the elastix binary. So for example, if you set your path to elastix as: /home/users/kmurph/elastix/bin/elastix, the Clearmap code will see it as: /home/users/kmurph/elastix/bin/elastix/bin/elastix, so take that into account when you extract the bin and lib folders and name the folder accordingly.
@keithmurphy any luck with this?
Hi @vzickus , I don't remember this working initially, but I've added the lines LD_LIBRARY_PATH=/home/users/kmurph/elastix/lib echo $LD_LIBRARY_PATH export LD_LIBRARY_PATH to the .sh file and it's working now. That and importing some C libraries did the trick. Thanks again for your help.
echo $LD_LIBRARY_PATH
@keithmurphy Could you specify which C libraries fixed the issue? I am having the same issue which I've been unable to resolve. Thanks
echo $LD_LIBRARY_PATH
@keithmurphy Could you specify which C libraries fixed the issue? I am having the same issue which I've been unable to resolve. Thanks
I ended up loading the gcc , glib library (https://wiki.gnome.org/Projects/GLib), the gcc library (The GNU Compiler Collection) and the tcl/tk library. This might be different me though since I'm running everything remotely and alot of the standard libs were absent. Also the libraries need to be added to the path and you have to have enough RAM available for the processes to run or it will come up with a similar set of errors (not sure why that is)
I am having the same issue. During my error it looks like it is failing at line 484 in Elastix.py so res has some value. @keithmurphy Sorry if this is a bit noobish but what .ssh file are you referring to? Here is my error traceback for some trouble shooting. Thanks all.
File "
File "/usr/lib/python2.7/dist-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile execfile(filename, namespace)
File "/usr/lib/python2.7/dist-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile builtins.execfile(filename, *where)
File "/media/alon/043A1E823A1E7142/ClearMap/ClearMap/Scripts/process_template.py", line 23, in
File "/media/alon/043A1E823A1E7142/ClearMap/ClearMap/Alignment/Elastix.py", line 484, in alignData raise RuntimeError('alignData: failed executing: ' + cmd);
RuntimeError: alignData: failed executing: /media/alon/043A1E823A1E7142/elastix-4.9.0-linux/bin/elastix -threads 16 -m /media/alon/Images/test/autofluo_for_cfos_resampled.tif -f /media/alon/Images/test/cfos_resampled.tif -p /media/alon/Images/atlas/Par0000affine_acquisition.txt -out /media/alon/Images/test/elastix_cfos_to_auto
Update: I am stuck when running Elastix, when I run through terminal I get to an error stating:
Time spent in resolution 0 (ITK initialization and iterating): 17.338 s. Stopping condition: Error in metric.
itk::ExceptionObject (0x45040d0) Location: "ElastixTemplate - Run()" File: /home/mstaring/tmp_elastix_release_4.9.0/elastix/Common/CostFunctions/itkAdvancedImageToImageMetric.hxx Line: 1066 Description: itk::ERROR: AdvancedMattesMutualInformationMetric(0x43bb1f0): Too many samples map outside moving image buffer: 0 / 10000
Error occurred during actual registration.
Errors occurred!
@Sattlert2 since you're running Elastix from terminal, this is not a ClearMap issue. This error is mentioned in the manual as well as in the Elastix wiki. You can try and see if suggestions there help solve your issue.
I am running through ClearMap. Once it fails at line 484 in in alignData (Elastix.py) I copy and paste /media/alon/043A1E823A1E7142/elastix-4.9.0-linux/bin/elastix -threads 16 -m /media/alon/Images/test/autofluo_for_cfos_resampled.tif -f /media/alon/Images/test/cfos_resampled.tif -p /media/alon/Images/atlas/Par0000affine_acquisition.txt -out /media/alon/Images/test/elastix_cfos_to_auto that was outputted by the program into the terminal. Then I receive the "too many samples map outside moving image buffer" problem.
@Sattlert2, I meant because you get the same error while running pure Elastix via Terminal, it's Elastix that is unhappy. From what I remember about this error, there could be many reasons for this (sometimes even parameter settings). However, the data that is included as examples with the ClearMap paper, should work with the default parameters. I would probably first check if those two files actually look similar (i.e. is there a good initial overlap). See Elastix github/manual/mailing list for more info on this.
I have the atlas image, where are the test files(examples) located? Thanks for your help!
Look for "Datasets for training" in https://idisco.info/clearmap-2/
I got everything up and running thank you! Both my files and the test files are working.
I got everything up and running thank you! Both my files and the test files are working.
Hello, I am glad you got it working!
I have the same issue with alignment, also running elastix in terminal on linux. To clarify, is the problem with elastix? Not sure if I download it wrong, I just extract the folder with bin and lib. Maybe I am not running the program correctly?
Hi, I'm also stuck in with alignment command. Just like @Sattlert2, I opened the command in the terminal, but what I got was the following: /home/kupchiklab/ClearMap/elastix-5.0.1-linux/bin/elastix: error while loading shared libraries: libANNlib-5.0.so.1: cannot open shared object file: No such file or directory
@vzickus, do you might have any solutions for this issue?
Thanks
@Sattlert2 hello man, how did you end up using the elastix error RuntimeError: align: failed executing: /home/hesham/ClearMap2/ClearMap/External/elastix/build/bin/elastix -threads 16 -m /media/hesham/Extra/1.1 final/resampled_autofluorescence.tif -f /media/hesham/Extra/1.1 final/resampled.tif -p /home/hesham/ClearMap2/ClearMap/Resources/Alignment/align_affine.txt -out /media/hesham/Extra/1.1 final/elastix_resampled_to_auto
???
Hey @Hesham3esa I am having the same issue. Have you been able to troubleshoot that error. If so I would appreciate any direction. Thank you!
@patelhe56 yes.. super duper easy fix. Remove all spaces from “folder names” so if your folder that contains images is named “subject 1” make it is “subject_1” and run your code again with the new name. You welcome
Hi Christoph, I'm getting this error message even though all of my directories are _ or no spaces (I looked at the other closed issues). Any idea why the os isn't properly accessing the files? I've looked and they're all created. Is there a specific folder structure required for my base directory or alignment files? Thanks
File "/home/users/kmurph/ClearMap/ClearMap/Scripts/process_template.py", line 26, in
resultDirectory = alignData(**RegistrationAlignmentParameter);
File "/home/users/kmurph/ClearMap/ClearMap/Alignment/Elastix.py", line 466, in alignData
raise RuntimeError('alignData: failed executing: ' + cmd);
RuntimeError: alignData: failed executing: /home/users/kmurph/elastix/bin/elastix -threads 16 -m /home/users/kmurph/brain_resources/template_25.tif -f /scratch/users/kmurph/base/autofluo_resampled.tif -p /home/users/kmurph/brain_resources/Par0000affine.txt -p /home/users/kmurph/brain_resources/Par0000bspline.txt -out /scratch/users/kmurph/base/elastix_auto_to_atlas