-
-
Notifications
You must be signed in to change notification settings - Fork 713
ENH: Added policy for constant NeighborhoodRange values outside image #105
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
Conversation
|
http://review.source.kitware.com/#/c/23795/ Uploaded patch set 1.Oct 9 4:30 PM Kitware Build Robot Niels Dekker Niels Dekker Kitware Build Robot Pablo He...z-Cerdan Niels Dekker Niels Dekker Kitware Build Robot Niels Dekker Niels Dekker Kitware Build Robot Niels Dekker Niels Dekker Niels Dekker Kitware Build Robot Matt McCormick Niels Dekker Niels Dekker Kitware Build Robot Niels Dekker Niels Dekker Kitware Build Robot Niels Dekker Niels Dekker Kitware Build Robot Niels Dekker Kitware Build Robot Niels Dekker Niels Dekker Kitware Build Robot Niels Dekker Kitware Build Robot Matt McCormick Niels Dekker Matt McCormick Niels Dekker Kitware Build Robot Niels Dekker Kitware Build Robot Powered by Gerrit Code Review (2.12-1-g6f7dc21) | Press '?' to view keyboard shortcuts |
N-Dekker
left a comment
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.
Yes, I approve this PR, but then of course, I have to admit I am the submitter 😇 Minor remark: I do find the class name a bit lengthy: ConstantBoundaryImageNeighborhoodPixelAccessPolicy But that's no showstopper to me.
|
@hjmjohnson Just for my understanding, why did you close this PR of mine? |
|
Accidently deleted/closed branch when the script for moving from Gerrit went haywire. |
|
@N-Dekker Sorry about the confusion. I tried to bulk push the gerrit repo to my personal repo, and ended up destroying all my PR's in one stroke of the keys. :(. It should be fixed now. |
|
Some more discussion here: @hjmjohnson or @N-Dekker could this topic please be re-based on |
|
Rebasing on |
def5d12 to
f692f2d
Compare
|
|
|
Windows build is a false positive due to a filesystem / network error. 😢 I created Issue #159 to prevent this from happening again. I will amend and force push to restart the builds. |
f692f2d to
578ccbc
Compare
phcerdan
left a comment
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.
[quote="Niels_Dekker, post:30, topic:879"]
Sorry but I’m not really convinced. Allowing to modify the constant padding value after range initialization might make things harder to follow, in my opinion. Especially when the padding value is modified after retrieving iterators from the range (using begin() and end() ). It would yield the question whether such a modification would still affect these iterators. It seems clearer to me to specify the constant padding value as part of the range initialization so that it would then clearly remain constant.
[/quote]
The issue I see with the current API is that the optional parameter of a particular policy should be encoded in that policy, not in the Range that can use any policy. Right now Range<TPolicy, TOptionalParameterForConstantPolicy>
What would happen if another policy comes by with another parameter type, we will need to modify Range template parameter?
What do you think about this? Do you think another API would be possible?
I suggested the Policy as data member because it solves this mangling, it would be less clean to use, we will have to first construct the range and then modify the policy, but I don't see where the performance will be reduced (there is only one way to know though).
In any case, this is good stuff! 🎩
Requesting changes just to hear if you think there are alternatives.
|
@phcerdan wrote:
Sorry, I don't get you point. I named the NeighborhoodRange template parameter
No, the user just has to instantiate the range class with that other parameter type (for example, Note that Does that answer your question? |
Added ConstantBoundaryImageNeighborhoodPixelAccessPolicy - a policy to get a specified constant value from ShapedImageNeighborhoodRange when a pixel value outside the image is queried. Equivalent to itk::ConstantBoundaryCondition with itk::ConstNeighborhoodIterator. Adapted ShapedImageNeighborhoodRange to allow the user to specify an optional pixel access parameter. This parameter allows specifying the constant value for this policy. Change-Id: I5a1ae9f918a31d03a4dd3d84ceedd4385ab4ec7d
578ccbc to
569dce7
Compare
|
You clarified one, thanks. |
|
@phcerdan wrote:
You're welcome :-)
It seems like the most common use cases would not need the pixel access parameter. When a user does not specify the pixel access parameter type when instantiating the Range type, it will be So I'm not concerned about that. However, I'm interested to know if there are ITK users that would actually need to specify this pixel access parameter at run-time. Otherwise this feature might as well be postponed until after ITK 5.0. Especially if a simple (non-parameterized) ZeroBoundary policy would be sufficient for @thewtex his ultrasound application KitwareMedical/ITKUltrasound#98 |
Relying on default parameters could be problematic for classes needing control on the policies, we suffered this with classes using defaulted boundary conditions. If this approach is merged, I would recommend that future classes needing control of boundary policies, use the
Yeah, I don't know, I talked in the past that 4 policies (with no options) would cover 99.9% of the cases, I am just exposing my concerns, I doubt imposing the optional template parameter to all the classes that use policies is the best design, but happy to be convinced in other direction. |
|
@phcerdan wrote:
OK. As a small adjustment to the current patch, a typedef, PixelAccessParameterType, could be added to each policy class. (Policies that don't need them could just do
Some user might like to use the average pixel value of an image as its constant padding value. That's certainly an example of a run-time parameter. And it seems like a reasonable use case to me. However, we can also just wait for the user request :-) |
Yes! 👍 |
|
Just some thoughts here on how to implement
|
|
Superseded by #212 (which is from my own fork, instead of the Gerrit/GitHub migration branch by @hjmjohnson). #212 has removed the extra template parameter, TOptionalPixelAccessParameter from the NeighborhoodRange class. Instead, it has added a nested type, |
N-Dekker
left a comment
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.
@hjmjohnson Can you please close this PR (#105)? It has been superseded by #212 (which has been merged already).
No description provided.