Skip to content
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

ENH: Replace InitializeElastixLibrary() by InitializeElastixExecutable() #248

Merged
merged 1 commit into from
May 1, 2020

Conversation

N-Dekker
Copy link
Member

@N-Dekker N-Dekker commented May 1, 2020

Kasper Marstal reported yesterday via direct messaging that the introduction of IsElastixLibrary(), pull request #231, commit 64ced59 (March 2, 2020, "Replace _ELASTIX_BUILD_LIBRARY by BaseComponent::IsElastixLibrary"), did break SimpleElastix. SimpleElastix depends on the library interface, while it does not construct an elastix::ELASTIX library object.

The most elegant and reliable fix appears to be flipping the default value returned by IsElastixLibrary(), from false to true, and then ensuring that the value is set to false at the start of each run of the executable.

@N-Dekker N-Dekker requested a review from kaspermarstal May 1, 2020 11:30
Copy link
Member

@kaspermarstal kaspermarstal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I think you also need to call InitializeElastixExectuable() in the transformix executable (Core/Main/transformix.cxx).

I think you're right, thanks, I'll amend the commit, but do you think it would matter? Would it really change the behavior of the transformix executable? It depends on where, on which places IsElastixLibrary() is actually checked: 64ced59

And is there any reason to perform the assert in the destructor of the ELASTIX class?

Well... IsElastixLibrary() should always return true, from the begin of the lifetime of the ELASTIX library object right until the very end of its lifetime. So I thought it would be nice to assert so both at the begin and at the end of its lifetime. If it really bothers you, I can remove the assert, no problem, but otherwise I think I just leave it in.

Kasper Marstal reported yesterday via direct messaging that the introduction of `IsElastixLibrary()`, pull request #231, commit 64ced59 (March 2, 2020, "Replace _ELASTIX_BUILD_LIBRARY by BaseComponent::IsElastixLibrary"), did break SimpleElastix.  SimpleElastix depends on the library interface, while it does not construct an `elastix::ELASTIX` library object.

The most elegant and reliable fix appears to be flipping the default value returned by `IsElastixLibrary()`, from `false` to `true`, and then ensuring that the value is set to `false` at the start of each run of the executable.

This applies to the transformix executable as well.
@N-Dekker N-Dekker force-pushed the Flip-default-from-executable-to-library branch from 0b74030 to ef64fb2 Compare May 1, 2020 13:41
@N-Dekker N-Dekker marked this pull request as ready for review May 1, 2020 13:41
@N-Dekker
Copy link
Member Author

N-Dekker commented May 1, 2020

@kaspermarstal If you think the pull request is fine (and if it compiles and passes the tests), you may just click "Rebase and merge", to get rid of the blocker 😃

@kaspermarstal
Copy link
Member

I think you're right, thanks, I'll amend the commit, but do you think it would matter? Would it really change the behavior of the transformix executable? It depends on where, on which places IsElastixLibrary() is actually checked: 64ced59

The change broke the tests with the transformix executable so it was definitely needed. Thanks!

@kaspermarstal kaspermarstal merged commit dac2d85 into develop May 1, 2020
@N-Dekker
Copy link
Member Author

N-Dekker commented May 2, 2020

@kaspermarstal If you think the pull request is fine (and if it compiles and passes the tests), you may just click "Rebase and merge"

Thanks for pressing the button, Kasper! 👍

Minor comment: it appears that your merge has resulted in two commits, instead of one, at https://github.com/SuperElastix/elastix/commits/develop I think that's because you clicked "Merge pull request", right? When you would have clicked "Rebase and merge", I think it would have resulted in a single commit the develop branch, combining the code change and the merge into one. Which is my personal preference. No need to change it for this time, of course! 😃

@N-Dekker N-Dekker deleted the Flip-default-from-executable-to-library branch May 2, 2020 09:53
N-Dekker added a commit to N-Dekker/ITKElastix that referenced this pull request Sep 8, 2020
Removed obsolete `elastix::BaseComponent::InitializeElastixLibrary()` calls, as Elastix is now initialized as a library by default: SuperElastix/elastix#248
N-Dekker added a commit to N-Dekker/ITKElastix that referenced this pull request Sep 9, 2020
Removed obsolete `elastix::BaseComponent::InitializeElastixLibrary()` calls, as Elastix is now initialized as a library by default: SuperElastix/elastix#248
N-Dekker added a commit to N-Dekker/ITKElastix that referenced this pull request Sep 10, 2020
Removed obsolete `elastix::BaseComponent::InitializeElastixLibrary()`
calls, as Elastix is now initialized as a library by default:
"ENH: Replace InitializeElastixLibrary() by InitializeElastixExecutable()"
SuperElastix/elastix#248
SuperElastix/elastix@ef64fb2

Adjusted CMake `Elastix_LIBRARIES`, as the Elastix library CMake targets
are now named elastix_lib and transformix_lib:
"ENH: Allow building exe and lib of elastix and transformix together"
SuperElastix/elastix#232
SuperElastix/elastix@3944a13
N-Dekker added a commit to N-Dekker/ITKElastix that referenced this pull request Sep 11, 2020
Removed obsolete `elastix::BaseComponent::InitializeElastixLibrary()`
calls, as Elastix is now initialized as a library by default:
"ENH: Replace InitializeElastixLibrary() by InitializeElastixExecutable()"
SuperElastix/elastix#248
SuperElastix/elastix@ef64fb2

Adjusted CMake `Elastix_LIBRARIES`, as the Elastix library CMake targets
are now named elastix_lib and transformix_lib:
"ENH: Allow building exe and lib of elastix and transformix together"
SuperElastix/elastix#232
SuperElastix/elastix@3944a13
N-Dekker added a commit to N-Dekker/ITKElastix that referenced this pull request Sep 11, 2020
Removed obsolete `elastix::BaseComponent::InitializeElastixLibrary()`
calls, as Elastix is now initialized as a library by default:
"ENH: Replace InitializeElastixLibrary() by InitializeElastixExecutable()"
SuperElastix/elastix#248
SuperElastix/elastix@ef64fb2

Adjusted CMake `Elastix_LIBRARIES`, as the Elastix library CMake targets
are now named elastix_lib and transformix_lib:
"ENH: Allow building exe and lib of elastix and transformix together"
SuperElastix/elastix#232
SuperElastix/elastix@3944a13
N-Dekker added a commit to N-Dekker/ITKElastix that referenced this pull request Sep 11, 2020
Removed obsolete `elastix::BaseComponent::InitializeElastixLibrary()`
calls, as Elastix is now initialized as a library by default:
"ENH: Replace InitializeElastixLibrary() by InitializeElastixExecutable()"
SuperElastix/elastix#248
SuperElastix/elastix@ef64fb2

Adjusted CMake `Elastix_LIBRARIES`, as the Elastix library CMake targets
are now named elastix_lib and transformix_lib:
"ENH: Allow building exe and lib of elastix and transformix together"
SuperElastix/elastix#232
SuperElastix/elastix@3944a13
N-Dekker added a commit to N-Dekker/ITKElastix that referenced this pull request Sep 12, 2020
Removed obsolete `elastix::BaseComponent::InitializeElastixLibrary()`
calls, as Elastix is now initialized as a library by default:
"ENH: Replace InitializeElastixLibrary() by InitializeElastixExecutable()"
SuperElastix/elastix#248
SuperElastix/elastix@ef64fb2

Adjusted CMake `Elastix_LIBRARIES`, as the Elastix library CMake targets
are now named elastix_lib and transformix_lib:
"ENH: Allow building exe and lib of elastix and transformix together"
SuperElastix/elastix#232
SuperElastix/elastix@3944a13
N-Dekker added a commit to N-Dekker/ITKElastix that referenced this pull request Sep 12, 2020
Removed obsolete `elastix::BaseComponent::InitializeElastixLibrary()`
calls, as Elastix is now initialized as a library by default:
"ENH: Replace InitializeElastixLibrary() by InitializeElastixExecutable()"
SuperElastix/elastix#248
SuperElastix/elastix@ef64fb2

Adjusted CMake `Elastix_LIBRARIES`, as the Elastix library CMake targets
are now named elastix_lib and transformix_lib:
"ENH: Allow building exe and lib of elastix and transformix together"
SuperElastix/elastix#232
SuperElastix/elastix@3944a13
N-Dekker added a commit to N-Dekker/ITKElastix that referenced this pull request Sep 13, 2020
Removed obsolete `elastix::BaseComponent::InitializeElastixLibrary()`
calls, as Elastix is now initialized as a library by default:
"ENH: Replace InitializeElastixLibrary() by InitializeElastixExecutable()"
SuperElastix/elastix#248
SuperElastix/elastix@ef64fb2

Adjusted CMake `Elastix_LIBRARIES`, as the Elastix library CMake targets
are now named elastix_lib and transformix_lib:
"ENH: Allow building exe and lib of elastix and transformix together"
SuperElastix/elastix#232
SuperElastix/elastix@3944a13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants