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

Improve ITKReader, testITKio and testITKReader #1379

Merged
merged 14 commits into from
Jan 26, 2019

Conversation

BorisMansencal
Copy link
Contributor

@BorisMansencal BorisMansencal commented Jan 14, 2019

PR Description

Currently, when DGtal is configured with ITK, testITKio is failing.

This PR:

  • add UINT and INT types handling to ITKReader to make testITKio pass
  • add ULONG and LONG type handling to ITKReader and corresponding tests (in testITKio)
  • fix ITKReader crash on non existing files and add corresponding test (in testITKReader)
  • clean code (in particular remove some dead code) in ITKReader, testITKio and testITKReader

It compiles with gcc (8.2.1) and clang (7.0) and pass tests.

In Debug mode, gcc 8.2.1 produces some warnings. Some are specific to ITK. Another is due to the "implicit fallthrough" in the switch case line 71 of ITKReader.ih. I don't know if it was the expected behavior. If it is, a comment with "Falls through" (for example) should be added to silence gcc7 implicit-fallthrough warning (see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-fallthrough ).

Checklist

  • Unit-test of your feature with Catch.
  • Doxygen documentation of the code completed (classes, methods, types, members...)
  • Documentation module page added or updated.
  • New entry in the ChangeLog.md added.
  • No warning raised in Debug cmake mode (otherwise, Travis C.I. will fail).
  • All continuous integration tests pass (Travis & appveyor)

long and unsigned long images are saved as LONLLONG and ULONGLONG by itkMetaImageIO, so handle these types in ITKReader.
Correctly handle non existent image file in ITKReader and add corresponding test.
No need to initialize itk_image variable as it will be overwritten.
@BorisMansencal
Copy link
Contributor Author

It seems that the build stalled on OSX.
Is there a way to launch this build again ?

FYI, this code compiles and tests pass on macOS High Sierra (10.13.6) with "Apple LLVM version 8.0.0 (clang-800.0.42.1)".

@rolanddenis
Copy link
Member

You can log in to Travis using your Github credentials and then restart your jobs. The job on OSX seems to pass now :octocat:

@dcoeurjo dcoeurjo added this to Inbox in Issue triage via automation Jan 15, 2019
@dcoeurjo dcoeurjo added this to the 1.0 milestone Jan 15, 2019
In Debug mode, -Wpedantic of gcc 8.2.1 warns about extra ";" after some ITK macros.
In Debug, gcc 8.2.1 [-Wimplicit-fallthrough] warns about the implicit fallthrough in the switch case. Add a more explicit message and a comment to silence the warning.
@BorisMansencal
Copy link
Contributor Author

I added some small corrections to debug some warnings when compiled in Debug mode (with gcc 8.2.1 or clang 7.0.0.
I also added a more explicit message and a "//fallthrough" comment that silence the "implicit fallthrough" warning.

@BorisMansencal BorisMansencal mentioned this pull request Jan 17, 2019
6 tasks
@dcoeurjo
Copy link
Member

Thanks for the PR !

Copy link
Member

@dcoeurjo dcoeurjo left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I've just few minor coding style issues.

src/DGtal/io/readers/ITKReader.ih Outdated Show resolved Hide resolved
tests/io/readers/testITKReader.cpp Outdated Show resolved Hide resolved
tests/io/readers/testITKReader.cpp Outdated Show resolved Hide resolved
tests/io/readers/testITKReader.cpp Show resolved Hide resolved
@dcoeurjo
Copy link
Member

All good. Ma y thanks.

@dcoeurjo dcoeurjo merged commit 02bd69b into DGtal-team:master Jan 26, 2019
Issue triage automation moved this from Inbox to Done Jan 26, 2019
@BorisMansencal BorisMansencal deleted the ITKio1 branch February 5, 2019 09:35
@BorisMansencal BorisMansencal mentioned this pull request Feb 14, 2019
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Issue triage
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants