-
Notifications
You must be signed in to change notification settings - Fork 17
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: Add examples to the template. #46
ENH: Add examples to the template. #46
Conversation
Add a hint to foster writing examples for the contributed classes.
A few comments:
|
I've further thinking about this. In absence of any elaborated examples, a fairly easy solution, and a nice and much needed addition could be to write a performance benchmark. Considering the way the ITKPerformanceBenchmarking is structured, an example reporting the performance could fit into that framework. Otherwise, if we think that performance benchmarks should be made more explicit and deserve a separate module, we may need to further think how we can propose this. In either case, I'd be happy to work on that. Also, the example pointed in #34 embeds the example binary data within the same folder, instead of using the |
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.
I think that adding the example to the module template is useful.
|
||
find_package(ITK REQUIRED | ||
COMPONENTS | ||
ITKImageIO |
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.
This is problematic if the example is built as part of ITK. See this.
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.
@fbudin69500 do you think we should add this to the module template?
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.
This seems difficult to address cleanly for now as the template would have to explicitly instantiate certain IOs and it is not possible to know ahead of time which IOs should be instantiated. There could be hints in the CMakeLists.txt with commented out lines of code with the IO names that the developer could either uncomment or remove, but that doesn't seem ideal. @dzenanz : Was an issue created in the issue tracker for that Meta module IO issue?
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.
I just created an issue: InsightSoftwareConsortium/ITK#359
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.
We could apply solution from ITKMontage
:
https://github.com/InsightSoftwareConsortium/ITKMontage/blob/v0.8.2/examples/CMakeLists.txt#L4-L22
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.
PR #163.
@@ -0,0 +1,12 @@ | |||
cmake_minimum_required(VERSION 3.10.2) | |||
project({{ cookiecutter.module_name }}Examples) |
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.
Do we need to add CXX
or does this help CMake somehow exclude any Python example file that is added along?
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.
Python examples don't need to be built -- the default include CXX
-> this is good.
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.
🤔 So do we need to use
project({{ cookiecutter.module_name }}Examples CXX)
explicitly then?
@@ -0,0 +1,12 @@ | |||
cmake_minimum_required(VERSION 3.10.2) | |||
project({{ cookiecutter.module_name }}Examples) |
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.
Also, do we need to enable and add tests for the examples?
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.
If the example does something, we can use it to write a test, see this. Having test data in there is harder to properly support, that's why I removed it.
Awesome @jhlegarreta ! This is a great contribution. Examples are essential. For the testing data, perhaps we can use the CMake FetchContent module? It requires CMake 3.11, but we could just add |
🤔 Not sure how the CMake |
FetchContent can be used inside an example so the example can be copied outside the module as a starting point for a new independent application. Configuration with FetchContent is much simpler than CMake ExternalData, so the example can remain simple. |
@jhlegarreta This is more than a year out of date. Can it be abandoned? |
You're right Hans, it's been a while. I have not found the time to investigate more. IMHO, having the If at some point someone has the cycles to tackle this, unless we delete the branch, they will be able to re-open it or to get some inspiration from this. |
@dzenanz Can you please re-address your concerns with this issue? If it is an incremental improvement with known deficencies, could it be merged? If not, let's make it into an issue and close this PR. |
It is not a simple fix. I updated the issue #34. |
This PR was fairly close to working. Applying solution from https://github.com/InsightSoftwareConsortium/ITKMontage/blob/v0.8.2/examples/CMakeLists.txt#L4-L22, along with a general update should make it work. Jon, can you revive it? |
PR #163. |
Add a hint to foster writing examples for the contributed classes.
Resolves #34.