almarklein / pyelastix Goto Github PK
View Code? Open in Web Editor NEWThin wrapper around elastix - a toolbox for rigid and nonrigid registration of images
License: MIT License
Thin wrapper around elastix - a toolbox for rigid and nonrigid registration of images
License: MIT License
After reading the web and github of elastix, I still can not figure out how to install the Elastix command line application. And an error occurred to me, i.e. [Errno 2] No such file or directory: '/opt/local/bin'
I tried to install SimpleElastix, but lots of error occurred, so I gave up and tried to use pyelastix.
Is it possible to use a custom similarity metric with pyelastix?
Hi, first of all, thanks for sharing the library! I would like to as you if it is possible to renew this link to get the example image?
imageio.imread('https://dl.dropboxusercontent.com/u/1463853/images/chelsea_morph1.png')
Hi,
First thanks for this great toolkit to use Elastix.
Actually I face a very similar problem with @123aaron that my result image seems change the intensity distribution form the 0 to 70 to -5 to 10 approximately.
I'm not sure this kind of normalization comes from Elastix or pyelastix and it will be helpful if you can give me some suggesstion
Thank you!
Aimyy
If you would like to add installation instructions for Mac, they are the same as for linux, but the PATH variables are:
export PATH=path/to/bin:$PATH
export DYLD_LIBRARY_PATH=path/to/lib:$PATH
Dear @almarklein,
when I am trying to obtain a copy from http://elastix.isi.uu.nl/, I get the following message: Can’t reach this page.
Do you have any suggestion?
I'm getting "BufferError: memoryview: underlying buffer is not C-contiguous" when running pyelastix.register on two numpy arrays. Any ideas?
I know there is a solution http://elastix.isi.uu.nl/FAQ.php#Q_LibraryNotLoaded
But I can not make it work, I can get:echo $DYLD_LIBRARY_PATH
/Users/xiaowanli/Desktop/segmentation/softwares/registration/elastix_macosx64_v4.8/lib
This means I set the path right, but I still get this errors when I run the example in repo. Any ideas? Here is the full version of error message:
Found elastix version: 4.800 in 'elastix'
Calling Elastix to register images ...
dyld: Library not loaded: libANNlib.dylib
Referenced from: /Users/xiaowanli/Desktop/segmentation/softwares/registration/elastix_macosx64_v4.8/bin/elastix
Reason: image not found
Traceback (most recent call last):
File "registration.py", line 30, in
im3, field = pyelastix.register(im1, im2, params)
File "/anaconda/lib/python3.6/site-packages/pyelastix.py", line 502, in register
_system3(command, verbose)
File "/anaconda/lib/python3.6/site-packages/pyelastix.py", line 337, in _system3
raise RuntimeError('An error occured during the registration.')
RuntimeError: An error occured during the registration.
Hi, I want to know if there's any way to get the transformation matrix (print or save it) after the registration is done. It will be very useful for my case.
Hi,
How can i directly specify on my python script the path to the output directoy when calling register method? It is giving me the error regarding the inexistance of result.0.mhd file...
Thanks
Currently the conda install instruction reads conda install elastix
. Should it not be conda install pyelastix
I have 4 immunofluorescence images from 4 adjacent slides (in tiff), which should cover ~2-cell in z-stack. I need to align those slides (I think it is called image registration).
Ideally, I need to make a pipeline that aligns these four images into a single one, and outputting the "moving" and "rotation" matrices of each image.
Is that a possible thing with your package?
Thank you very much!
For some reason the registered image seems to have lost a lot of information during the processing. I am registering 16 bit images and the registered images seems to be composed of floats with very low values (~5 as maximum).
In addition, are the fields obtained one for the x-direction and the other for the y-direction?
Hello,
I want to implement a 2D-3D registration case with parameters from this page: http://elastix.bigr.nl/wiki/index.php/Par0013#Application.
For this task, I have to use:
params.Metric = 'GradientDifference'
I have faced the following error:
"Description: itk::ERROR: GradientDifferenceMetric(0x56530c3cd800): Metric can only be used for 2D-3D registration. FixedImageSize[2] must be 1"
But my im2 (FixedImage) is a 3D NumPy array with 2200, 2200, 1 shape.
What should I do?
I tried to put only a 2D NumPy array with 2200, 2200 shape.
But in this case, I get the following message:
ERROR: problem defining fixed image dimension.; The parameter file says: 3; The fixed image header says: 2
Hi !
Is it possible to get the affine transformation parameters ? From what I understand, they are stored in temporary files and deleted before the register function ends, so that it's not possible to get them.
Thanks !
Any hint?
params = pyelastix.get_default_params()
params.MaximumNumberOfIterations = 200
params.FinalGridSpacingInVoxels = 10
FileNotFoundError Traceback (most recent call last)
in ()
5
6 # Apply the registration (im1 and im2 can be 2D or 3D)
----> 7 im1_deformed, field = pyelastix.register(im1, im2, params)
/projects/sysbio/projects/czi/immune/anaconda2/envs/py36/lib/python3.6/site-packages/pyelastix.py in register(im1, im2, params, exact_params, verbose)
495
496 # Compile command to execute
--> 497 command = [get_elastix_exes()[0],
498 '-m', path_im1, '-f', path_im2,
499 '-out', tempdir, '-p', path_params]
/projects/sysbio/projects/czi/immune/anaconda2/envs/py36/lib/python3.6/site-packages/pyelastix.py in get_elastix_exes()
154
155 # Find exe
--> 156 elastix, ver = _find_executables('elastix')
157 if elastix:
158 base, ext = os.path.splitext(elastix)
/projects/sysbio/projects/czi/immune/anaconda2/envs/py36/lib/python3.6/site-packages/pyelastix.py in _find_executables(name)
130 # Try harder
131 for d in possible_locations:
--> 132 for sub in reversed(sorted(os.listdir(d))):
133 if sub.startswith(name):
134 exe = os.path.join(d, sub, exe_name)
FileNotFoundError: [Errno 2] No such file or directory: '/opt/local/bin'
Hello, is this package applicable for RGB image registration? if so, how do I set it? Thx
Hi @almarklein ,
I was wondering what is the current status of this package? Do you have any plans to maintain and/or further develop the wrapper?
I'm potentially interested in finalizing it and solving the remaining issues.
Added 20.06.2019 TODO:
Hi,
I get the following error:
In [26]:im3, field = pyelastix.register(im1, im2, params)
Calling Elastix to register images ...
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-27-67b09ffdefda> in <module>()
----> 1 im3, field = pyelastix.register(im1, im2, params)
/usr/local/lib/python2.7/dist-packages/pyelastix.pyc in register(im1, im2, params, exact_params, verbose)
507 except IOError as why:
508 tmp = "An error occured during registration: " + str(why)
--> 509 raise RuntimeError(tmp)
510
511 # Find deformation field
RuntimeError: An error occured during registration: [Errno 2] No such file or directory: '/tmp/pyelastix/id_3862_140449827452240/result.0.mhd'
In that folder there is no result.0mhd file but there are im1.mhd, im1.raw, im2.mhd, im2.raw, and params.txt.
Have you ever see such an error or do you know how to solve it?
Thanks
Edit: 1. Environment is Ubuntu 14.04 and 16.04 and 2. Elastix works properly from command line :
elastix -f im1.png -m im2.png -out /tmp/pyelastix/xx -p /tmp/pyelastix/xx/params.txt
When I am registering, how should I set the parameters NumberOfResolutions and MaximumNumberOfIterations? To get the best results
Hi,
Thanks for putting the wrapper together, it works well.
However, I am having a issue with the output data. My input images/arrays are both converted to 8bit (0-255), but the output is gives values in the range of around (-0.019... - 0.099...). is there a reason why the scales are so different on the output? Can the wrapper be coerced into matching the output scale to the input?
My aim is to not lose the initial values of the moving image such that I can convert back to the prior values from the 8bit conversion.
Thanks.
Sorry if this is not the appropriate forum, but does this wrapper provide methods for calling transformix from within Python? The pyelastix.register function outputs an image and a deformation field but deletes the temporary files used to determine the transformation, so I can't use the same transformation on a separate image set
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.