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

ADD: Addition of point to surface metric to elastix. #236

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gokhangg
Copy link

@gokhangg gokhangg commented Apr 4, 2020

No description provided.

@N-Dekker
Copy link
Member

N-Dekker commented Apr 7, 2020

Thank you Gokhan @gokhangg I just retrieved your work by cloning github.com/gokhangg/elastix.git and did an initial build. Everything builds fine, also on my laptop. 😃 However, it appears that your work is not included with the compilation! Do you still have a CMakeLists.txt that should be added, or a modification to an existing elastix CMake file?

@gokhangg
Copy link
Author

gokhangg commented Apr 7, 2020

"However, it appears that your work is not included with the compilation! Do you still have a CMakeLists.txt that should be added, or a modification to an existing elastix CMake file?"

Could not get here, could you please clarify?

@N-Dekker
Copy link
Member

N-Dekker commented Apr 7, 2020

Could not get here, could you please clarify?

Your "elxPointToSurfaceDistanceMetric.cxx"should be compiled when elastix is built, right? Does it actually get compiled on your computer? When you deliberately make a syntax error in your cxx file, for example by typing #error Please get me a compilation error!, do you get a compilation error indeed?

@N-Dekker
Copy link
Member

N-Dekker commented Apr 8, 2020

I think you should add a "CMakeLists.txt" to the directory of your metric, having something like this:

ADD_ELXCOMPONENT( PointToSurfaceDistanceMetric ON
  elxPointToSurfaceDistanceMetric.h
  elxPointToSurfaceDistanceMetric.hxx
  elxPointToSurfaceDistanceMetric.cxx
  itkPointToSurfaceDistanceMetric.h
  itkPointToSurfaceDistanceMetric.hxx )

Also I think the directory of your metric should be renamed to "PointToSurfaceDistanceMetric" (by adding the word "Metric"), otherwise I still get build errors.

@gokhangg
Copy link
Author

gokhangg commented Apr 8, 2020

Hi Niels, I have checked this issue and it seems that the .gitignore blocks uploading cmake related files.
Line 36 ignores "cmake*". So actually that file was inside but git ignored it while pushing. So I think you should delete that line in the gitignore file or I can send that CMakeLists.txt file to you and then you can upload to the repo.

@N-Dekker
Copy link
Member

N-Dekker commented Apr 8, 2020

@gokhangg

I have checked this issue and it seems that the .gitignore blocks uploading cmake related files.
Line 36 ignores "cmake*".

Wow, well spotted! I'll remove "cmake*" from the ignore-list, thanks!

N-Dekker added a commit that referenced this pull request Apr 8, 2020
Having cmake* in there stopped Gokhan Gunay from adding his CMakeLists file to pull request #236 (Addition of PointToSurface metric).
@N-Dekker
Copy link
Member

N-Dekker commented Apr 8, 2020

@gokhangg Could you please still try to add your CMakeLists to your branch, using the git option "--force"? Something like this, if I understand correctly:

git add --force CMakeLists.txt

As I read at https://stackoverflow.com/questions/24844782/how-to-override-a-rule-set-in-gitignore

@gokhangg
Copy link
Author

gokhangg commented Apr 8, 2020

Sure I can indeed bypass the ignore but just wanted to inform you. After the pull for the cmake fix, could you inform me then I will update my request?

N-Dekker added a commit that referenced this pull request Apr 8, 2020
Having cmake* in there stopped Gokhan Gunay from adding his CMakeLists file to pull request #236 (Addition of PointToSurface metric).
@N-Dekker
Copy link
Member

N-Dekker commented Apr 8, 2020

OK, I removed "cmake*" from .gitignore (pull request #239). Can you please add your CMakeLists.txt to your pull request?

@gokhangg
Copy link
Author

gokhangg commented Apr 8, 2020

Sure

@gokhangg gokhangg force-pushed the develop branch 2 times, most recently from b8befdd to 0875d28 Compare April 8, 2020 16:24
@gokhangg
Copy link
Author

gokhangg commented Apr 8, 2020

You can merge now ;)

@gokhangg
Copy link
Author

gokhangg commented Apr 9, 2020

Can we copy from other files? I think should be the same ??

@gokhangg gokhangg force-pushed the develop branch 2 times, most recently from 51e0505 to 8bf1e4b Compare April 14, 2020 09:28
/** Run-time type information (and related methods). */
itkTypeMacro( PointToSurfaceDistanceMetric, SingleValuedPointSetToPointSetMetric );//OK
/** Initialize. */
virtual void Initialize() noexcept(false);
Copy link
Member

Choose a reason for hiding this comment

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

I see you marked some member functions noexcept(false), indicating that they might throw an exception. Why would you do so? When I use noexcept, it's usually just to indicate that a function does not throw.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Member

Choose a reason for hiding this comment

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

@gokhangg Thanks for your patience. I still see noexcept(false) five times in your proposal. Would you want to remove these as well? Or do they have a special reason?

Copy link
Author

Choose a reason for hiding this comment

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

All removed

Copy link
Author

Choose a reason for hiding this comment

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

All removed

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @gokhangg Nowadays I think it's better to only use noexcept when the benefit is really clear (which is clearly the case for move-constructors and move-assignment operators). But other people think otherwise... For your information, I did a little lightning talk about noexcept at the conference C++ on Sea, two years ago https://www.youtube.com/watch?v=dVRLp-Rwg0k regarding my noexcept benchmark

@gokhangg gokhangg changed the title ENH: Addition of point to surface metric to elastix. ADD: Addition of point to surface metric to elastix. Feb 5, 2021
@gokhangg gokhangg force-pushed the develop branch 2 times, most recently from 8fb3f85 to a46c55d Compare February 5, 2021 11:34
@gokhangg
Copy link
Author

gokhangg commented Feb 5, 2021

No description provided.

Can you please add a description to your commit? Actually that's a request from Marius (@mstaring). 😃 The formatting convention for a commit message is as follows:

  • The first line of the commit message starts with "ENH: " for enhancement, and is at most 72 characters (ITK convention). It is the "subject line" of the commit message.
  • The second line is entirely empty.
  • The next lines give a more detailed description.

@gokhangg gokhangg closed this Feb 5, 2021
@gokhangg gokhangg reopened this Feb 5, 2021
@gokhangg
Copy link
Author

gokhangg commented Feb 5, 2021

can you comment on this PR? Is it ready for merging?

Hi Marius @mstaring I gave a comment, is it possible to check if it is in the correct condition?

@N-Dekker
Copy link
Member

N-Dekker commented Feb 5, 2021

@gokhangg Can you possibly squash all (four) commits of your pull request together, to make it one single commit?

 git rebase -i HEAD~4

An then replace "pick" on the second and subsequent commits with "squash": https://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git

And then git push --force-with-lease, of course 😃

gokhangg pushed a commit to gokhangg/elastix that referenced this pull request Feb 5, 2021
Replaced `_ELASTIX_BUILD_LIBRARY` preprocessor definition by static member function, `BaseComponent::IsElastixLibrary()`.

Anticipates sharing the intermediate binary object files between the Elastix executable and the Elastix library, possibly building them within the same project, or the same (Visual Studio) solution.

Addition of PointToSurface metric

COMP: Remove cmake* from .gitignore

Having cmake* in there stopped Gokhan Gunay from adding his CMakeLists file to pull request SuperElastix#236 (Addition of PointToSurface metric).

Addition of PointToSurface metric
gokhangg pushed a commit to gokhangg/elastix that referenced this pull request Feb 5, 2021
Replaced `_ELASTIX_BUILD_LIBRARY` preprocessor definition by static member function, `BaseComponent::IsElastixLibrary()`.

Anticipates sharing the intermediate binary object files between the Elastix executable and the Elastix library, possibly building them within the same project, or the same (Visual Studio) solution.

Addition of PointToSurface metric

COMP: Remove cmake* from .gitignore

Having cmake* in there stopped Gokhan Gunay from adding his CMakeLists file to pull request SuperElastix#236 (Addition of PointToSurface metric).

Addition of PointToSurface metric
@gokhangg
Copy link
Author

gokhangg commented Feb 5, 2021

@N-Dekker Hi Niels there are some conflicts popped up after squashing the middle-commits. So seems that there is a discrepancy between my fork and the superelastix::develop branch. So shall we resolve the conflicts manually?

COMP: Remove cmake* from .gitignore

Having cmake* in there stopped Gokhan Gunay from adding his CMakeLists file to pull request SuperElastix#236 (Addition of PointToSurface metric).

Addition of PointToSurface metric

ADD: Addition of point to surface metric to Elastix.

In this commit addition of point to surface metric is done.
This metric essentially considers how surface of an masked organ
is aligned with the points provided from the surface of the organ.
Therefore, it is used to improve alignment of the organ under interest.
@N-Dekker
Copy link
Member

N-Dekker commented Feb 5, 2021

Oh no... git happening 😢 Should any of those conflicting files be adjusted by your pull request? I mean, did you intend to propose changes to any of those files?

@N-Dekker
Copy link
Member

N-Dekker commented Feb 5, 2021

@gokhangg It would be wonderful if you could fix the git conflicts. But you probably need a lot of "git magic" to get it right. It might be easier to just create a new branch from the latest SuperElastix/elastix "develop", and create a new pull request. (Don't feel bad... git happens 😸) I leave it up to you.

@gokhangg
Copy link
Author

gokhangg commented Feb 5, 2021

@N-Dekker ACtually those changed files are coming from other places not in this PR. I will try to solve it.

gokhangg pushed a commit to gokhangg/elastix that referenced this pull request Feb 5, 2021
Having cmake* in there stopped Gokhan Gunay from adding his CMakeLists file to pull request SuperElastix#236 (Addition of PointToSurface metric).
gokhangg added a commit to gokhangg/elastix that referenced this pull request Feb 5, 2021
COMP: Remove cmake* from .gitignore

Having cmake* in there stopped Gokhan Gunay from adding his CMakeLists file to pull request SuperElastix#236 (Addition of PointToSurface metric).

Addition of PointToSurface metric
gokhangg pushed a commit to gokhangg/elastix that referenced this pull request Feb 5, 2021
Replaced `_ELASTIX_BUILD_LIBRARY` preprocessor definition by static member function, `BaseComponent::IsElastixLibrary()`.

Anticipates sharing the intermediate binary object files between the Elastix executable and the Elastix library, possibly building them within the same project, or the same (Visual Studio) solution.

Addition of PointToSurface metric

COMP: Remove cmake* from .gitignore

Having cmake* in there stopped Gokhan Gunay from adding his CMakeLists file to pull request SuperElastix#236 (Addition of PointToSurface metric).

Addition of PointToSurface metric
gokhangg added a commit to gokhangg/elastix that referenced this pull request Feb 5, 2021
COMP: Remove cmake* from .gitignore

Having cmake* in there stopped Gokhan Gunay from adding his CMakeLists file to pull request SuperElastix#236 (Addition of PointToSurface metric).

Addition of PointToSurface metric

ADD: Addition of point to surface metric to Elastix.

In this commit addition of point to surface metric is done.
This metric essentially considers how surface of an masked organ
is aligned with the points provided from the surface of the organ.
Therefore, it is used to improve alignment of the organ under interest.
@gokhangg gokhangg force-pushed the develop branch 2 times, most recently from 227d9c5 to 7a793af Compare February 5, 2021 14:24
@gokhangg
Copy link
Author

gokhangg commented Feb 5, 2021

@N-Dekker I have found out that it is related to neither the changes I did nor the discrepancy in the base. There was a nonlinearity in the commit line so after squashing all other commits except the one breaking the linearity it was solved. Indeed I changed the message of the commit :)

::Initialize()
{
/** Initialize transform, interpolator, etc.
Superclass::Initialize();
Copy link
Member

Choose a reason for hiding this comment

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

Is it the intention that this Superclass::Initialize() call is commented out?

*
*=========================================================================*/
#ifndef __elxPointToSurfaceDistanceMetric_H__
#define __elxPointToSurfaceDistanceMetric_H__
Copy link
Member

Choose a reason for hiding this comment

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

(Minor nitpick) In elastix, as well as in ITK, we no longer have those __ underscores at the begin and the end of include guard macro names. See #339 Of course, we can remove them from your header files later, no problem.

@N-Dekker
Copy link
Member

N-Dekker commented Feb 8, 2021

@gokhangg Could you possibly also include a little test (unit test) with your pull request?

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.

3 participants