-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump elastix version to 2023-05-15, use C++17, support any scalar pixel type #211
Bump elastix version to 2023-05-15, use C++17, support any scalar pixel type #211
Conversation
@thewtex Can you please have a look at the CI failures from "Test notebooks / nbmake (ubuntu-22.04)"? It says:
|
Thanks @thewtex, I hope #187 will help. Actually there are some more build problems with this PR of mine. The main commit, 2189fa8 has some other failures. I wonder if it's because of the added 3rd party library dependency: elastix now uses the spdlog library, with commit SuperElastix/elastix@085a393 The dependency is "header only", spdlog is retrieved by git submodule. Do you have a suggestion? |
@N-Dekker is it possible to use CMake FetchContent instead of a git submodule? This is easier for developers and library consumers. Otherwise, maybe Lines 55 to 58 in c36279f
|
Thanks Matt, but I would like to give "git submodule" a fair chance. One advantage is that GitHub clearly shows which revision of the third party library is being used, for example looking at https://github.com/SuperElastix/elastix/tree/main/ThirdParty
Interesting... https://gitlab.kitware.com/cmake/cmake/-/issues/20579 says:
For elastix, it would be just fine if its submodules are cloned recursively. It actually seems to be the default, when the option However, this CMake issue seems to be specifically about using The documentation of FetchContent_Populate says:
So would it be OK to you if we replace the existing |
b21f310
to
8673688
Compare
@N-Dekker yes, let's use |
CMakeLists.txt
Outdated
FetchContent_GetProperties(elx) | ||
if(NOT elx_POPULATED) | ||
FetchContent_Populate(elx) | ||
# Use CMake's FindOpenCL.cmake, which is backend agnostic | ||
file(REMOVE ${elx_SOURCE_DIR}/CMake/FindOpenCL.cmake) | ||
if(ELASTIX_USE_OPENCL) | ||
find_package(OpenCL REQUIRED) | ||
set(OPENCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS} CACHE PATH "OpenCL include directories") | ||
set(OPENCL_LIBRARIES ${OpenCL_LIBRARIES} CACHE FILEPATH "OpenCL library") | ||
endif() | ||
add_subdirectory(${elx_SOURCE_DIR} ${elx_BINARY_DIR}) | ||
FetchContent_MakeAvailable(elx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we just discussed: the effect of replacing FetchContent_Populate
with FetchContent_MakeAvailable
is not yet entirely clear to me (especially when using OpenCL), so it may need some more research, and I prefer to postpone this change (this specific commit) to a possible later pull request.
0905cad
to
f8ad5c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@N-Dekker thanks!!
Minor issue noted inline.
@thewtex Do I understand correctly that the CI is still failing because of "the time status check"? https://open.cdash.org/viewTest.php?onlytimestatus&buildid=8677302 Apparently itkElastixRegistrationMethodTest takes too long: https://open.cdash.org/test/1064322215 says:
Has this threshold been changed recently? Or does itkElastixRegistrationMethodTest really take more time than before? I'm preparing a performance improvement now: SuperElastix/elastix#887 However, I don't know if it is necessary in order to make the CI happy, and neither do I know if it would be sufficient (just ~5% performance gain). |
@N-Dekker agreed, the timeout could be longer. We could add a longer time: https://github.com/InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction with the Perhaps also make it configurable. |
You can try passing CTest options to the with:
ctest-options: '--timeout' See more details in ITK reusable workflow documentation. |
6f920ce
to
add2107
Compare
Thanks for the hints, @thewtex and @tbirdso Honestly I just don't understand it. Here https://open.cdash.org/test/1066752286 it says:
So In the mean time, I think I still made elastix somewhat faster, SuperElastix/elastix#890 but I guess it won't be much more than ~5%. |
add2107
to
66d49da
Compare
All checks have passed Looks like GitHub has some "incidents", which might be related: https://www.githubstatus.com/ |
29d3c56
to
54ab4d7
Compare
FYI, on my PC, the registration of itkElastixRegistrationMethodTest appears slightly faster when using the latest revision from the main branch of SuperElastix/elastix (~33 seconds), compared to the elastix 5.1.0 release that is used by the main branch of ITKElastix (~34 seconds). |
Thanks @thewtex but now it looks like the "acceptable range" has been adjusted already! The threshold value is much higher now. 😃 Looking at https://open.cdash.org/test/1068413323?graph=time today I saw: The CI is going well so far (17 successful, 2 in progress, and 9 queued checks) so I'm still hopeful 🙏 that this PR may be merged as it is right now. |
I restarted the builds. At least one of them timed out (6 hours and 6 minutes). |
Thanks @dzenanz So I guess we'd have to wait another 6 hours from now...? |
Echoing @dzenanz , Another CI run will typically be triggered on merge into If building for Linux ARM platforms (aarch64) is prohibitive for PR reviews then that platform target could be excluded from the build (see ITK reusable workflow documentation), or only built when CI runs on the |
Thanks @tbirdso
Are there no artifacts (Python wheels) available from a successful PR before the merge? |
Yes, artifacts are expected to be made available from any successful CI run, whether that run occurs in a PR or in the EDIT: For instance, this appears to be the most recent successful run, scroll down to see artifacts: https://github.com/InsightSoftwareConsortium/ITKElastix/actions/runs/4907878277 |
I see it tries to build 11 wheels with each PR, while it is not even being merged. Wouldn't 1 wheel per platform (linux, macos, windows), with one Python version, be OK already? Also I wonder, does the CI build both ITK and elastix from scratch with each PR trigger? Maybe those binaries could be cached somehow, if either of the two libraries are unmodified? Unfortunately I'm not a yml/CI expert. So I'm just asking. |
If I remember correctly, ITK build is cached, but elastix gets rebuilt each time. That allows us the flexibility of just changing the SHA of elastix. |
OK. FYI, it takes 40 to 60 minutes to build elastix at https://github.com/SuperElastix/elastix (GitHub Actions CI). |
@dzenanz @tbirdso @thewtex By the way, I'm curious, did any of you actually change the timeout threshold for CDash/CTest already? Because just today those timeout failures from itkElastixRegistrationMethodTest disappeared and the "Acceptable Range" appeared to have become more "acceptable", as I mentioned at #211 (comment) (Even though I did not yet process Matt's PR N-Dekker#1). |
Not me. |
The CI still fails, including cancellations of build-linux-py (311, 2014-x64) and build-linux-py (311, 2014-x64) But I'm hopeful that a |
54ab4d7
to
0727c9a
Compare
Including: pull request SuperElastix/elastix#891 commit SuperElastix/elastix@ed15547 "PERF: Fill `jsj` (JacobianOfSpatialJacobian) in-place and remove `jsj1`" pull request SuperElastix/elastix#890 commit SuperElastix/elastix@b9ea3a8 "PERF: Fill `jsh` (JacobianOfSpatialJacobian) in-place and remove `jsh1`" pull request SuperElastix/elastix#887 commit SuperElastix/elastix@8298485 PERF: Make EvaluateParzenValues calls faster, using raw buffer of values pull request SuperElastix/elastix#882 commit SuperElastix/elastix@58e0a7b "ENH: Convert the input images to the user-specified internal pixel type" pull request SuperElastix/elastix#864 commit SuperElastix/elastix@c3d478e "ENH: Upgrade elastix from C++14 to C++17" pull request SuperElastix/elastix#856 commit SuperElastix/elastix@48c6458 "ENH: Add SetInitialTransformParameterObject to ElastixRegistrationMethod" pull request SuperElastix/elastix#832 commit SuperElastix/elastix@05d2b40 ENH: Support "ShowProgressPercentage" parameter (`false` by default) pull request SuperElastix/elastix#815 commit SuperElastix/elastix@c4ef707 "ENH: Add `ElastixLogLevel` to the ITK interface" Explicitly specified C++17 as standard for the compilation of ITKElastix.
Allows the user to pass input images to ElastixRegistrationMethod and TransformixFilter whose pixel types differs from the internal pixel type. The elastix/transfomix library will now convert those images automatically, using `itk::CastImageFilter`: pull request SuperElastix/elastix#882 commit SuperElastix/elastix@58e0a7b "ENH: Convert the input images to the user-specified internal pixel type"
0727c9a
to
5a6f9fe
Compare
🎉 Approved by the CI 🥇 |
Hi all, I'm not really a part of this conversation but I did notice that the new feature did not include any specific tests to ensure images with images with dtypes besides float32 and double work. I took the liberty of downloading the artifacts from the most recent CI and tried them out. Good news a lot more dtypes are supported for registration! For reference: import itk
import numpy as np
parameter_object = itk.ParameterObject.New()
default_rigid_parameter_map = parameter_object.GetDefaultParameterMap('rigid')
parameter_object.AddParameterMap(default_rigid_parameter_map)
int_dtypes = (np.uint8, np.int16, np.uint16)
for dtype in int_dtypes:
image = np.random.randint(0, 100, (1024,1024), dtype=dtype)
itk_image = itk.GetImageFromArray(image)
result_image, result_transform_parameters = itk.elastix_registration_method(
itk_image, itk_image,
parameter_object=parameter_object,
log_to_console=False)
assert itk.template(result_image)[1][0] == itk.template(itk_image)[1][0]
floating_dtypes = (np.float32, np.double)
for dtype in floating_dtypes:
image = np.random.rand(1024*1024).astype(dtype).reshape(1024,1024)
itk_image = itk.GetImageFromArray(image)
result_image, result_transform_parameters = itk.elastix_registration_method(
itk_image, itk_image,
parameter_object=parameter_object,
log_to_console=False)
assert itk.template(result_image)[1][0] == itk.template(itk_image)[1][0] Thanks for this. |
@NHPatterson You're welcome, I'm very glad to hear so! I did test the extended pixel type support quite extensively at the C++ side (as part of the GoogleTest unit tests at SuperElastix/elastix/Core/Main/GTesting), but I only did a few local checks on a drafty Jupyter notebook (also using a wheel from the CI ) to see if it works. So thanks for checking it as well! |
Follow-up to InsightSoftwareConsortium#211 commit 1043f10 "ENH: Bump elastix version to 2023-05-15, use C++17" Including: SuperElastix/elastix#936 SuperElastix/elastix@115d8e1 ENH: Add `ElastixRegistrationMethod::SetInitialTransform SuperElastix/elastix#933 SuperElastix/elastix@d33a0d5 BUG: Fix reference count in ConvertItkTransformBaseToSingleItkTransform SuperElastix/elastix#924 SuperElastix/elastix@71a4a9a ENH: Add TransformParameterFileName property to TransformixFilter SuperElastix/elastix#922 SuperElastix/elastix@9d76b86 ENH: Restore ELASTIX_BUILD_EXECUTABLE CMake option SuperElastix/elastix#909 SuperElastix/elastix@9e64269 ENH: ElastixRegistrationMethod writes initial transform parameter files SuperElastix/elastix#903 SuperElastix/elastix@2170592 ENH: Remove the letter 's' from "InitialTransformParametersFileName" SuperElastix/elastix#898 SuperElastix/elastix@691c358 BUG: Add InitialTransformParameterObject maps to registration result
Follow-up to InsightSoftwareConsortium#211 commit 1043f10 "ENH: Bump elastix version to 2023-05-15, use C++17" Including: SuperElastix/elastix#936 SuperElastix/elastix@115d8e1 ENH: Add `ElastixRegistrationMethod::SetInitialTransform SuperElastix/elastix#933 SuperElastix/elastix@d33a0d5 BUG: Fix reference count in ConvertItkTransformBaseToSingleItkTransform SuperElastix/elastix#924 SuperElastix/elastix@71a4a9a ENH: Add TransformParameterFileName property to TransformixFilter SuperElastix/elastix#922 SuperElastix/elastix@9d76b86 ENH: Restore ELASTIX_BUILD_EXECUTABLE CMake option SuperElastix/elastix#909 SuperElastix/elastix@9e64269 ENH: ElastixRegistrationMethod writes initial transform parameter files SuperElastix/elastix#903 SuperElastix/elastix@2170592 ENH: Remove the letter 's' from "InitialTransformParametersFileName" SuperElastix/elastix#898 SuperElastix/elastix@691c358 BUG: Add InitialTransformParameterObject maps to registration result
Follow-up to InsightSoftwareConsortium#211 commit 1043f10 "ENH: Bump elastix version to 2023-05-15, use C++17" Including: SuperElastix/elastix#936 SuperElastix/elastix@115d8e1 ENH: Add `ElastixRegistrationMethod::SetInitialTransform SuperElastix/elastix#933 SuperElastix/elastix@d33a0d5 BUG: Fix reference count in ConvertItkTransformBaseToSingleItkTransform SuperElastix/elastix#924 SuperElastix/elastix@71a4a9a ENH: Add TransformParameterFileName property to TransformixFilter SuperElastix/elastix#922 SuperElastix/elastix@9d76b86 ENH: Restore ELASTIX_BUILD_EXECUTABLE CMake option SuperElastix/elastix#909 SuperElastix/elastix@9e64269 ENH: ElastixRegistrationMethod writes initial transform parameter files SuperElastix/elastix#903 SuperElastix/elastix@2170592 ENH: Remove the letter 's' from "InitialTransformParametersFileName" SuperElastix/elastix#898 SuperElastix/elastix@691c358 BUG: Add InitialTransformParameterObject maps to registration result
Follow-up to #211 commit 1043f10 "ENH: Bump elastix version to 2023-05-15, use C++17" Including: SuperElastix/elastix#936 SuperElastix/elastix@115d8e1 ENH: Add `ElastixRegistrationMethod::SetInitialTransform SuperElastix/elastix#933 SuperElastix/elastix@d33a0d5 BUG: Fix reference count in ConvertItkTransformBaseToSingleItkTransform SuperElastix/elastix#924 SuperElastix/elastix@71a4a9a ENH: Add TransformParameterFileName property to TransformixFilter SuperElastix/elastix#922 SuperElastix/elastix@9d76b86 ENH: Restore ELASTIX_BUILD_EXECUTABLE CMake option SuperElastix/elastix#909 SuperElastix/elastix@9e64269 ENH: ElastixRegistrationMethod writes initial transform parameter files SuperElastix/elastix#903 SuperElastix/elastix@2170592 ENH: Remove the letter 's' from "InitialTransformParametersFileName" SuperElastix/elastix#898 SuperElastix/elastix@691c358 BUG: Add InitialTransformParameterObject maps to registration result
Bump elastix version to 2023-05-15, including:
pull request SuperElastix/elastix#891
commit SuperElastix/elastix@ed15547
"PERF: Fill
jsj
(JacobianOfSpatialJacobian) in-place and removejsj1
"pull request SuperElastix/elastix#890
commit SuperElastix/elastix@b9ea3a8
"PERF: Fill
jsh
(JacobianOfSpatialJacobian) in-place and removejsh1
"pull request SuperElastix/elastix#887
commit SuperElastix/elastix@8298485
PERF: Make EvaluateParzenValues calls faster, using raw buffer of values
pull request SuperElastix/elastix#882
commit SuperElastix/elastix@58e0a7b
"ENH: Convert the input images to the user-specified internal pixel type"
pull request SuperElastix/elastix#864
commit SuperElastix/elastix@c3d478e
"ENH: Upgrade elastix from C++14 to C++17"
pull request SuperElastix/elastix#856
commit SuperElastix/elastix@48c6458
"ENH: Add SetInitialTransformParameterObject to ElastixRegistrationMethod"
pull request SuperElastix/elastix#832
commit SuperElastix/elastix@05d2b40
ENH: Support "ShowProgressPercentage" parameter (
false
by default)pull request SuperElastix/elastix#815
commit SuperElastix/elastix@c4ef707
"ENH: Add
ElastixLogLevel
to the ITK interface"Explicitly specified C++17 as standard for the compilation of ITKElastix.
Supported any scalar type (not just real) as input pixel type.
Because of the included elastix
PERF
commits, this pull request appears to make the itkElastixRegistrationMethodTest around 10% faster.