ENH: Add operator== and operator!= to itk::Image#2188
ENH: Add operator== and operator!= to itk::Image#2188hjmjohnson merged 1 commit intoInsightSoftwareConsortium:masterfrom
Conversation
3478e79 to
20f6b96
Compare
|
@hjmjohnson Thank you for the assignment! By the way, what does it mean to be assigned to a PR? |
|
The assignment does not really mean much for ITK. I assigned it to indicate the most important person for this PR. |
20f6b96 to
9bd662b
Compare
9bd662b to
18bc959
Compare
|
Thanks for you approval, @dzenanz FYI The force-push that I just did only cleans up the added tests a little bit. I just realized it should be sufficient to test two |
|
This is nicely coded with nice tests. I have mixed opinions about the Aside from that, please look at the following place where ITK has already established a "tolerance" for comparison of the meta-data geometry: You mention that the goal of this PR is to enable GTEST comparison operators. For that an approximation or tolerant testing method is really needed. |
Added `operator==` and `operator!=` overloads which tell whether or not two images are equal, based on their value semantics (not just their addresses in memory). Allowed testing if two images (not just image pointers) compare equal or unequal by using GoogleTest `EXPECT_EQ(image1, image2)` and `EXPECT_NE(image1, image2)`.
18bc959 to
895645b
Compare
dzenanz
left a comment
There was a problem hiding this comment.
Sometimes, we might want true equality. And the equality operator a natural place for it.
We could add approximate equality method to Image? But that can be a later PR.
Tests that an image written by `itk::WriteImage` can be read back, without loss of data. Uses two recently added functions: - `itk::ReadImage`: pull request InsightSoftwareConsortium#2184 commit aeea88b - `operator==` for images: pull request InsightSoftwareConsortium#2188 commit 7f3337d (`operator==` is called internally by GoogleTest `EXPECT_EQ`.)
Tests that an image written by `itk::WriteImage` can be read back, without loss of data. Uses two recently added functions: - `itk::ReadImage`: pull request #2184 commit aeea88b - `operator==` for images: pull request #2188 commit 7f3337d (`operator==` is called internally by GoogleTest `EXPECT_EQ`.)
Follow-up to "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d
Follow-up to "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d
Follow-up to "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d
The ability to instantiate `itk::Image<TPixel, VImageDimension>` for a non-EqualityComparable pixel type was broken by: "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d Reported by Bradley Lowekamp: issue InsightSoftwareConsortium#2583 "Explicit instantiation of itk::Image fails with 5.2 when pixel type does not support operator==" This commit fixes the issue by defining the `operator==` and `operator!=` friend functions of `itk::Image` as function _templates_, rather than as non-templates.
The ability to instantiate `itk::Image<TPixel, VImageDimension>` for a non-EqualityComparable pixel type was broken by: "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d Reported by Bradley Lowekamp: issue InsightSoftwareConsortium#2583 "Explicit instantiation of itk::Image fails with 5.2 when pixel type does not support operator==" This commit fixes the issue by defining the `operator==` and `operator!=` friend functions of `itk::Image` as function _templates_, rather than as non-templates.
The ability to instantiate `itk::Image<TPixel, VImageDimension>` for a non-EqualityComparable pixel type was broken by: "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d Reported by Bradley Lowekamp: issue InsightSoftwareConsortium#2583 "Explicit instantiation of itk::Image fails with 5.2 when pixel type does not support operator==" This commit fixes the issue by defining the `operator==` and `operator!=` friend functions of `itk::Image` as function _templates_, rather than as non-templates.
The ability to instantiate `itk::Image<TPixel, VImageDimension>` for a non-EqualityComparable pixel type was broken by: "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d Reported by Bradley Lowekamp: issue InsightSoftwareConsortium#2583 "Explicit instantiation of itk::Image fails with 5.2 when pixel type does not support operator==" This commit fixes the issue by defining the `operator==` and `operator!=` friend functions of `itk::Image` as function _templates_, rather than as non-templates.
The ability to instantiate `itk::Image<TPixel, VImageDimension>` for a non-EqualityComparable pixel type was broken by: "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d Reported by Bradley Lowekamp: issue InsightSoftwareConsortium#2583 "Explicit instantiation of itk::Image fails with 5.2 when pixel type does not support operator==" This commit fixes the issue by defining the `operator==` and `operator!=` friend functions of `itk::Image` as function _templates_, rather than as non-templates.
The ability to instantiate `itk::Image<TPixel, VImageDimension>` for a non-EqualityComparable pixel type was broken by: "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d Reported by Bradley Lowekamp: issue InsightSoftwareConsortium#2583 "Explicit instantiation of itk::Image fails with 5.2 when pixel type does not support operator==" This commit fixes the issue by defining the `operator==` and `operator!=` friend functions of `itk::Image` as function _templates_, rather than as non-templates.
The ability to instantiate `itk::Image<TPixel, VImageDimension>` for a non-EqualityComparable pixel type was broken by: "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d Reported by Bradley Lowekamp: issue InsightSoftwareConsortium#2583 "Explicit instantiation of itk::Image fails with 5.2 when pixel type does not support operator==" This commit fixes the issue by defining the `operator==` and `operator!=` friend functions of `itk::Image` as function _templates_, rather than as non-templates.
The ability to instantiate `itk::Image<TPixel, VImageDimension>` for a non-EqualityComparable pixel type was broken by: "ENH: Add operator== and operator!= to itk::Image" pull request #2188 commit 7f3337d Reported by Bradley Lowekamp: issue #2583 "Explicit instantiation of itk::Image fails with 5.2 when pixel type does not support operator==" This commit fixes the issue by defining the `operator==` and `operator!=` friend functions of `itk::Image` as function _templates_, rather than as non-templates.
Added
operator==andoperator!=overloads which tell whether or nottwo images are equal, based on their value semantics (not just their
addresses in memory).
Allowed testing if two images (not just image pointers) compare equal or
unequal by using GoogleTest
EXPECT_EQ(image1, image2)andEXPECT_NE(image1, image2).