superelastix / simpleelastix Goto Github PK
View Code? Open in Web Editor NEWMulti-lingual medical image registration library
Home Page: http://simpleelastix.github.io
License: Apache License 2.0
Multi-lingual medical image registration library
Home Page: http://simpleelastix.github.io
License: Apache License 2.0
When I follow the directions to build the package, I get a memory leak at this step:
anatoliy@ubuntu:~/Downloads/SimpleElastix/build$ make
[ 16%] Built target ITK
[ 32%] Built target PCRE
[ 48%] Built target Swig
[ 51%] Performing build step for 'elastix'
[ 3%] Built target elxCommon
[ 5%] Built target param
[ 6%] Built target xoutlib
[ 6%] Built target mevisdcmtiff
[ 11%] Built target elxCore
[ 12%] Built target RandomCoordinateSampler
[ 13%] Built target GridSampler
[ 14%] Built target FullSampler
[ 14%] Built target RandomSampler
[ 15%] Built target MultiInputRandomCoordinateSampler
[ 16%] Built target RandomSamplerSparseMask
[ 17%] Building CXX object src/Components/MovingImagePyramids/MovingShrinkingPyramid/CMakeFiles/MovingShrinkingPyramid.dir/elxMovingShrinkingPyramid.cxx.o
My computer memory usage maxes out eventually (I have 12 GB), and the computer freezes. I have no idea why this may be happening. I can include the contents of my build folder after cmake if that helps. Thanks.
_ RuntimeError Traceback (most recent call last)
in ()
1 elastix.SetParameterMap(sitk.GetDefaultParameterMap("rigid"))
----> 2 elastix.Execute()
3 sitk.WriteImage(elastix.GetResultImage())
/usr/local/lib/python2.7/dist-packages/SimpleITK-0.9.1.dev15-py2.7-linux-x86_64.egg/SimpleITK/SimpleITK.pyc in Execute(self)
8879 def Execute(self):
8880 """Execute(SimpleElastix self) -> Image"""
-> 8881 return _SimpleITK.SimpleElastix_Execute(self)
8882
8883
RuntimeError: Exception thrown in SimpleITK SimpleElastix_Execute: /home/s/SimpleElastix/Code/Elastix/src/sitkSimpleElastix.hxx:90:
sitk::ERROR: Errors occured during registration. If you do not see any error message, set LogToConsoleOn() or LogToFolder("path/to/folder") to view elastix output.__
_Running elastix with parameter map 0
Current time: Sat Feb 20 23:57:35 2016.
ELASTIX version: 4.801
Command line options from ElastixBase:
-fMask unspecified, so no fixed mask used
-mMask unspecified, so no moving mask used
-out output_path_not_set
-threads unspecified, so all available threads are used
WARNING: The parameter "UseDirectionCosines", requested at entry number 0, does not exist at all.
The default value "true" is used instead.
WARNING: The option "UseDirectionCosines" was not found in your parameter file.
From elastix 4.8 it defaults to true!
This may change the behavior of your registrations considerably.
Command line options from TransformBase:
-t0 unspecified, so no initial transform used
Reading images...
Reading images took 0 ms.
WARNING: the fixed pyramid schedule is not fully specified!
A default pyramid schedule is used.
WARNING: the moving pyramid schedule is not fully specified!
A default pyramid schedule is used.
WARNING: The parameter "AutomaticTransformInitialization", requested at entry number 0, does not exist at all.
The default value "false" is used instead.
WARNING: The parameter "AutomaticTransformInitializationMethod", requested at entry number 0, does not exist at all.
The default value "GeometricalCenter" is used instead.
Transform parameters are initialized as: [0, 0, 0, 0, 0, 0]
WARNING: The parameter "AutomaticScalesEstimation", requested at entry number 0, does not exist at all.
The default value "false" is used instead.
Scales for transform parameters are: [100000, 100000, 100000, 1, 1, 1]
Initialization of all components (before registration) took: 5 ms.
itk::ExceptionObject (0x2e46130)
Location: "ElastixTemplate - Run()"
File: /home/s/build/ITK-prefix/include/ITK-4.8/itkRecursiveSeparableImageFilter.hxx
Line: 245
Description: itk::ERROR: RecursiveGaussianImageFilter(0x2e18ce0): The number of pixels along direction 2 is less than 4. This filter requires a minimum of four pixels along the dimension to be processed.
Error occurred during actual registration.
Errors occurred!_
It seems like some of the directories mentioned in the documentations might not exist any more.
for instance ./SimpleITK-build/Wrapping
does not contain PythonPackage,
it seems instead to be under ./SimpleElastix/Wrapping/PythonPackage
and be theez_setup.py
Is this correct? I was going to update documentation to reflect this if so.
Related to this, the "build directory" referenced is sometimes the ./build
folder made during installation, and other times seems to be the ./SimpleElastix
folder made after running the make
command. Could you clarify what each directory is?
LogToConsoleOff does not work whereas LogToFolderOff works as expected.
The output to console seems to be unstoppable ;-)
I finished the build with and I am unable to perform this tutorial. I understand I would have to input two paths instead of the images there, but the error comes before that. A little bit of background info, I am using a Mac OS X 10.10.5 with ipython notebook. Would I need to install SWIG and elastix in the ipython application as well? Here is the error message I am receiving:
So I managed to configure and generate the files using cmake. I open VS 2015 and I select Release and build 'ALL_BUILD' . Finally build terminates with error:
`
CMake Error at src/CMakeLists.txt:51 (find_package):
By not providing "FindITK.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ITK", but
CMake did not find one.
Could not find a package configuration file provided by "ITK" with any of
the following names:
ITKConfig.cmake
itk-config.cmake
Add the installation prefix of "ITK" to CMAKE_PREFIX_PATH or set "ITK_DIR"
to a directory containing one of the above files. If "ITK" provides a
separate development package or SDK, be sure it has been installed.
`
Should ITK be downloaded with the script? Any ideas to fix this? I appreciate for your help.
I get the following errors when using the superbuild: log.txt. It seems to be related to the use of template function ParameterObject::ToString in elxElastixFilter.hxx:
parameterMapVector[ i ][ "FixedImageDimension" ]
= ParameterValueVectorType( 1, ParameterObject::ToString( FixedImageDimension ) );
parameterMapVector[ i ][ "MovingImageDimension" ]
= ParameterValueVectorType( 1, ParameterObject::ToString( MovingImageDimension ) );
Both FixedImageDimension and MovingImageDimension don't seem to be defined anywhere so the compiler gives a "no matching function for call to elastix::ParameterObject::ToString" error as it can't derive the template type (at least I think that's the problem).
Compiling on Ubuntu 14.04 with gcc 4.8 I get
[ 48%] Building CXX object src/Components/FixedImagePyramids/FixedSmoothingPyramid/CMakeFi
les/FixedSmoothingPyramid.dir/elxFixedSmoothingPyramid.cxx.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
make[5]: *** [src/Components/FixedImagePyramids/FixedSmoothingPyramid/CMakeFiles/FixedSmoo
thingPyramid.dir/elxFixedSmoothingPyramid.cxx.o] Error 4
make[4]: *** [src/Components/FixedImagePyramids/FixedSmoothingPyramid/CMakeFiles/FixedSmoo
thingPyramid.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
Linking CXX static library ../../../bin/libBSplineTransformWithDiffusion.a
[ 48%] Built target BSplineTransformWithDiffusion
Linking CXX static library ../../../bin/libFixedShrinkingPyramid.a
[ 48%] Built target FixedShrinkingPyramid
Linking CXX static library ../../../bin/libFixedRecursivePyramid.a
[ 48%] Built target FixedRecursivePyramid
Linking CXX static library ../../../bin/libFixedGenericPyramid.a
[ 48%] Built target FixedGenericPyramid
make[3]: *** [all] Error 2
make[2]: *** [elastix-prefix/src/elastix-stamp/elastix-build] Error 2
make[1]: *** [CMakeFiles/elastix.dir/all] Error 2
make: *** [all] Error 2
Before I file this as a bug report with gcc as the output suggests, I wanted to make sure it's not a problem with SimpleElastix's source.
Is there a way to read image data other than reading from the hard disk?
I see that this is the way to read an image:
org.itk.simple.ImageFileReader reader = new org.itk.simple.ImageFileReader();
reader.setFileName("image.png");
But I want to read from some buffer. Is it possible?
It would be awesome if there were conda packages for SimpleElastix, so that anyone could just use it without needing to compile it. If done via conda-forge, you'd only need to create (and maintain) a recipe, and the building would all be automated.
In the documentation the PrettyPrint method was used, but that does not appear to exist for Python. What is the preferred method for viewing the parameters in the parameter maps?
When boosting the HelloWorld example, memory fills up rapidly and program halts.
This is the modified HelloWold:
import SimpleITK as sitk
fixedImage = sitk.Cast(sitk.ReadImage('a.png'), sitk.sitkFloat32)
movingImage = sitk.Cast(sitk.ReadImage('b.png'), sitk.sitkFloat32)
parameterMap = sitk.GetDefaultParameterMap('translation')
elastix = sitk.SimpleElastix()
elastix.SetFixedImage(fixedImage)
elastix.SetMovingImage(movingImage)
elastix.SetParameterMap(parameterMap)
elastix.Execute()
resultImage = elastix.GetResultImage()
transformParameterMap = elastix.GetTransformParameterMap()
transformix = sitk.SimpleTransformix()
transformix.SetTransformParameterMap(transformParameterMap)
for i in range(1,1000):
transformix.SetInputImage(sitk.Cast(sitk.ReadImage('b.png'), sitk.sitkFloat32))
transformix.Execute()
resultimage = sitk.Cast(transformix.GetResultImage(), sitk.sitkUInt8)
sitk.WriteImage(resultimage, "result_.png")
Not sure if this is caused by SimpleElastix, maybe it is an ITK issue...
EDIT:
Running transformix 1000x in a bash script does not cause any memory problems. Looks like it is a SimpleElastix problem.
Hi!
I recently stumbled upon an error that transformix couldn't read the result from elastix. I used WriteParameterFile
to save the intermediate result, which writes every number as a float. However, a large number (like NumberOfParameters: 1589952) is represented using exponents (1.58995e+0, which is 2 off), and can therefore introduce problems.
I fixed it temporarily by using my own method:
def parameterMapToString(pmap):
text = ''
for key in pmap:
text += '(' + key
for value in pmap[key]:
text += ' '
try:
text += str(int(value)) # First, try writing as an integer
except ValueError:
try:
text += str(float(value))
except ValueError:
text += '"' + value + '"'
text += ')\n'
return text
Hello,
I'm trying to build SimpleElastix using the SuperBuild, but am running into some problems (compilation errors below). Not sure if the problem is something that I am doing though -- I did enable openCL using the procedure followed by @PertuyF in #4 and had to change the pixel types to unsigned char;char;unsigned short;short;float for 2D, 3D, and 4D in order to make it compile at all with openCL (otherwise the process would crash after eating more than 20G of RAM).
Figured I would post this here in the event it is indeed a bug.
Thanks,
Karthik
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx: In member function ‘virtual void itk::simple::SimpleElastix_ProceduralInterface_Test::TestBody()’:
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:137:82: error: call of overloaded ‘Elastix(itk::simple::Image&, itk::simple::Image&, const char [12
], bool, bool)’ is ambiguous
EXPECT_NO_THROW( Elastix( fixedImage, movingImage, "translation", false, false ) );
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/GoogleTest/gtest/gtest.h:7800:44: note: in definition of macro ‘GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_’
if (::testing::internal::AlwaysTrue()) { statement; }
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/GoogleTest/gtest/gtest.h:18808:3: note: in expansion of macro ‘GTEST_TEST_NO_THROW_’
GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:137:3: note: in expansion of macro ‘EXPECT_NO_THROW’
EXPECT_NO_THROW( Elastix( fixedImage, movingImage, "translation", false, false ) );
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:137:82: note: candidates are:
EXPECT_NO_THROW( Elastix( fixedImage, movingImage, "translation", false, false ) );
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/GoogleTest/gtest/gtest.h:7800:44: note: in definition of macro ‘GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_’
if (::testing::internal::AlwaysTrue()) { statement; }
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/GoogleTest/gtest/gtest.h:18808:3: note: in expansion of macro ‘GTEST_TEST_NO_THROW_’
GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:137:3: note: in expansion of macro ‘EXPECT_NO_THROW’
EXPECT_NO_THROW( Elastix( fixedImage, movingImage, "translation", false, false ) );
^
In file included from /home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:3:0:
/home/ksarma/Documents/Utilities/SimpleElastix/Code/Elastix/include/sitkSimpleElastix.h:184:25: note: itk::simple::Image itk::simple::Elastix(const itk::simple::Image&, const itk::simple::Image&, bool, bool, std::string)
SITKCommon_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
^
/home/ksarma/Documents/Utilities/SimpleElastix/Code/Elastix/include/sitkSimpleElastix.h:186:25: note: itk::simple::Image itk::simple::Elastix(const itk::simple::Image&, const itk::simple::Image&, std::string, bool, bool, std::string)
SITKCommon_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const std::string defaultParameterMapName, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
^
In file included from /home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/SimpleITKTestHarness.h:45:0,
from /home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:1:
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:139:81: error: call of overloaded ‘Elastix(itk::simple::Image&, itk::simple::Image&, const char [12], bool, bool)’ is ambiguous
EXPECT_NO_THROW( Elastix( fixedImage, movingImage, "translation", true, false ) );
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/GoogleTest/gtest/gtest.h:7800:44: note: in definition of macro ‘GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_’
if (::testing::internal::AlwaysTrue()) { statement; }
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/GoogleTest/gtest/gtest.h:18808:3: note: in expansion of macro ‘GTEST_TEST_NO_THROW_’
GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:139:3: note: in expansion of macro ‘EXPECT_NO_THROW’
EXPECT_NO_THROW( Elastix( fixedImage, movingImage, "translation", true, false ) );
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:139:81: note: candidates are:
EXPECT_NO_THROW( Elastix( fixedImage, movingImage, "translation", true, false ) );
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/GoogleTest/gtest/gtest.h:7800:44: note: in definition of macro ‘GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_’
if (::testing::internal::AlwaysTrue()) { statement; }
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/GoogleTest/gtest/gtest.h:18808:3: note: in expansion of macro ‘GTEST_TEST_NO_THROW_’
GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
^
/home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:139:3: note: in expansion of macro ‘EXPECT_NO_THROW’
EXPECT_NO_THROW( Elastix( fixedImage, movingImage, "translation", true, false ) );
^
In file included from /home/ksarma/Documents/Utilities/SimpleElastix/Testing/Unit/sitkSimpleElastixTests.cxx:3:0:
/home/ksarma/Documents/Utilities/SimpleElastix/Code/Elastix/include/sitkSimpleElastix.h:184:25: note: itk::simple::Image itk::simple::Elastix(const itk::simple::Image&, const itk::simple::Image&, bool, bool, std::string)
SITKCommon_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
^
/home/ksarma/Documents/Utilities/SimpleElastix/Code/Elastix/include/sitkSimpleElastix.h:186:25: note: itk::simple::Image itk::simple::Elastix(const itk::simple::Image&, const itk::simple::Image&, std::string, bool, bool, std::string)
SITKCommon_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const std::string defaultParameterMapName, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
^
Testing/Unit/CMakeFiles/SimpleITKUnitTestDriver0.dir/build.make:422: recipe for target 'Testing/Unit/CMakeFiles/SimpleITKUnitTestDriver0.dir/sitkSimpleElastixTests.cxx.o' failed
make[5]: *** [Testing/Unit/CMakeFiles/SimpleITKUnitTestDriver0.dir/sitkSimpleElastixTests.cxx.o] Error 1
CMakeFiles/Makefile2:2866: recipe for target 'Testing/Unit/CMakeFiles/SimpleITKUnitTestDriver0.dir/all' failed
make[4]: *** [Testing/Unit/CMakeFiles/SimpleITKUnitTestDriver0.dir/all] Error 2
Makefile:146: recipe for target 'all' failed
make[3]: *** [all] Error 2
CMakeFiles/SimpleITK.dir/build.make:113: recipe for target 'SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build' failed
make[2]: *** [SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build] Error 2
CMakeFiles/Makefile2:132: recipe for target 'CMakeFiles/SimpleITK.dir/all' failed
make[1]: *** [CMakeFiles/SimpleITK.dir/all] Error 2
Makefile:75: recipe for target 'all' failed
make: *** [all] Error 2
This is on Mac OS X 10.11.3, with XCode 7.2.1. Build now fails apparently while compiling java code generated by swig. Short snippet of relevant output:
Scanning dependencies of target org_itk_simple_jar
[41%] Creating jar file...
/Users/nico/git/SimpleElastix/build/SimpleITK-build/Wrapping/org/itk/simple/AbsImageFilter.java:90: error: semicolon missing
Image itk::simple::AbsImageFilter::Execute(const Image &image1)
^
Followed by 99 more errors. I looked at a few of them, and they all seem to be in code that swig put in as a comment (i.e., they are between /** and */), so I do not understand why the java compiler does not ignore them. Does anyone have an idea how to fix this?
Compiling under Windows 8.1 x64 with the current version of Visual Studio 2015 Community results in some issues having to do with the HDF5 library in VTK. I've reproduced this on two Win8.1 machines now.
This issue is present in both the current SimpleElastix and development branches.
First, here's the relevant snippet of the build log:
2> -- Checking for appropriate format for 64 bit long:
2> Width with l64 failed with result: 255
2> Width with l failed with result: 255
2> Width with L failed with result: 255
2> Width with q failed with result: 255
2> Width with I64 failed with result: 255
2> -- Checking for apropriate format for 64 bit long: not found
2> Width with ll failed with result: 255
Here are the popup dialog error boxes that VS2015 throws:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: ...F5\src\itkhdf5\CMake\CMakeFiles\CMakeTmp\Debug\cmTC_7951f.exe
File: minkernel\crts\ucrt\inc\corecrt_internal_stdio_output.h
Line: 2480
Expression: ("Invalid integer length modifier", 0)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: ...F5\src\itkhdf5\CMake\CMakeFiles\CMakeTmp\Debug\cmTC_3ff09.exe
File: minkernel\crts\ucrt\inc\corecrt_internal_stdio_output.h
Line: 2480
Expression: ("Invalid integer length modifier", 0)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: ...F5\src\itkhdf5\CMake\CMakeFiles\CMakeTmp\Debug\cmTC_bcca7.exe
File: minkernel\crts\ucrt\inc\corecrt_internal_stdio_output.h
Line: 2480
Expression: ("Invalid integer length modifier", 0)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: ...F5\src\itkhdf5\CMake\CMakeFiles\CMakeTmp\Debug\cmTC_7a9dc.exe
File: minkernel\crts\ucrt\inc\corecrt_internal_stdio_output.h
Line: 2480
Expression: ("Invalid integer length modifier", 0)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: ...F5\src\itkhdf5\CMake\CMakeFiles\CMakeTmp\Debug\cmTC_0a437.exe
File: minkernel\crts\ucrt\inc\corecrt_internal_stdio_output.h
Line: 2480
Expression: ("Invalid integer length modifier", 0)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: ...F5\src\itkhdf5\CMake\CMakeFiles\CMakeTmp\Debug\cmTC_229e1.exe
File: minkernel\crts\ucrt\inc\corecrt_internal_stdio_output.h
Line: 2480
Expression: ("Invalid integer length modifier", 0)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
After tracking this issue down, it seems that this was a VTK issue back from Aug 2015 (see this merge).
On the ITK side, this fix was incorporated in ITK 4.8.2 (see this commit).
The issue is with SimpleITK though. SimpleElastix currently uses SimpleITK 0.9.1 which was built on ITK 4.8.1 (see release log).
The master branch of SimpleITK actually already has support for ITK 4.9.0 which was released on Feb 3, 2016 (see the changes in master since the SimpleITK 0.9.1 release).
I'm not sure how to change the CMake configuration to use the newest version of the master branch of SimpleITK instead of the v0.9.1 label (or if that's even desirable) but a quick fix to enable error-free compiling in Visual Studio 2015 involves just changing the ITK version from 4.8.1 to 4.8.2, which I think is less likely to break things in SimpleElastix than 4.9.0.
This involves just changing SuperBuild/External_ITK.cmake:L38 from:
set(ITK_TAG_COMMAND GIT_TAG v4.8.1)
To:
set(ITK_TAG_COMMAND GIT_TAG v4.8.2)
I chose not to just fix and submit a pull request for this since I wasn't sure about the whole SimpleITK release label business. Also my build is still compiling so I can't confirm that this fix alone is enough to resolve the issue and doesn't break things.
Let me know if there's a better fix!
I am new to SimpleElastix and I was wondering if there is a simple JAVA example that uses SimpleElastix. Thanks
I am getting the following error when I try to use SimpleITK as explained in the documentation:
>>> import SimpleITK
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
Running it on OSX 10.11, using python 2.7.11 via anaconda. Didn't notice any problems during the build.
I'm having a strange issue when running registration on a multi-channel image. I use the suggested approach in the elastix manual such as:
elastix -f0 channel1_fixed.mhd -f1 channel2_fixed.mhd -m0 channel1_moving.mhd -m1 channel2_moving.mhd ...
where the multichannel image with N channels has been separated into N scalar images.
In SimpleElastix I implement this as:
elastix = sitk.SimpleElastix()
for idx in range(numberOfChannels):
elastix.AddFixedImage( sitk.VectorIndexSelectionCast(fixedChannelImage, idx))
elastix.AddMovingImage( sitk.VectorIndexSelectionCast(movingChannelImage, idx))
All works the same with both the SimpleElastix and command line elastix approaches for 6 or less channels. Meaning, I obtain good registrations, and the metric and gradient are both decaying as expected.
However, when I try to use more than 6 channels, the command line approach still gives good results, but SimpleElastix gives very strange results. The individual channel metrics and gradients do not decay as expected, and the combined metric is very noisy and does not change much with a large number of iterations. To see what I mean, here are plots of the metric and gradient. Upper left of each plot is the overall Metric value vs. iteration. Lower left is the overall Gradient magnitude. Upper right shows the metric for each individual component / channel (Metric0, Metric1, etc. from IterationInfo.txt). Lower right shows the individual gradient for each component / channel.
elastix command line, 6 channels:
elastix command line, 7 channels:
I've reviewed the SimpleElastix code, and can't find anything that might explain this issue. I don't believe it is memory related, since I can easily run over 20 channels on the command line (these are small, 2D multichannel images in this test case), and can load just as many into memory in SimpleElastix without issue.
Any help on this issue would be much appreciated. I can also package and send this test case, if that would help?
Thanks,
Geoff
Hi!
I'm trying to build SimpleElastix on a Linux Mint 17.3. However, while ITK and elastix seem to build without any problems, the building of SimpleElastix didn't work. I got in the end plenty of warning and 2 errors:
/home/pgreillier/SimpleElastix/Code/Elastix/src/sitkSimpleTransformix.cxx: In constructor ‘itk::simple::SimpleTransformix::SimpleTransformix()’:
/home/pgreillier/SimpleElastix/Code/Elastix/src/sitkSimpleTransformix.cxx:34:9: error: ‘class itk::simple::SimpleTransformix’ has no member named ‘m_SetOutputDirectory’
this->m_SetOutputDirectory = "";
^
/home/pgreillier/SimpleElastix/Code/Elastix/src/sitkSimpleTransformix.cxx:35:9: error: ‘class itk::simple::SimpleTransformix’ has no member named ‘m_SetLogFileName’
this->m_SetLogFileName = "";
Well, I put all the problematic output in an attached file.
Thanks!
@kaspermarstal So I am following I perform registration on 2 images and then I apply the transformation map on a 3rd image "image.nii" and I get the following messages on the console:
transformix is started at Mon Mar 28 19:05:30 2016.
Installing all components.
InstallingComponents was successful.ELASTIX version: 4.801
Command line options from ElastixBase:
-out C:\elastixtestlogs
-threads unspecified, so all available threads are used
-def unspecified, so no input points transformed
-jac unspecified, so no det(dT/dx) computed
-jacmat unspecified, so no dT/dx computedReading input image ...
Reading input image took 0.000007 s
Calling all ReadFromFile()'s ...
Calling all ReadFromFile()'s took 6.963650 s
Transforming points ...
The command-line option "-def" is not used, so no points are transformed
Transforming points done, it took 0.00s
Compute determinant of spatial Jacobian ...
The command-line option "-jac" is not used, so no det(dT/dx) computed.
Computing determinant of spatial Jacobian done, it took 0.00s
Compute spatial Jacobian (full matrix) ...
The command-line option "-jacmat" is not used, so no dT/dx computed.
Computing spatial Jacobian done, it took 0.00s
Resampling image and writing to disk ...
Resampling took 4.97sTransformix has finished at Mon Mar 28 19:05:42 2016.
Elapsed time: 11.9s.
Here is code. I don't understand what I need to pass to transformix
other than the transformation map calculated previously.
`public void simpleelastixtest() {
CastImageFilter caster = new CastImageFilter();
caster.setOutputPixelType(PixelIDValueEnum.sitkFloat32);
// Instantiate SimpleElastix
org.itk.simple.SimpleElastix elastix = new org.itk.simple.SimpleElastix();
// Read input
org.itk.simple.ImageFileReader reader1 = new org.itk.simple.ImageFileReader();
reader1.setFileName("brain1.png");
Image castImage1 = caster.execute(reader1.execute());
elastix.setFixedImage(castImage1);
org.itk.simple.ImageFileReader reader2 = new org.itk.simple.ImageFileReader();
reader2.setFileName("brain2.png");
Image castImage2 = caster.execute(reader2.execute());
elastix.setMovingImage(castImage2);
elastix.setParameterMap(elastix.getDefaultParameterMap("nonrigid"));
elastix.logToConsoleOn();
elastix.logToFolder("\elastixtestlogs");
// Perform registration
elastix.execute();
// Write result image
ImageFileWriter writer = new org.itk.simple.ImageFileWriter();
writer.execute(elastix.getResultImage(),"output.nii",false);
//Apply transformation map
org.itk.simple.ImageFileReader reader3 = new org.itk.simple.ImageFileReader();
reader3.setFileName("image.nii");
org.itk.simple.SimpleTransformix transformix = new org.itk.simple.SimpleTransformix();
transformix.logToFolder("\elastixtestlogs");
transformix.setInputImage(reader3.execute());
transformix.setTransformParameterMap(elastix.getTransformParameterMap());
org.itk.simple.Image resultMask = transformix.execute()
writer.execute(resultMask, "result.nii", false);
}`
When I am wrapping a population of images using Transformix(), it prints the following output for each image:
ELASTIX version: 4.801
Command line options from ElastixBase:
-out ./
-threads unspecified, so all available threads are used
-def unspecified, so no input points transformed
-jac unspecified, so no det(dT/dx) computed
-jacmat unspecified, so no dT/dx computed
Reading input image ...
Reading input image took 0.000002 s
Calling all ReadFromFile()'s ...
Calling all ReadFromFile()'s took 0.000045 s
Transforming points ...
The command-line option "-def" is not used, so no points are transformed
Transforming points done, it took 0.00s
Compute determinant of spatial Jacobian ...
The command-line option "-jac" is not used, so no det(dT/dx) computed.
Computing determinant of spatial Jacobian done, it took 0.00s
Compute spatial Jacobian (full matrix) ...
The command-line option "-jacmat" is not used, so no dT/dx computed.
Computing spatial Jacobian done, it took 0.00s
Resampling image and writing to disk ...
Resampling took 0.19s
Is this a known issue? Is there any way to suppress this?
I am using the example and I am getting the following output:
`Running elastix with parameter map 0
Current time: Fri Mar 25 09:48:58 2016.
Installing all components.
InstallingComponents was successful.
ERROR:
FixedImageType: 2D unsigned char
MovingImageType: 2D unsigned char
elastix was not compiled with this combination of ImageTypes!
You have two options to solve this:
ERROR:
Something went wrong in the ComponentDatabase
Errors occurred!`
I am getting this with all the images it opens. Do I need to set FixedInternalImagePixelType and MovingInternalImagePixelType to float or something to work right? If yes how can I set this in Java?
Or is my compilation wrong?
Kasper,
Trying to process VectorImage <unsigned char, 2u>
(GetImageFromArray with RGB image as input) gives the error
SimpleElastix does not support the combination of 2-dimensional Unsupported pixel type.
Can I compile SimpleElastix to include this type?
While building the program I come across this error:
[ 16%] Built target PCRE
[ 32%] Built target ITK
[ 48%] Built target Swig
[ 51%] Performing download step (SVN checkout) for 'elastix'
svn: E170001: Unable to connect to a repository at URL 'https://svn.bigr.nl/elastix/trunkpublic'
svn: E170001: OPTIONS of 'https://svn.bigr.nl/elastix/trunkpublic': authorization failed: Could not authenticate to server: rejected Basic challenge (https://svn.bigr.nl)
make[2]: *** [elastix-prefix/src/elastix-stamp/elastix-download] Error 1
make[1]: *** [CMakeFiles/elastix.dir/all] Error 2
make: *** [all] Error 2
Does anybody have a solution to this problem yet?
Installed on Ubuntu 14.04 64-bit using SuperBuild, I get the above error in the HelloWorld program on the "Introduction" page.
Traceback (most recent call last):
File "/usr/local/src/eclipse_workspace/Processor360/elastix/helloworld3.py", line 17, in
transformParameterMap = elastix.GetTransformParameters()
File "/usr/local/lib/python2.7/dist-packages/SimpleITK/SimpleITK.py", line 8776, in
getattr = lambda self, name: _swig_getattr(self, SimpleElastix, name)
File "/usr/local/lib/python2.7/dist-packages/SimpleITK/SimpleITK.py", line 76, in _swig_getattr
return _swig_getattr_nondynamic(self, class_type, name, 0)
File "/usr/local/lib/python2.7/dist-packages/SimpleITK/SimpleITK.py", line 71, in _swig_getattr_nondynamic
return object.getattr(self, name)
AttributeError: type object 'object' has no attribute 'getattr'
Hope you can help. (BTW: I just love SimpleElastics! Great job!)
I'm new to ITK. After successfully building SimpleElastix, I got the following errors when running the "hello world" example:
Python 2.7.12 (default, Jun 29 2016, 14:05:02)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import SimpleITK as sitk
>>> fixedImage = sitk.ReadImage('fixedImage.nii')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/SimpleITK/SimpleITK.py", line 8215, in ReadImage
return _SimpleITK.ReadImage(*args)
RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/simpleitk20151126-61588-18lv2pz/SimpleITK-0.9.0/Code/IO/src/sitkImageReaderBase.cxx:67:
sitk::ERROR: Unable to determine ImageIO reader for "fixedImage.nii"
and it seems python can't find sitk.Elastix
too:
>>> sitk.Elastix
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Elastix'
I guess the build process is not quite success. How to fix this problem? Any help would be appreciated!
Hi everyone,
I have built and compiled SimpleElastix successfully on my PC and plan to implement a registration GUI with C#. The WRAP_CSHARP option was set in CMAKE. However, I didn't find any .dll file in the compiled SimpleElastix solution. I have also tried to create a new C# project from the existing SimpleElastix project, the new solution cannot be built successfully. Does anybody knows where to find th .dll file of SimpleElatix? Or how to use SimpleElastix as framework in a new C# Project?
best,
Siming
More of a question than an issue. But I suppose this is the best avenue.
When performing a groupwise registration. Is it possible to obtain the transformation that was performed on each volume? I have registered a set of intensity images using groupwise from a small population and now want to apply that transformation to each respective labelmap (segmentation).
Anyone done something similar and have any suggestions?
Thanks,
Anthony.
Hi Everyone,
I seem to be having issues with the Groupwise registration. I am trying to follow the instructions here (http://simpleelastix.readthedocs.org/GroupwiseRegistration.html) and keep getting an error. I have attached the code I am running to the end of this post. The error comes on the last line of that code.
But the problem comes when I true to run sitk.JoinSeries(x). No matter what I turn the values of the image to I get an error that says:
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/SimpleITK-0.9.1.dev15-py2.7-macosx-10.6-intel.egg/SimpleITK/SimpleITK.py", line 34781, in JoinSeries
return _SimpleITK.JoinSeries(*args)
RuntimeError: Exception thrown in SimpleITK JoinSeries: /Users/gattia/Programming/Elastix/SimpleElastix/Code/Common/include/sitkMemberFunctionFactory.hxx:196:
sitk::ERROR: Pixel type: 8-bit unsigned integer is not supported in 3D byN3itk6simple21JoinSeriesImageFilterE
The error indicates that is has to do with the pixel type, but it doesn't matter what I change it to I still get the error. I have tried UInt16/8, Int8, Float 32.... I had read somewhere about this potentially being an issue with trying to make a 4D image? But I have 4D enabled when building SimpleElastix.
Does anyone have a suggestion on how to go about this?
Anthony.
os.chdir("/Users/gattia/Desktop/t2Data/atlas/atlasSPGR")
population = ['3656_ResultRaw.nrrd', '3683_ResultRaw.nrrd', '3684_ResultRaw.nrrd', '3697_ResultRaw.nrrd', '3698_ResultRaw.nrrd', '3709_ResultRaw.nrrd', '3710_ResultRaw.nrrd', '3736_ResultRaw.nrrd', '3737_ResultRaw.nrrd']
vectorOfImages = sitk.VectorOfImage()
for filename in population:
UInt16 = sitk.Cast(sitk.ReadImage(filename), sitk.sitkUInt8)
vectorOfImages.push_back(UInt16)
image = sitk.JoinSeries(vectorOfImages)
Hi,
This is probably actually just something that has been fixed... but I just want to make sure/make note of it on the vaste inter web in case someone else has the same issue.
I had previously been doing some playing with SimpleElastix and have come back to it after a hiatus and my code wouldn't work any more. In particular, I was running the groupwise registration tutorial from the "readthedocs". When doing this, I couldn't get past the JoinSeries... which I had no problem with before. I was using different data to start, but defaulted back to the old data to make sure. I kept getting an error that ended with :
Requested region is (at least partially) outside the largest possible region.
So, after some playing, it seems that as long as I pick a bunch of images that are the same dimensions it Joins just fine - all my images have 2 dimensions the same (512x512) but they vary on the number of slices from 90-106.
Anyways, I am assuming that the sitk code has been updated since I last played? Or maybe something else?
Anyways, to deal with this issue I was wondering if anyone has any thoughts?
My thoughts are two-fold:
I noticed there is a LargestPossibleRegion parameter when I print a sitk object.... and this value seems to vary from image to image and is sometimes the same as the image itself and sometimes its bigger. If I could change the size of this I am assuming that I wouldn't get the above error anymore and I would be able to join images of different dimension. THOUGH, I can't figure out how to change this. In the simpleITK docs there is no Get or Set for LargestPossibleRegion and I tried to GetMetaData but that didn't work either.
I guess I could just pick the largest image dimensions in the dataset (106x512x512) and scale all images to be that size.
Any thoughts or suggestions would be greatly appreciated.
Thanks,
Anthony.
Builds of ITK and SimpleITK succeed, but building PCRE fails with error below. Strangely enough, that is the same error I got (but much earlier on in the build) when using an out of date version of the XCode build tools. I guess that something in the cmake instructions for PCRE is out of whack. Anyone any ideas (or have binaries available that I could use on the Max OS X)?
checking whether we are cross compiling... configure: error: in /Users/nico/git/SimpleElastix/build/PCRE-prefix/src/PCRE-build': configure: error: cannot run C compiled programs. If you meant to cross compile, use
--host'.
See `config.log' for more details
[ 28%] Performing build step for 'PCRE'
make[3]: *** No targets specified and no makefile found. Stop.
make[2]: *** [PCRE-prefix/src/PCRE-stamp/PCRE-build] Error 2
make[1]: *** [CMakeFiles/PCRE.dir/all] Error 2
make: *** [all] Error 2
OK so, I've been trying to get SimpleElastix compiling under Ubuntu 14.04 x64 and have not had much success. I've tried this on our lab computer and on a clean VirtualBox VM on different computer both running the same OS.
Here are the steps to reproduce the issue from a clean install of Ubuntu 14.04:
# Dependencies
sudo apt-get update
sudo apt-get install bison git subversion cmake build-essential clang-3.4
# SVN auth workaround
echo p | svn info https://svn.bigr.nl/elastix/trunkpublic/
# Download the development branch of SimpleElastix
mkdir ~/SimpleElastix && mkdir ~/SimpleElastix/build && cd ~/SimpleElastix
git clone -b develop https://github.com/kaspermarstal/SimpleElastix.git SimpleElastix
# CMake and compile
cd ~/SimpleElastix/build
cmake ../SimpleElastix/SuperBuild
make -j8
After a while with lots of things compiling, the build stops. The log is the top of a ~3900 line log file that gets produced if we then just resume building with make &> error.log
:
[ 16%] Built target ITK
[ 32%] Built target PCRE
[ 48%] Built target Swig
[ 65%] Built target elastix
[ 67%] Performing forcebuild step for 'SimpleITK'
[ 69%] Performing build step for 'SimpleITK'
[ 9%] Built target SimpleITKData
[ 10%] Built target lua5
[ 10%] Built target lua
[ 10%] Built target SimpleITKExplicit
[ 10%] Built target SimpleITKCommon
[ 10%] Building CXX object Code/Elastix/src/CMakeFiles/SimpleElastix.dir/sitkSimpleElastix.cxx.o
...
make[5]: *** [Code/Elastix/src/CMakeFiles/SimpleElastix.dir/sitkSimpleElastix.cxx.o] Error 1
make[4]: *** [Code/Elastix/src/CMakeFiles/SimpleElastix.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build] Error 2
make[1]: *** [CMakeFiles/SimpleITK.dir/all] Error 2
make: *** [all] Error 2
At this point, 11 warnings and 407 errors get printed out and the build fails. Here's the whole log file.
This is all on the current develop commit (a4db5bc) with no further modifications.
I have no clue what could be going on. Some of the error messages have to do with some pretty basic classes not being declared, e.g.:
In file included from /home/wanglab/SimpleElastix/build/elastix/src/Core/Main/elxElastixFilter.h:176:0,
from /home/wanglab/SimpleElastix/SimpleElastix/Code/Elastix/include/sitkSimpleElastix.h:11,
from /home/wanglab/SimpleElastix/SimpleElastix/Code/Elastix/src/sitkSimpleElastix.cxx:4:
/home/wanglab/SimpleElastix/build/elastix/src/Core/Main/elxElastixFilter.hxx: In member function ‘void elastix::ElastixFilter<TFixedImage, TMovingImage>::GenerateData()’:
/home/wanglab/SimpleElastix/build/elastix/src/Core/Main/elxElastixFilter.hxx:83:69: error: ‘ProcessObject’ has not been declared
duplicator->SetInputImage( static_cast< TFixedImage* >( this->ProcessObject::GetInput( inputNames[ i ] ) ) );
^
Am I missing something in this build setup? Any tips would be greatly appreciated! Thanks!
(Note: This is unrelated to #15 as I'm trying to compile on both OSes for different applications.)
Hi All,
Has anyone got SimpleElastix working with Anaconda? What approach did you use?
Anaconda is the current python that my terminal goes to so when setting up SimpleElastix it auto populated all the variables correctly to that python (see the end of post). Then I ran the setup.py and everything seemed to work but when I go to import SimpleITK my python console crashes and I get the error:
"Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6"
Any thoughts or suggestions?
Thanks,
Anthony.
PYTHON_EXECUTABLE /Users/gattia/anaconda2/bin/python
PYTHON_INCLUDE_DIR /Users/gattia/anaconda2/include/python2.7
PYTHON_LIBRARY /Users/gattia/anaconda2/lib/libpython2.7.dyli
PYTHON_LIBRARY_DEBUG PYTHON_LIBRARY_DEBUG-NOTFOUND
Hi !
I wanted to test OpenCL resampling in SimpleElastix but these flags are not activated by defaut in Cmake.
If I activate the following flags in Cmake (SimpleElastixDevelop branch):
ELASTIX_USE_OPENCL
USE_OpenCLFixedGenericPyramid
USE_OpenCLMovingGenericPyramid
USE_OpenCLResampler
I got these flags activated by default:
OPENCL_USE_NVIDIA_SDK ( which makes sense as I am using a nvidia GC and got the SDK installed from their drivers)
OPENCL_OPTIMIZATION_MAD_ENABLE
But when I build the project (Win7 using Visual Studio 2013) I get a "INTERNAL COMPILER error" on OpenCLFixedGenericPyramid.
And then some problems opening OpenCLFixedGenericPyramid.lib.
@kaspermarstal isn't it correct to use OpenCL filters yet with Selx ?
Fabien
Hi!
Do you think it is easy to update to Elastix 4.8? I would love to use the new OpenCL
filters 😊
In addition, for me, it would also be helpful to have access to the number of threads Elasix uses.
When trying to build, I get the following error when trying to clone ITK using the SuperBuild:
RPC failed; result=22, HTTP code = 405
This is using git 1.7.1 on Centos 6.7.
It appears the issue is similar to this one, since applying the workaround and changing 'http:' to 'https:' in SuperBuild/External_ITK.cmake appears to have fixed the issue (at least I can now clone/build ITK as part of the SuperBuild). I also see in the main SimpleITK repo that the clone command is structured as:
set(ITK_REPOSITORY "${git_protocol}://itk.org/ITK.git")
instead of
set(ITK_REPOSITORY http://itk.org/ITK.git)
which may be a better long term solution?
Finally, this issue would appear to also be problematic in the clone call in External_elastix.cmake.
I am trying to build on a Dell Latitude E6500 laptop running Ubuntu 15.10. When trying invoking cmake/make the way described on http://simpleelastix.readthedocs.io/GettingStarted.html and in #16, I get the same error:
build/elastix/src/Core/Main/elxElastixFilter.h: In member function ‘virtual void elastix::ElastixFilter<TFixedImage, TMovingImage>::SetParameterObject(const elastix::ParameterObject_)’:
/home/ilya/PR/SE/build/ITK-prefix/include/ITK-4.8/itkMacro.h:708:61: error: ‘ProcessObject’ has not been declared
if ( _arg != itkDynamicCastInDebugMode< type * >( this->ProcessObject::GetInput(#name) ) )
^
/home/ilya/PR/SE/build/elastix/src/Core/Main/elxElastixFilter.h:121:3: note: in expansion of macro ‘itkSetInputMacro’
itkSetInputMacro( ParameterObject, ParameterObject );
^
/home/ilya/PR/SE/build/ITK-prefix/include/ITK-4.8/itkMacro.h:710:13: error: ‘ProcessObject’ has not been declared
this->ProcessObject::SetInput( #name, const_cast< type * >( arg ) );
^
/home/ilya/PR/SE/build/elastix/src/Core/Main/elxElastixFilter.h:121:3: note: in expansion of macro ‘itkSetInputMacro’
itkSetInputMacro( ParameterObject, ParameterObject );
^
Code/Elastix/src/CMakeFiles/SimpleElastix.dir/build.make:54: recipe for target 'Code/Elastix/src/CMakeFiles/SimpleElastix.dir/sitkSimpleElastix.cxx.o' failed
make[5]: ** [Code/Elastix/src/CMakeFiles/SimpleElastix.dir/sitkSimpleElastix.cxx.o] Error 1
CMakeFiles/Makefile2:1276: recipe for target 'Code/Elastix/src/CMakeFiles/SimpleElastix.dir/all' failed
make[4]: *** [Code/Elastix/src/CMakeFiles/SimpleElastix.dir/all] Error 2
Makefile:146: recipe for target 'all' failed
make[3]: *** [all] Error 2
CMakeFiles/SimpleITK.dir/build.make:113: recipe for target 'SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build' failed
make[2]: *** [SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build] Error 2
CMakeFiles/Makefile2:132: recipe for target 'CMakeFiles/SimpleITK.dir/all' failed
make[1]: *** [CMakeFiles/SimpleITK.dir/all] Error 2
Makefile:75: recipe for target 'all' failed
I am following the instructions for compiling SimpleElastix on Mac but I am running on the following error while running make -j4
:
-- Installing: /Users/alexandroskarargyris/Downloads/build/ITK-prefix/include/ITK-4.8/itkVideoFileWriter.hxx -- Installing: /Users/alexandroskarargyris/Downloads/build/ITK-prefix/include/ITK-4.8/itkVideoIOBase.h -- Installing: /Users/alexandroskarargyris/Downloads/build/ITK-prefix/include/ITK-4.8/itkVideoIOFactory.h -- Installing: /Users/alexandroskarargyris/Downloads/build/ITK-prefix/include/ITK-4.8/ITKVideoIOExport.h -- Installing: /Users/alexandroskarargyris/Downloads/build/ITK-prefix/lib/cmake/ITK-4.8/Modules/ITKVideoIO.cmake -- Installing: /Users/alexandroskarargyris/Downloads/build/ITK-prefix/lib/libITKVideoIO-4.8.a [ 28%] Completed 'ITK' [ 28%] Built target ITK make: *** [all] Error 2
I also run cmake with options described in the troubleshoot . Same error. Any help would be very much appreciated. I am interested in the java wrapper. So if someone has it for el capitan and wants to share it I am more than happy :)
Hi, using the R wrappers I noticed that the SimpleElastix part is not working correctly.
Here is an example
require(SimpleITK)
targetname <- ReadImage("target_trans.nii.gz")
elastix <- SimpleElastix()
elastix$SetFixedImage(targetname)
Error in getClassDef(cl) : node stack overflow
I tested it on Ubuntu 14.04 using SimpleElastix Superbuild
This was a little bit of a goose chase where there seemed to be lots of road blocks preventing me from visualizing the 4D data created from groupwise registration. There are potentially a couple of issues here... or its just me.
When trying to visualize I tried to use indexing to get each individual volume from the 4D image but was unable to index the 4D data in the same way that I index 3D data.
participantOne = resultImage[:,:,:,0]
. The error is simply
invalid index
Then, as an alternate solution, I tried to use extractor = sitk.ExtractImageFilter()
and it also threw an error
ERROR: Pixel type: 16-bit signed integer is not supported in 4D by N3itk6simple18ExtractImageFilterE or SimpleITK compiled with SITK_4D_IMAGES set to OFF.
The error indicates it is because of the data type (but maybe this is because the image is 4D, I know this was the case with JoinSeries
) - my SimpleElastix was built with 4D ON. To try and resolve this and see if it was truly the data type, I tried to cast the resultImage to something else using UInt16ResultImage = sitk.Cast(resultImage, sitk.sitkUInt16)
and this didn't work (again maybe because it's 4D?).
So, to test if it was the 4D or the pixel-type, I went back to the images before the groupwise registration and to see if I could cast them to a different type before the registration, assuming this carried through to the post registration. I am able to cast these, but the elastix groupwise registration seems like it won't work on anything except the original image (it's a short). It indicated that this error was again due to the pixel type and that this could be changed either in the cmake or in the elastix parameters.
ERROR:
FixedImageType: 4D float
MovingImageType: 4D float
elastix was not compiled with this combination of ImageTypes!
You have two options to solve this:
- Add the combination to the CMake parameters ELASTIX_IMAGE_nD_PIXELTYPES and ELASTIX_IMAGE_DIMENSIONS, re-cmake and re-compile.
- Change the parameters FixedInternalImagePixelType and/or MovingInternalImagePixelType in the elastix parameter file.
ERROR:
Something went wrong in the ComponentDatabase
Errors occurred!
So, based on this, I tried to alter the paramtermap for 'groupwise' registration to coincide with the data. I may have been doing this incorrectly. But I tried to alter it to float as is recommended in the Elastix documents using:
groupwiseParameterMap = sitk.GetDefaultParameterMap('groupwise') groupwiseParameterMap['FixedInternalImagePixelType'] = ['float'] groupwiseParameterMap['MovingInternalImagePixelType'] = ['float']
I then used groupwiseParameterMap as the input for elastix.SetParameterMap()
and it still gave the same error.
The other alternate for the Elastix groupwise registration is to alter something in the make file but since I built SimpleElastix this wasn't something that I had access too. My next step was to build my own elastix/ITK.
In short. I had issues with:
Sorry for the long post but I thought it was better to be thorough.
Anthony.
Hi,
I success to build ITK and Elastix but when I build simple Elastix, I found the error. I am using Visual studio 2013, ITK v.4.8 and Elastix v.4.8.
Error 7 error C2660: 'itk::ProcessObject::SetInput' : function does not take 1 arguments ...\src\Code\Elastix\include\sitkSimpleTransformix.hxx 21 1 SimpleTransformix
Error 8 error C2039: 'SetInputPointSetFileName' : is not a member of 'elastix::TransformixFilter' ...\src\Code\Elastix\include\sitkSimpleTransformix.hxx 24 1 SimpleTransformix.
Any thoughts or suggestions would be greatly appreciated.
Thanks,
Hilmi
Hi,
Is it possible to pass a numpy array instead of a file from the disk to SimpleElastix.SetFixedImage() and SimpleElastix.SetMovingImage()?
I have an image processing pipeline, which includes some background subtraction and cropping before I'm registering them, so passing an array would be more helpful than writing them to a file and passing it on to registration.
Hi, in the upstream version of SimpleITK R wrapping has become quite smooth lately. Would it be hard to merge these changes into SimpleElastix?
Best
Stefan
Hi, i run the code in this post:
import SimpleITK as sitk
resultImage = sitk.Elastix(sitk.ReadImage("fixed.png"), sitk.ReadImage("moving.png"), "translation")
where the fixed.png and moving.png are just saved from the same page of fixedImage.nii and movingImage.nii, but the error shows below:
Traceback (most recent call last):
File "test0.py", line 3, in <module>
resultImage = sitk.Elastix(sitk.ReadImage("fixed.png"), sitk.ReadImage("moving.png"), "translation")
File "/usr/local/lib/python2.7/site-packages/SimpleITK-0.9.1.dev26-py2.7-macosx-10.10-x86_64.egg/SimpleITK/SimpleITK.py", line 8950, in Elastix
return _SimpleITK.Elastix(*args)
RuntimeError: Exception thrown in SimpleITK Elastix: /Users/vinllen/opt/simple_elastix/SimpleElastix/Code/Elastix/src/sitkSimpleElastix.hxx:90:
sitk::ERROR: Errors occured during registration. If you do not see any error message, set LogToConsoleOn() or LogToFolder("path/to/folder") to view elastix output.
I think it's the problem of PNG image, so i test the code in this post with my own data of nii formate:
import SimpleITK as sitk
elastix = sitk.SimpleElastix()
elastix.SetFixedImage(sitk.ReadImage("inia19-t1.nii"))
elastix.SetMovingImage(sitk.ReadImage("inia19-t1-brain.nii"))
plist = sitk.ParameterMapList()
plist.append(sitk.GetDefaultParameterMap("affine"))
plist.append(sitk.GetDefaultParameterMap("nonrigid"))
elastix.SetParameterMap(plist)
elastix.Execute()
sitk.WriteImage(elastix.GetResultImage())
It also cannot work:
Traceback (most recent call last):
File "test.py", line 14, in <module>
sitk.WriteImage(elastix.GetResultImage())
File "/usr/local/lib/python2.7/site-packages/SimpleITK-0.9.1.dev26-py2.7-macosx-10.10-x86_64.egg/SimpleITK/SimpleITK.py", line 7469, in WriteImage
return _SimpleITK.WriteImage(*args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'WriteImage'.
Possible C/C++ prototypes are:
itk::simple::WriteImage(itk::simple::Image const &,std::string const &,bool)
itk::simple::WriteImage(itk::simple::Image const &,std::vector< std::string,std::allocator< std::string > > const &,bool)
Do you have any example datas that i can download to test your example code just like fixedImage.nii and movingImage.nii in the post? Thankyou verymuch.
Hi!
First of all, thanks a lot for SimpleElastix! It make my life a lot easier!
While developing, I ran in to a few problems, which I'll list here:
After a error (like "Too many samples map outside moving image buffer"
), it fails when you try to retry (in the current session). It shows the following message: "ERROR while setting up xout."
.
Secondly, I'm using a moving image mask, and when setting ImageSampler
to RandomSparseMask
, it gives the error "do not call this function when no mask is supplied"
.
Finally, I have problem setting parameters of parameterMaps inside a parameterMapList, but I will come back to this with a proper example 😊
Hi,
I get this error when I try to build SimpleElastix :
In file included from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.h:147:0,
from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkMeshFileReader.h:24,
from /home/piedec/git/build/elastix/src/Common/itkMeshFileReaderBase.h:23,
from /home/piedec/git/build/elastix/src/Common/itkTransformixInputPointFileReader.h:22,
from /home/piedec/git/build/elastix/src/Core/ComponentBaseClasses/elxTransformBase.hxx:25,
from /home/piedec/git/build/elastix/src/Core/ComponentBaseClasses/elxTransformBase.h:354,
from /home/piedec/git/build/elastix/src/Core/Kernel/elxElastixTemplate.h:39,
from /home/piedec/git/build/elastix/src/Core/Install/elxIncludes.h:39,
from /home/piedec/git/build/elastix/src/Components/Transforms/SplineKernelTransform/elxSplineKernelTransform.h:21,
from /home/piedec/git/build/elastix/src/Components/Transforms/SplineKernelTransform/elxSplineKernelTransform.cxx:19:
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx: In member function ‘bool itk::HexahedronCell::EvaluatePosition(itk::HexahedronCell::CoordRepType_, itk::HexahedronCell::PointsContainer_, itk::HexahedronCell::CoordRepType_, itk::HexahedronCell::CoordRepType_, double_, itk::HexahedronCell::InterpolationWeightType_) [with TCellInterface = itk::CellInterface<float, itk::CellTraitsInfo<4, double, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<double, 4u>, itk::VectorContainer<long unsigned int, itk::Point<double, 4u> >, std::set > >; itk::HexahedronCell::CoordRepType = double; itk::HexahedronCell::PointsContainer = itk::VectorContainer<long unsigned int, itk::Point<double, 4u> >; itk::HexahedronCell::InterpolationWeightType = float]’:
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx:380:9: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations]
tcol[j] += pt[j] * derivs[i + 16];
^
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx:375:7: note: containing loop
for ( unsigned int j = 0; j < PointDimension; j++ )
^
In file included from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.h:147:0,
from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkMeshFileReIn file included from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.h:147:0,
from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkMeshFileReader.h:24,
from /home/piedec/git/build/elastix/src/Common/itkMeshFileReaderBase.h:23,
from /home/piedec/git/build/elastix/src/Common/itkTransformixInputPointFileReader.h:22,
from /home/piedec/git/build/elastix/src/Core/ComponentBaseClasses/elxTransformBase.hxx:25,
from /home/piedec/git/build/elastix/src/Core/ComponentBaseClasses/elxTransformBase.h:354,
from /home/piedec/git/build/elastix/src/Core/Kernel/elxElastixTemplate.h:39,
from /home/piedec/git/build/elastix/src/Core/Install/elxIncludes.h:39,
from /home/piedec/git/build/elastix/src/Components/Transforms/SplineKernelTransform/elxSplineKernelTransform.h:21,
from /home/piedec/git/build/elastix/src/Components/Transforms/SplineKernelTransform/elxSplineKernelTransform.cxx:19:
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx: In member function ‘bool itk::HexahedronCell::EvaluatePosition(itk::HexahedronCell::CoordRepType_, itk::HexahedronCell::PointsContainer_, itk::HexahedronCell::CoordRepType_, itk::HexahedronCell::CoordRepType_, double_, itk::HexahedronCell::InterpolationWeightType_) [with TCellInterface = itk::CellInterface<float, itk::CellTraitsInfo<4, double, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<double, 4u>, itk::VectorContainer<long unsigned int, itk::Point<double, 4u> >, std::set > >; itk::HexahedronCell::CoordRepType = double; itk::HexahedronCell::PointsContainer = itk::VectorContainer<long unsigned int, itk::Point<double, 4u> >; itk::HexahedronCell::InterpolationWeightType = float]’:
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx:380:9: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations]
tcol[j] += pt[j] * derivs[i + 16];
^
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx:375:7: note: containing loop
for ( unsigned int j = 0; j < PointDimension; j++ )
^
In file included from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.h:147:0,
from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkMeshFileReader.h:24,
from /home/piedec/git/build/elastix/src/Common/itkMeshFileReaderBase.h:23,
from /home/piedec/git/build/elastix/src/Common/itkTransformixInputPointFileReader.h:22,
from /home/piedec/git/build/elastix/src/Core/ComponentBaseClasses/elxTransformBase.hxx:25,
from /home/piedec/git/build/elastix/src/Core/ComponentBaseClasses/elxTransformBase.h:354,
from /home/piedec/git/build/elastix/src/Core/Kernel/elxElastixTemplate.h:39,
from /home/piedec/git/build/elastix/src/Core/Install/elxIncludes.h:39,
from /home/piedec/git/build/elastix/src/Components/Transforms/TranslationTransform/elxTranslationTransform.h:21,
from /home/piedec/git/build/elastix/src/Components/Transforms/TranslationTransform/elxTranslationTransform.cxx:19:
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx: In member function ‘bool itk::HexahedronCell::EvaluatePosition(itk::HexahedronCell::CoordRepType_, itk::HexahedronCell::PointsContainer_, itk::HexahedronCell::CoordRepType_, itk::HexahedronCell::CoordRepType_, double_, itk::HexahedronCell::InterpolationWeightType_) [with TCellInterface = itk::CellInterface<float, itk::CellTraitsInfo<4, double, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<double, 4u>, itk::VectorContainer<long unsigned int, itk::Point<double, 4u> >, std::set > >; itk::HexahedronCell::CoordRepType = double; itk::HexahedronCell::PointsContainer = itk::VectorContainer<long unsigned int, itk::Point<double, 4u> >; itk::HexahedronCell::InterpolationWeightType = float]’:
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx:380:9: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations]
tcol[j] += pt[j] * derivs[i + 16];
^
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx:375:7: note: containing loop
for ( unsigned int j = 0; j < PointDimension; j++ )
^
In file included from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.h:147:0,
from /home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkMeshFileReader.h:24,
from /home/piedec/git/build/elastix/src/Common/itkMeshFileReaderBase.h:23,
from /home/piedec/git/build/elastix/src/Common/itkTransformixInputPointFileReader.h:22,
from /home/piedec/git/build/elastix/src/Core/ComponentBaseClasses/elxTransformBase.hxx:25,
from /home/piedec/git/build/elastix/src/Core/ComponentBaseClasses/elxTransformBase.h:354,
from /home/piedec/git/build/elastix/src/Core/Kernel/elxElastixTemplate.h:39,
from /home/piedec/git/build/elastix/src/Core/Install/elxIncludes.h:39,
from /home/piedec/git/build/elastix/src/Components/Transforms/StackTransform/elxBSplineStackTransform.h:21,
from /home/piedec/git/build/elastix/src/Components/Transforms/StackTransform/elxBSplineStackTransform.cxx:18:
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx: In member function ‘bool itk::HexahedronCell::EvaluatePosition(itk::HexahedronCell::CoordRepType_, itk::HexahedronCell::PointsContainer_, itk::HexahedronCell::CoordRepType_, itk::HexahedronCell::CoordRepType_, double_, itk::HexahedronCell::InterpolationWeightType_) [with TCellInterface = itk::CellInterface<float, itk::CellTraitsInfo<4, double, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<double, 4u>, itk::VectorContainer<long unsigned int, itk::Point<double, 4u> >, std::set > >; itk::HexahedronCell::CoordRepType = double; itk::HexahedronCell::PointsContainer = itk::VectorContainer<long unsigned int, itk::Point<double, 4u> >; itk::HexahedronCell::InterpolationWeightType = float]’:
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx:380:9: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations]
tcol[j] += pt[j] * derivs[i + 16];
^
/home/piedec/git/build/ITK-prefix/include/ITK-4.8/itkHexahedronCell.hxx:375:7: note: containing loop
for ( unsigned int j = 0; j < PointDimension; j++ )
^
Do you know a solution ?
Thanks
Hi, When i make the project SimpleElastix, errors occured when downloading elastix:
vinllen@ ~/opt/elastix/build_SimpleElastix$ make -j4
[ 16%] Built target PCRE
[ 32%] Built target ITK
[ 48%] Built target Swig
[ 51%] Performing download step (SVN checkout) for 'elastix'
svn: E175002: Unable to connect to a repository at URL 'https://svn.bigr.nl/elastix/trunkpublic'
svn: E175002: OPTIONS of 'https://svn.bigr.nl/elastix/trunkpublic': SSL handshake failed: Secure connection truncated (https://svn.bigr.nl)
make[2]: *** [elastix-prefix/src/elastix-stamp/elastix-download] Error 1
make[1]: *** [CMakeFiles/elastix.dir/all] Error 2
make: *** [all] Error 2
I found the solution list in the TroubleShooting in the Getting Started. But it looks like this solution not works for me.
My computer is MacOS, do you have any idea ? Thankyou very much
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.