From 74898311b9487fb4dee0277a175766a083648522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 15 Jul 2016 11:53:37 -0400 Subject: [PATCH 01/95] DOC: Adding license --- Modules/Filtering/RLEImage/LICENSE | 201 +++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 Modules/Filtering/RLEImage/LICENSE diff --git a/Modules/Filtering/RLEImage/LICENSE b/Modules/Filtering/RLEImage/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/Modules/Filtering/RLEImage/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From c1bab93a63704d231ebfecd1182ef8122d9f4c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 15 Jul 2016 11:54:48 -0400 Subject: [PATCH 02/95] ENH: Initial import (copy from ITK-SNAP) --- Modules/Filtering/RLEImage/include/RLEImage.h | 283 ++++++++++ .../Filtering/RLEImage/include/RLEImage.txx | 260 +++++++++ .../RLEImage/include/RLEImageConstIterator.h | 440 +++++++++++++++ .../RLEImage/include/RLEImageIterator.h | 161 ++++++ .../include/RLEImageRegionConstIterator.h | 232 ++++++++ .../RLEImage/include/RLEImageRegionIterator.h | 144 +++++ .../include/RLEImageScanlineConstIterator.h | 155 +++++ .../include/RLEImageScanlineIterator.h | 86 +++ .../include/RLERegionOfInterestImageFilter.h | 293 ++++++++++ .../RLERegionOfInterestImageFilter.txx | 531 ++++++++++++++++++ 10 files changed, 2585 insertions(+) create mode 100644 Modules/Filtering/RLEImage/include/RLEImage.h create mode 100644 Modules/Filtering/RLEImage/include/RLEImage.txx create mode 100644 Modules/Filtering/RLEImage/include/RLEImageConstIterator.h create mode 100644 Modules/Filtering/RLEImage/include/RLEImageIterator.h create mode 100644 Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h create mode 100644 Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h create mode 100644 Modules/Filtering/RLEImage/include/RLEImageScanlineConstIterator.h create mode 100644 Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h create mode 100644 Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h create mode 100644 Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.txx diff --git a/Modules/Filtering/RLEImage/include/RLEImage.h b/Modules/Filtering/RLEImage/include/RLEImage.h new file mode 100644 index 00000000000..32f30db30e6 --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLEImage.h @@ -0,0 +1,283 @@ +#ifndef RLEImage_h +#define RLEImage_h + +#include //std::pair +#include +#include +#include + +/** Run-Length Encoded image. + * It saves memory for label images at the expense of processing times. + * Unsuitable for ordinary images (in which case it is counterproductive). + * + * BufferedRegion must include complete run-length lines (along X index axis). + * BufferedRegion can be smaller than LargestPossibleRegion along other axes. + * + * It is best if pixel type and counter type have the same byte size + * (for memory alignment purposes). + * + * Copied and adapted from itk::Image. + */ +template +class RLEImage : public itk::ImageBase +{ + +public: + /** Standard class typedefs */ + typedef RLEImage Self; + typedef itk::ImageBase Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + typedef itk::WeakPointer ConstWeakPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(RLEImage, ImageBase); + + /** Pixel typedef support. Used to declare pixel type in filters + * or other operations. */ + typedef TPixel PixelType; + + /** Typedef alias for PixelType */ + typedef TPixel ValueType; + + /** First element is count of repetitions, + * second element is the pixel value. */ + typedef std::pair RLSegment; + + /** A Run-Length encoded line of pixels. */ + typedef std::vector RLLine; + + /** Internal Pixel representation. Used to maintain a uniform API + * with Image Adaptors and allow to keep a particular internal + * representation of data while showing a different external + * representation. */ + typedef RLLine InternalPixelType; + + // typedef PixelType IOPixelType; + + /** Dimension of the image. This constant is used by functions that are + * templated over image type (as opposed to being templated over pixel type + * and dimension) when they need compile time access to the dimension of + * the image. */ + itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension); + + /** Index typedef support. An index is used to access pixel values. */ + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::IndexValueType IndexValueType; + + /** Offset typedef support. An offset is used to access pixel values. */ + typedef typename Superclass::OffsetType OffsetType; + + /** Size typedef support. A size is used to define region bounds. */ + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::SizeValueType SizeValueType; + + /** Direction typedef support. A matrix of direction cosines. */ + typedef typename Superclass::DirectionType DirectionType; + + /** Region typedef support. A region is used to specify a subset of an image. + */ + typedef typename Superclass::RegionType RegionType; + + /** Spacing typedef support. Spacing holds the size of a pixel. The + * spacing is the geometric distance between image samples. */ + typedef typename Superclass::SpacingType SpacingType; + typedef typename Superclass::SpacingValueType SpacingValueType; + + /** Origin typedef support. The origin is the geometric coordinates + * of the index (0,0). */ + typedef typename Superclass::PointType PointType; + + /** Offset typedef (relative position between indices) */ + typedef typename Superclass::OffsetValueType OffsetValueType; + + /** Allocate the image memory. The size of the image must + * already be set, e.g. by calling SetRegions(). + * Pixel values are initialized using default constructor. */ + virtual void + Allocate(bool initialize = false); + + /** Restore the data object to its initial state. This means releasing + * memory. */ + virtual void + Initialize() + { + // Call the superclass which should initialize the BufferedRegion ivar. + Superclass::Initialize(); + m_OnTheFlyCleanup = true; + myBuffer = BufferType::New(); + } + + /** Fill the image buffer with a value. Be sure to call Allocate() + * first. */ + void + FillBuffer(const TPixel & value); + + virtual void + SetLargestPossibleRegion(const RegionType & region) + { + Superclass::SetLargestPossibleRegion(region); + myBuffer->SetLargestPossibleRegion(truncateRegion(region)); + } + + virtual void + SetBufferedRegion(const RegionType & region) + { + Superclass::SetBufferedRegion(region); + myBuffer->SetBufferedRegion(truncateRegion(region)); + } + + virtual void + SetRequestedRegion(const RegionType & region) + { + Superclass::SetRequestedRegion(region); + myBuffer->SetRequestedRegion(truncateRegion(region)); + } + + /** \brief Set a pixel value. + * + * Allocate() needs to have been called first -- for efficiency, + * this function does not check that the image has actually been + * allocated yet. SLOW -> Use iterators instead. */ + void + SetPixel(const IndexType & index, const TPixel & value); + + /** Set a pixel value in the given line and updates segmentRemainder + * and realIndex to refer to the same pixel. + * Returns difference in line length which happens due to merging or splitting segments. + * This method is used by iterators directly. */ + int + SetPixel(RLLine & line, IndexValueType & segmentRemainder, IndexValueType & realIndex, const TPixel & value); + + /** \brief Get a pixel. SLOW! Better use iterators for pixel access. */ + const TPixel & + GetPixel(const IndexType & index) const; + + ///** Get a reference to a pixel. Chaning it changes the whole RLE segment! */ + // TPixel & GetPixel(const IndexType & index); + + ///** \brief Access a pixel. Chaning it changes the whole RLE segment! */ + // TPixel & operator[](const IndexType & index) + //{ + // return this->GetPixel(index); + // } + + /** \brief Access a pixel. This version can only be an rvalue. + * SLOW -> Use iterators instead. */ + const TPixel & + operator[](const IndexType & index) const + { + return this->GetPixel(index); + } + + virtual unsigned int + GetNumberOfComponentsPerPixel() const + { + // use the GetLength() method which works with variable length arrays, + // to make it work with as much pixel types as possible + PixelType p; + return itk::NumericTraits::GetLength(p); + } + + /** Typedef for the internally used buffer. */ + typedef typename itk::Image BufferType; + + /** We need to allow itk-style iterators to be constructed. */ + typename BufferType::Pointer + GetBuffer() + { + return myBuffer; + } + + /** We need to allow itk-style const iterators to be constructed. */ + typename BufferType::Pointer + GetBuffer() const + { + return myBuffer; + } + + /** Returns N-1-dimensional index, the remainder after 0-index is removed. */ + static inline typename BufferType::IndexType + truncateIndex(const IndexType & index); + + /** Returns N-1-dimensional size, the remainder after 0-size is removed. */ + static inline typename BufferType::SizeType + truncateSize(const SizeType & size); + + /** Returns N-1-dimensional region, the remainder after 0-index and size are removed. */ + static typename BufferType::RegionType + truncateRegion(const RegionType & region); + + /** Merges adjacent segments with duplicate values. + * Automatically called when turning on OnTheFlyCleanup. */ + void + CleanUp() const; + + /** Should same-valued segments be merged on the fly? + * On the fly merging usually provides better performance. */ + bool + GetOnTheFlyCleanup() const + { + return m_OnTheFlyCleanup; + } + + /** Should same-valued segments be merged on the fly? + * On the fly merging usually provides better performance. */ + void + SetOnTheFlyCleanup(bool value) + { + if (value == m_OnTheFlyCleanup) + return; + m_OnTheFlyCleanup = value; + if (m_OnTheFlyCleanup) + CleanUp(); // put the image into a clean state + } + + +protected: + RLEImage() + : itk::ImageBase() + { + m_OnTheFlyCleanup = true; + myBuffer = BufferType::New(); + } + void + PrintSelf(std::ostream & os, itk::Indent indent) const; + + virtual ~RLEImage() {} + + /** Compute helper matrices used to transform Index coordinates to + * PhysicalPoint coordinates and back. This method is virtual and will be + * overloaded in derived classes in order to provide backward compatibility + * behavior in classes that did not used to take image orientation into + * account. */ + virtual void + ComputeIndexToPhysicalPointMatrices() + { + this->Superclass::ComputeIndexToPhysicalPointMatrices(); + } + + /** Merges adjacent segments with duplicate values in a single line. */ + void + CleanUpLine(RLLine & line) const; + +private: + bool m_OnTheFlyCleanup; // should same-valued segments be merged on the fly + + RLEImage(const Self &); // purposely not implemented + void + operator=(const Self &); // purposely not implemented + + /** Memory for the current buffer. */ + mutable typename BufferType::Pointer myBuffer; +}; + + +#ifndef ITK_MANUAL_INSTANTIATION +# include "RLEImage.txx" +#endif + +#endif // RLEImage_h diff --git a/Modules/Filtering/RLEImage/include/RLEImage.txx b/Modules/Filtering/RLEImage/include/RLEImage.txx new file mode 100644 index 00000000000..80e1b7f9509 --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLEImage.txx @@ -0,0 +1,260 @@ +#ifndef RLEImage_txx +#define RLEImage_txx + +#include "RLEImage.h" +#include "itkImageRegionConstIterator.h" + +template +inline typename RLEImage::BufferType::IndexType +RLEImage::truncateIndex(const IndexType & index) +{ + typename BufferType::IndexType result; + for (IndexValueType i = 0; i < VImageDimension - 1; i++) + result[i] = index[i + 1]; + return result; +} + +template +inline typename RLEImage::BufferType::SizeType +RLEImage::truncateSize(const SizeType & size) +{ + typename BufferType::SizeType result; + for (IndexValueType i = 0; i < VImageDimension - 1; i++) + result[i] = size[i + 1]; + return result; +} + +template +typename RLEImage::BufferType::RegionType +RLEImage::truncateRegion(const RegionType & region) +{ + typename BufferType::RegionType result; + result.SetIndex(truncateIndex(region.GetIndex())); + result.SetSize(truncateSize(region.GetSize())); + return result; +} + +template +void +RLEImage::Allocate(bool initialize) +{ + itkAssertOrThrowMacro(this->GetBufferedRegion().GetSize(0) == this->GetLargestPossibleRegion().GetSize(0), + "BufferedRegion must contain complete run-length lines!"); + itkAssertOrThrowMacro(this->GetLargestPossibleRegion().GetSize(0) <= std::numeric_limits::max(), + "CounterType is not large enough to support image's X dimension!"); + this->ComputeOffsetTable(); + // SizeValueType num = static_cast(this->GetOffsetTable()[VImageDimension]); + myBuffer->Allocate(false); + // if (initialize) //there is assumption that the image is fully formed after a call to allocate + { + RLSegment segment(CounterType(this->GetBufferedRegion().GetSize(0)), TPixel()); + RLLine line(1); + line[0] = segment; + myBuffer->FillBuffer(line); + } +} + +template +void +RLEImage::FillBuffer(const TPixel & value) +{ + RLSegment segment(CounterType(this->GetBufferedRegion().GetSize(0)), value); + RLLine line(1); + line[0] = segment; + myBuffer->FillBuffer(line); +} + +template +void +RLEImage::CleanUpLine(RLLine & line) const +{ + CounterType x = 0; + RLLine out; + out.reserve(this->GetLargestPossibleRegion().GetSize(0)); + do + { + out.push_back(line[x]); + while (++x < line.size() && line[x].second == line[x - 1].second) + out.back().first += line[x].first; + } while (x < line.size()); + out.swap(line); +} + +template +void +RLEImage::CleanUp() const +{ + assert(!myBuffer.empty()); + if (this->GetLargestPossibleRegion().GetSize(0) == 0) + return; +#pragma omp parallel for + for (CounterType z = 0; z < myBuffer.size(); z++) + for (CounterType y = 0; y < myBuffer[0].size(); y++) + CleanUpLine(myBuffer[z][y]); +} + +template +int +RLEImage::SetPixel(RLLine & line, + IndexValueType & segmentRemainder, + IndexValueType & realIndex, + const TPixel & value) +{ + // complete Run-Length Lines have to be buffered + itkAssertOrThrowMacro(this->GetBufferedRegion().GetSize(0) == this->GetLargestPossibleRegion().GetSize(0), + "BufferedRegion must contain complete run-length lines!"); + if (line[realIndex].second == value) // already correct value + return 0; + else if (line[realIndex].first == 1) // single pixel segment + { + line[realIndex].second = value; + if (m_OnTheFlyCleanup) // now see if we can merge it into adjacent segments + { + if (realIndex > 0 && realIndex < line.size() - 1 && line[realIndex + 1].second == value && + line[realIndex - 1].second == value) + { + // merge these 3 segments + line[realIndex - 1].first += 1 + line[realIndex + 1].first; + segmentRemainder += line[realIndex + 1].first; + line.erase(line.begin() + realIndex, line.begin() + realIndex + 2); + realIndex--; + return -2; + } + if (realIndex > 0 && line[realIndex - 1].second == value) + { + // merge into previous + line[realIndex - 1].first++; + line.erase(line.begin() + realIndex); + realIndex--; + assert(segmentRemainder == 1); + return -1; + } + else if (realIndex < line.size() - 1 && line[realIndex + 1].second == value) + { + // merge into next + segmentRemainder = ++(line[realIndex + 1].first); + line.erase(line.begin() + realIndex); + return -1; + } + } + return 0; + } + else if (segmentRemainder == 1 && realIndex < line.size() - 1 && line[realIndex + 1].second == value) + { + // shift this pixel to next segment + line[realIndex].first--; + segmentRemainder = ++(line[realIndex + 1].first); + realIndex++; + return 0; + } + else if (realIndex > 0 && segmentRemainder == line[realIndex].first && line[realIndex - 1].second == value) + { + // shift this pixel to previous segment + line[realIndex].first--; + line[realIndex - 1].first++; + realIndex--; + segmentRemainder = 1; + return 0; + } + else if (segmentRemainder == 1) // insert after + { + line[realIndex].first--; + line.insert(line.begin() + realIndex + 1, RLSegment(1, value)); + realIndex++; + return +1; + } + else if (segmentRemainder == line[realIndex].first) // insert before + { + line[realIndex].first--; + line.insert(line.begin() + realIndex, RLSegment(1, value)); + segmentRemainder = 1; + return +1; + } + else // general case: split a segment into 3 segments + { + // first take care of values + line.insert(line.begin() + realIndex + 1, 2, RLSegment(1, value)); + line[realIndex + 2].second = line[realIndex].second; + + // now take care of counts + line[realIndex].first -= segmentRemainder; + line[realIndex + 2].first = segmentRemainder - 1; + realIndex++; + segmentRemainder = 1; + return +2; + } +} + +template +void +RLEImage::SetPixel(const IndexType & index, const TPixel & value) +{ + // complete Run-Length Lines have to be buffered + itkAssertOrThrowMacro(this->GetBufferedRegion().GetSize(0) == this->GetLargestPossibleRegion().GetSize(0), + "BufferedRegion must contain complete run-length lines!"); + IndexValueType bri0 = this->GetBufferedRegion().GetIndex(0); + typename BufferType::IndexType bi = truncateIndex(index); + RLLine & line = myBuffer->GetPixel(bi); + IndexValueType t = 0; + for (IndexValueType x = 0; x < line.size(); x++) + { + t += line[x].first; + if (t > index[0] - bri0) + { + t -= index[0] - bri0; // we need to supply a reference + SetPixel(line, t, x, value); + return; + } + } + throw itk::ExceptionObject(__FILE__, __LINE__, "Reached past the end of Run-Length line!", __FUNCTION__); +} + +template +const TPixel & +RLEImage::GetPixel(const IndexType & index) const +{ + // complete Run-Length Lines have to be buffered + itkAssertOrThrowMacro(this->GetBufferedRegion().GetSize(0) == this->GetLargestPossibleRegion().GetSize(0), + "BufferedRegion must contain complete run-length lines!"); + IndexValueType bri0 = this->GetBufferedRegion().GetIndex(0); + typename BufferType::IndexType bi = truncateIndex(index); + RLLine & line = myBuffer->GetPixel(bi); + IndexValueType t = 0; + for (IndexValueType x = 0; x < line.size(); x++) + { + t += line[x].first; + if (t > index[0] - bri0) + return line[x].second; + } + throw itk::ExceptionObject(__FILE__, __LINE__, "Reached past the end of Run-Length line!", __FUNCTION__); +} + +template +void +RLEImage::PrintSelf(std::ostream & os, itk::Indent indent) const +{ + Superclass::PrintSelf(os, indent); + os << indent << "Internal image (for storage of RLLine-s): " << std::endl; + myBuffer->Print(os, indent.GetNextIndent()); + + itk::SizeValueType c = 0; + itk::ImageRegionConstIterator it(myBuffer, myBuffer->GetBufferedRegion()); + while (!it.IsAtEnd()) + { + c += it.Get().capacity(); + ++it; + } + + double cr = + double(c * (sizeof(PixelType) + sizeof(CounterType)) + + sizeof(std::vector) * this->GetOffsetTable()[VImageDimension] / this->GetOffsetTable()[1]) / + (this->GetOffsetTable()[VImageDimension] * sizeof(PixelType)); + + os << indent << "OnTheFlyCleanup: " << (m_OnTheFlyCleanup ? "On" : "Off") << std::endl; + os << indent << "RLEImage compressed pixel count: " << c << std::endl; + int prec = os.precision(3); + os << indent << "Compressed size in relation to original size: " << cr * 100 << "%" << std::endl; + os.precision(prec); +} + +#endif // RLEImage_txx diff --git a/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h new file mode 100644 index 00000000000..49ad4d261a1 --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h @@ -0,0 +1,440 @@ +#ifndef RLEImageConstIterator_h +#define RLEImageConstIterator_h + +#include "itkImage.h" +#include "itkIndex.h" +#include "itkNumericTraits.h" +#include "RLEImage.h" +#include "itkImageConstIterator.h" +#include "itkImageConstIteratorWithIndex.h" +#include "itkImageConstIteratorWithOnlyIndex.h" +#include "itkImageRegionIterator.h" + +class MultiLabelMeshPipeline; + +namespace itk +{ +/** \class ImageConstIterator + * \brief A multi-dimensional image iterator templated over image type. + */ + +template +class ImageConstIterator> +{ + friend class ::MultiLabelMeshPipeline; + +public: + /** Standard class typedefs. */ + typedef ImageConstIterator Self; + + /** Dimension of the image the iterator walks. This constant is needed so + * functions that are templated over image iterator type (as opposed to + * being templated over pixel type and dimension) can have compile time + * access to the dimension of the image that the iterator walks. */ + itkStaticConstMacro(ImageIteratorDimension, unsigned int, VImageDimension); + + /** Run-time type information (and related methods). */ + itkTypeMacroNoParent(ImageConstIterator); + + /** Image typedef support. */ + typedef RLEImage ImageType; + + /** Run-Length Line (we iterate along it). */ + typedef typename ImageType::RLLine RLLine; + + /** Buffer Type used. */ + typedef typename ImageType::BufferType BufferType; + + /** Type for the internal buffer iterator. */ + typedef ImageRegionIterator BufferIterator; + + /** Index typedef support. */ + typedef typename ImageType::IndexType IndexType; + + /** Index typedef support. */ + typedef typename ImageType::IndexValueType IndexValueType; + + /** Size typedef support. */ + typedef typename ImageType::SizeType SizeType; + + /** Offset typedef support. */ + typedef typename ImageType::OffsetType OffsetType; + + /** Region typedef support. */ + typedef typename ImageType::RegionType RegionType; + + /** Internal Pixel Type */ + typedef typename ImageType::InternalPixelType InternalPixelType; + + /** External Pixel Type */ + typedef typename ImageType::PixelType PixelType; + + /** Default Constructor. Need to provide a default constructor since we + * provide a copy constructor. */ + ImageConstIterator() + : myBuffer(0) + , rlLine(0) + { + m_Image = ITK_NULLPTR; + m_Index0 = 0; + m_BeginIndex0 = 0; + m_EndIndex0 = 0; + realIndex = 0; + segmentRemainder = 0; + } + + /** Default Destructor. */ + virtual ~ImageConstIterator() {} + + /** Copy Constructor. The copy constructor is provided to make sure the + * handle to the image is properly reference counted. */ + ImageConstIterator(const Self & it) + : myBuffer(const_cast(it.GetImage())->GetBuffer()) + { + rlLine = it.rlLine; + m_Image = it.m_Image; // copy the smart pointer + m_Index0 = it.m_Index0; + this->bi = it.bi; + + realIndex = it.realIndex; + segmentRemainder = it.segmentRemainder; + m_BeginIndex0 = it.m_BeginIndex0; + m_EndIndex0 = it.m_EndIndex0; + } + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageConstIterator(const ImageType * ptr, const RegionType & region) + : myBuffer(const_cast(ptr)->GetBuffer()) + { + m_Image = ptr; + SetRegion(region); + } + + /** operator= is provided to make sure the handle to the image is properly + * reference counted. */ + Self & + operator=(const Self & it) + { + if (this != &it) + { + myBuffer = it.myBuffer; + rlLine = it.rlLine; + m_Image = it.m_Image; // copy the smart pointer + m_Index0 = it.m_Index0; + bi = it.bi; + + realIndex = it.realIndex; + segmentRemainder = it.segmentRemainder; + m_BeginIndex0 = it.m_BeginIndex0; + m_EndIndex0 = it.m_EndIndex0; + } + return *this; + } + + /** Set the region of the image to iterate over. */ + virtual void + SetRegion(const RegionType & region) + { + // m_Region = region; + + if (region.GetNumberOfPixels() > 0) // If region is non-empty + { + const RegionType & bufferedRegion = m_Image->GetBufferedRegion(); + itkAssertOrThrowMacro((bufferedRegion.IsInside(region)), + "Region " << region << " is outside of buffered region " << bufferedRegion); + } + + bi = BufferIterator(myBuffer, ImageType::truncateRegion(region)); + m_Index0 = region.GetIndex(0); + m_BeginIndex0 = m_Index0 - m_Image->GetBufferedRegion().GetIndex(0); + m_EndIndex0 = m_BeginIndex0 + region.GetSize(0); + SetIndexInternal(m_BeginIndex0); // sets realIndex and segmentRemainder + } + + /** Get the dimension (size) of the index. */ + static unsigned int + GetImageIteratorDimension() + { + return VImageDimension; + } + + /** Comparison operator. Two iterators are the same if they "point to" the + * same memory location */ + bool + operator!=(const Self & it) const + { + return bi != it.bi || m_Index0 + m_BeginIndex0 != it.m_Index0 + it.m_BeginIndex0; + } + + /** Comparison operator. Two iterators are the same if they "point to" the + * same memory location */ + bool + operator==(const Self & it) const + { + return bi == it.bi && m_Index0 + m_BeginIndex0 == it.m_Index0 + it.m_BeginIndex0; + } + + /** Comparison operator. An iterator is "less than" another if it "points to" + * a lower memory location. */ + bool + operator<=(const Self & it) const + { + if (bi < it.bi) + return true; + else if (bi > it.bi) + return false; + return m_Index0 + m_BeginIndex0 <= it.m_Index0 + it.m_BeginIndex0; + } + + /** Comparison operator. An iterator is "less than" another if it "points to" + * a lower memory location. */ + bool + operator<(const Self & it) const + { + if (bi < it.bi) + return true; + else if (bi > it.bi) + return false; + return m_Index0 + m_BeginIndex0 < it.m_Index0 + it.m_BeginIndex0; + } + + /** Comparison operator. An iterator is "greater than" another if it + * "points to" a higher location. */ + bool + operator>=(const Self & it) const + { + if (bi > it.bi) + return true; + else if (bi < it.bi) + return false; + return m_Index0 + m_BeginIndex0 >= it.m_Index0 + it.m_BeginIndex0; + } + + /** Comparison operator. An iterator is "greater than" another if it + * "points to" a higher location. */ + bool + operator>(const Self & it) const + { + if (bi > it.bi) + return true; + else if (bi < it.bi) + return false; + return m_Index0 + m_BeginIndex0 > it.m_Index0 + it.m_BeginIndex0; + } + + /** Get the index. This provides a read only copy of the index. */ + const IndexType + GetIndex() const + { + IndexType indR(m_Image->GetBufferedRegion().GetIndex()); + indR[0] += m_Index0; + typename BufferType::IndexType bufInd = bi.GetIndex(); + for (IndexValueType i = 1; i < VImageDimension; i++) + indR[i] = bufInd[i - 1]; + return indR; + } + + /** Sets the image index. No bounds checking is performed. */ + virtual void + SetIndex(const IndexType & ind) + { + typename BufferType::IndexType bufInd; + for (IndexValueType i = 1; i < VImageDimension; i++) + bufInd[i - 1] = ind[i]; + bi.SetIndex(bufInd); + SetIndexInternal(ind[0] - m_Image->GetBufferedRegion().GetIndex(0)); + } + + /** Get the region that this iterator walks. ImageConstIterators know the + * beginning and the end of the region of the image to iterate over. */ + const RegionType + GetRegion() const + { + RegionType r; + r.SetIndex(0, m_BeginIndex0 + m_Image->GetBufferedRegion().GetIndex(0)); + r.SetSize(0, m_EndIndex0 - m_BeginIndex0); + typename BufferType::RegionType ir = bi.GetRegion(); + for (IndexValueType i = 1; i < VImageDimension; i++) + { + r.SetIndex(i, ir.GetIndex(i - 1)); + r.SetSize(i, ir.GetSize(i - 1)); + } + return r; + } + + /** Get the image that this iterator walks. */ + const ImageType * + GetImage() const + { + return m_Image.GetPointer(); + } + + /** Get the pixel value */ + PixelType + Get(void) const + { + return Value(); + } + + /** Return a const reference to the pixel + * This method will provide the fastest access to pixel + * data, but it will NOT support ImageAdaptors. */ + const PixelType & + Value(void) const + { + RLLine & line = const_cast(this)->bi.Value(); + return line[realIndex].second; + } + + /** Move an iterator to the beginning of the region. "Begin" is + * defined as the first pixel in the region. */ + void + GoToBegin() + { + bi.GoToBegin(); + SetIndexInternal(m_BeginIndex0); + } + + /** Move an iterator to the end of the region. "End" is defined as + * one pixel past the last pixel of the region. */ + void + GoToEnd() + { + bi.GoToEnd(); + m_Index0 = m_BeginIndex0; + } + + /** Is the iterator at the beginning of the region? "Begin" is defined + * as the first pixel in the region. */ + bool + IsAtBegin(void) const + { + return m_Index0 == m_BeginIndex0 && bi.IsAtBegin(); + } + + /** Is the iterator at the end of the region? "End" is defined as one + * pixel past the last pixel of the region. */ + bool + IsAtEnd(void) const + { + return m_Index0 == m_BeginIndex0 && bi.IsAtEnd(); + } + +protected: // made protected so other iterators can access + /** Set the internal index, realIndex and segmentRemainder. */ + virtual void + SetIndexInternal(const IndexValueType ind0) + { + m_Index0 = ind0; + rlLine = &bi.Value(); + + CounterType t = 0; + SizeValueType x = 0; + + for (; x < (*rlLine).size(); x++) + { + t += (*rlLine)[x].first; + if (t > m_Index0) + break; + } + realIndex = x; + segmentRemainder = t - m_Index0; + } + + typename ImageType::ConstWeakPointer m_Image; + + IndexValueType m_Index0; // index into the RLLine + + const RLLine * rlLine; + + mutable IndexValueType realIndex; // index into line's segment + mutable IndexValueType segmentRemainder; // how many pixels remain in current segment + + IndexValueType m_BeginIndex0; // index to first pixel in region in relation to buffer start + IndexValueType m_EndIndex0; // index to one pixel past last pixel in region in relation to buffer start + + BufferIterator bi; // iterator over internal buffer image + typename BufferType::Pointer myBuffer; +}; + +template +class ImageConstIteratorWithIndex> + : public ImageConstIterator> +{ + // just inherit constructors +public: + /** Image typedef support. */ + typedef RLEImage ImageType; + + typedef typename itk::ImageConstIterator>::RegionType RegionType; + + void + GoToReverseBegin() + { + this->bi.GoToReverseBegin(); + this->m_Index0 = this->m_EndIndex0 - 1; + SetIndexInternal(this->m_Index0); + } + + bool + IsAtReverseEnd() + { + return this->bi.IsAtReverseEnd(); + } + + /** Default Constructor. Need to provide a default constructor since we + * provide a copy constructor. */ + ImageConstIteratorWithIndex() + : ImageConstIterator() + {} + + /** Copy Constructor. The copy constructor is provided to make sure the + * handle to the image is properly reference counted. */ + ImageConstIteratorWithIndex(const ImageConstIteratorWithIndex & it) + { + this->ImageConstIterator::operator=(it); + } + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageConstIteratorWithIndex(const ImageType * ptr, const RegionType & region) + : ImageConstIterator(ptr, region) + {} +}; // no additional implementation required + +template +class ImageConstIteratorWithOnlyIndex> + : public ImageConstIteratorWithIndex> +{ + // just inherit constructors +public: + /** Image typedef support. */ + typedef RLEImage ImageType; + + typedef typename itk::ImageConstIterator>::RegionType RegionType; + + /** Default Constructor. Need to provide a default constructor since we + * provide a copy constructor. */ + ImageConstIteratorWithOnlyIndex() + : ImageConstIterator() + {} + + + /** Copy Constructor. The copy constructor is provided to make sure the + * handle to the image is properly reference counted. */ + ImageConstIteratorWithOnlyIndex(const ImageConstIteratorWithOnlyIndex & it) + { + this->ImageConstIterator::operator=(it); + } + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageConstIteratorWithOnlyIndex(const ImageType * ptr, const RegionType & region) + : ImageConstIterator(ptr, region) + {} +}; // no additional implementation required + +} // end namespace itk + +#endif // RLEImageConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/RLEImageIterator.h b/Modules/Filtering/RLEImage/include/RLEImageIterator.h new file mode 100644 index 00000000000..d7d60026237 --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLEImageIterator.h @@ -0,0 +1,161 @@ +#ifndef RLEImageIterator_h +#define RLEImageIterator_h + +#include "RLEImageConstIterator.h" +#include "itkImageIteratorWithIndex.h" + +namespace itk +{ +/** + * \class ImageIterator + * \brief A multi-dimensional iterator templated over image type. + * + * This is a base class of ImageConstIterator that adds write-access + * functionality. Please see ImageConstIterator for more information. + * + */ + +template +class ImageIterator> + : public ImageConstIterator> +{ +public: + /** Standard class typedefs. */ + typedef ImageIterator Self; + + /** Dimension of the image the iterator walks. This constant is needed so + * functions that are templated over image iterator type (as opposed to + * being templated over pixel type and dimension) can have compile time + * access to the dimension of the image that the iterator walks. */ + itkStaticConstMacro(ImageIteratorDimension, unsigned int, VImageDimension); + + /** Define the superclass */ + typedef ImageConstIterator> Superclass; + + /** Inherit types from the superclass */ + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::OffsetType OffsetType; + typedef typename Superclass::RegionType RegionType; + typedef typename Superclass::ImageType ImageType; + typedef typename Superclass::InternalPixelType InternalPixelType; + typedef typename Superclass::PixelType PixelType; + + /** Default Constructor. Need to provide a default constructor since we + * provide a copy constructor. */ + ImageIterator() {} + + /** Default Destructor */ + ~ImageIterator() {} + + /** Copy Constructor. The copy constructor is provided to make sure the + * handle to the image is properly reference counted. */ + ImageIterator(const Self & it) + : ImageConstIterator(it) + {} + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageIterator(ImageType * ptr, const RegionType & region) + : ImageConstIterator(ptr, region) + {} + + /** operator= is provided to make sure the handle to the image is properly + * reference counted. */ + Self & + operator=(const Self & it) + { + this->ImageConstIterator::operator=(it); + return *this; + } + + /** Set the pixel value. + * Changing the RLE structure invalidates all other iterators (except this one). */ + void + Set(const PixelType & value) const + { + const_cast(this->m_Image.GetPointer()) + ->SetPixel( + *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + } + + ///** Return a reference to the pixel + // * Setting this value would change value of the whole run-length segment. + // * If we wanted to safely enable it, + // * we would isolate this pixel into its own segment. */ + // PixelType & Value(void) + //{ + // return myBuffer[m_Index[2]][m_Index[1]][realIndex].second; + //} + + /** Get the image that this iterator walks. */ + ImageType * + GetImage() const + { + // const_cast is needed here because m_Image is declared as a const pointer + // in the base class which is the ConstIterator. + return const_cast(this->m_Image.GetPointer()); + } + +protected: + /** This constructor is declared protected in order to enforce + const-correctness */ + ImageIterator(const ImageConstIterator & it) + : ImageConstIterator(it) + {} + Self & + operator=(const ImageConstIterator & it) + { + this->ImageConstIterator::operator=(it); + return *this; + } +}; + +template +class ImageIteratorWithIndex> + : public ImageConstIteratorWithIndex> +{ +public: + typedef RLEImage ImageType; + + typedef typename itk::ImageConstIterator>::RegionType RegionType; + + /** Default Constructor. Need to provide a default constructor since we + * provide a copy constructor. */ + ImageIteratorWithIndex() + : ImageConstIteratorWithIndex() + {} + + + /** Copy Constructor. The copy constructor is provided to make sure the + * handle to the image is properly reference counted. */ + ImageIteratorWithIndex(const ImageIteratorWithIndex & it) { this->ImageIterator::operator=(it); } + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageIteratorWithIndex(const ImageType * ptr, const RegionType & region) + : ImageConstIteratorWithIndex(ptr, region) + {} + + /** Set the pixel value. + * Changing the RLE structure invalidates all other iterators (except this one). */ + void + Set(const TPixel & value) const + { + const_cast(this->m_Image.GetPointer()) + ->SetPixel( + *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + } + + /** Get the image that this iterator walks. */ + ImageType * + GetImage() const + { + // const_cast is needed here because m_Image is declared as a const pointer + // in the base class which is the ConstIterator. + return const_cast(this->m_Image.GetPointer()); + } +}; // no additional implementation required +} // end namespace itk + +#endif // RLEImageIterator_h diff --git a/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h new file mode 100644 index 00000000000..88951b7f386 --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h @@ -0,0 +1,232 @@ +#ifndef RLEImageRegionConstIterator_h +#define RLEImageRegionConstIterator_h + +#include "RLEImageConstIterator.h" +#include "itkImageRegionConstIterator.h" +#include "itkImageRegionConstIteratorWithIndex.h" +#include "itkImageRegionConstIteratorWithOnlyIndex.h" + +class MultiLabelMeshPipeline; + +namespace itk +{ +/** \class ImageRegionConstIterator + * \brief A multi-dimensional iterator templated over image type that walks a + * region of pixels. + * + * ImageRegionConstIterator provides read-only access to image data. It is the + * base class for the read/write access ImageRegionIterator. + * + */ +template +class ImageRegionConstIterator> + : public ImageConstIterator> +{ + friend class ::MultiLabelMeshPipeline; + +public: + /** Standard class typedef. */ + typedef ImageRegionConstIterator> Self; + typedef ImageConstIterator> Superclass; + + /** Dimension of the image that the iterator walks. This constant is needed so + * functions that are templated over image iterator type (as opposed to + * being templated over pixel type and dimension) can have compile time + * access to the dimension of the image that the iterator walks. */ + itkStaticConstMacro(ImageIteratorDimension, unsigned int, VImageDimension); + + /** + * Index typedef support. While these were already typdef'ed in the superclass, + * they need to be redone here for this subclass to compile properly with gcc. + */ + /** Types inherited from the Superclass */ + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::OffsetType OffsetType; + typedef typename Superclass::RegionType RegionType; + typedef typename Superclass::ImageType ImageType; + typedef typename Superclass::InternalPixelType InternalPixelType; + typedef typename Superclass::PixelType PixelType; + + /** Run-time type information (and related methods). */ + itkTypeMacro(ImageRegionConstIterator, ImageConstIterator); + + /** Default constructor. Needed since we provide a cast constructor. */ + ImageRegionConstIterator() + : ImageConstIterator() + {} + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageRegionConstIterator(const ImageType * ptr, const RegionType & region) + : ImageConstIterator(ptr, region) + {} + + /** Constructor that can be used to cast from an ImageIterator to an + * ImageRegionConstIterator. Many routines return an ImageIterator, but for a + * particular task, you may want an ImageRegionConstIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageRegionConstIterator. */ + ImageRegionConstIterator(const ImageIterator & it) + { + this->ImageConstIterator::operator=(it); + // this->ImageConstIterator< ImageType >::operator=(static_cast >(it)); + } + + /** Constructor that can be used to cast from an ImageConstIterator to an + * ImageRegionConstIterator. Many routines return an ImageIterator, but for a + * particular task, you may want an ImageRegionConstIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageRegionConstIterator. */ + ImageRegionConstIterator(const ImageConstIterator & it) + { + this->ImageConstIterator::operator=(it); + } + + /** Increment (prefix) the fastest moving dimension of the iterator's index. + * This operator will constrain the iterator within the region (i.e. the + * iterator will automatically wrap from the end of the row of the region + * to the beginning of the next row of the region) up until the iterator + * tries to moves past the last pixel of the region. Here, the iterator + * will be set to be one pixel past the end of the region. + * \sa operator++(int) */ + Self & + operator++() + { + this->m_Index0++; + + if (this->m_Index0 >= this->m_EndIndex0) + { + ++(this->bi); + if (!this->bi.IsAtEnd()) + this->SetIndexInternal(this->m_BeginIndex0); + else + this->m_Index0 = this->m_BeginIndex0; + return *this; + } + + this->segmentRemainder--; + if (this->segmentRemainder > 0) + return *this; + + this->realIndex++; + this->segmentRemainder = (*this->rlLine)[this->realIndex].first; + return *this; + } + + /** Decrement (prefix) the fastest moving dimension of the iterator's index. + * This operator will constrain the iterator within the region (i.e. the + * iterator will automatically wrap from the beginning of the row of the region + * to the end of the next row of the region) up until the iterator + * tries to moves past the first pixel of the region. Here, the iterator + * will be set to be one pixel past the beginning of the region. + * \sa operator--(int) */ + Self & + operator--() + { + this->m_Index0--; + + if (this->m_Index0 < this->m_BeginIndex0) + { + --(this->bi); + this->SetIndexInternal(this->m_EndIndex0 - 1); + return *this; + } + + this->segmentRemainder++; + if (this->segmentRemainder <= (*this->rlLine)[this->realIndex].first) + return *this; + + this->realIndex--; + this->segmentRemainder = 1; + return *this; + } +}; + +template +class ImageRegionConstIteratorWithIndex> + : public ImageRegionConstIterator> +{ +public: + typedef RLEImage ImageType; + + typedef typename itk::ImageConstIterator>::RegionType RegionType; + + /** Default constructor. Needed since we provide a cast constructor. */ + ImageRegionConstIteratorWithIndex() + : ImageRegionConstIterator() + {} + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageRegionConstIteratorWithIndex(const ImageType * ptr, const RegionType & region) + : ImageRegionConstIterator(ptr, region) + {} + + void + GoToReverseBegin() + { + this->bi.GoToEnd(); // after last pixel + --(this->bi); // go to last valid pixel + this->m_Index0 = this->m_EndIndex0 - 1; + this->SetIndexInternal(this->m_Index0); // valid index required + } + + bool + IsAtReverseEnd() + { + return (this->m_Index0 == this->m_BeginIndex0) && this->bi.IsAtBegin(); + } + + /** Constructor that can be used to cast from an ImageIterator to an + * ImageRegionConstIterator. Many routines return an ImageIterator, but for a + * particular task, you may want an ImageRegionConstIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageRegionConstIterator. */ + ImageRegionConstIteratorWithIndex(const ImageIterator & it) + { + this->ImageRegionConstIterator::operator=(it); + } + +}; // no additional implementation required + +template +class ImageRegionConstIteratorWithOnlyIndex> + : public ImageRegionConstIteratorWithIndex> +{ + // just inherit constructors +public: + typedef RLEImage ImageType; + + typedef typename itk::ImageConstIterator>::RegionType RegionType; + + /** Default constructor. Needed since we provide a cast constructor. */ + ImageRegionConstIteratorWithOnlyIndex() + : ImageRegionConstIterator() + {} + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageRegionConstIteratorWithOnlyIndex(const ImageType * ptr, const RegionType & region) + : ImageRegionConstIteratorWithIndex(ptr, region) + {} + + /** Constructor that can be used to cast from an ImageIterator to an + * ImageRegionConstIterator. Many routines return an ImageIterator, but for a + * particular task, you may want an ImageRegionConstIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageRegionConstIterator. */ + ImageRegionConstIteratorWithOnlyIndex(const ImageIterator & it) + { + this->ImageRegionConstIterator::operator=(it); + } + +}; // no additional implementation required + +} // end namespace itk + +#endif // RLEImageRegionConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h new file mode 100644 index 00000000000..4280e5df047 --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h @@ -0,0 +1,144 @@ +#ifndef RLEImageRegionIterator_h +#define RLEImageRegionIterator_h + +#include "RLEImageRegionConstIterator.h" +#include "itkImageRegionIterator.h" +#include "itkImageRegionIteratorWithIndex.h" +#include "RLEImageIterator.h" + +namespace itk +{ +/** \class ImageRegionIterator + * \brief A multi-dimensional iterator templated over image type that walks a + * region of pixels. + * + * The itk::ImageRegionIterator is optimized for iteration speed and is the + * first choice for iterative, pixel-wise operations on an image. + * ImageRegionIterator is the least specialized of the ITK image iterator + * classes. ImageRegionIterator is templated over the image type, and is + * constrained to walk only within the specified region and along a line + * parallel to one of the coordinate axes, "wrapping" to the next line as it + * reaches the boundary of the image. To walk the entire image, specify the + * region to be \c image->GetRequestedRegion(). + * + * Most of the functionality is inherited from the ImageRegionConstIterator. + * The current class only adds write access to image pixels. + */ + +template +class ImageRegionIterator> + : public ImageRegionConstIterator> +{ +public: + /** Standard class typedefs. */ + typedef ImageRegionIterator Self; + typedef ImageRegionConstIterator> Superclass; + + /** Types inherited from the Superclass */ + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::OffsetType OffsetType; + typedef typename Superclass::RegionType RegionType; + typedef typename Superclass::ImageType ImageType; + typedef typename Superclass::InternalPixelType InternalPixelType; + typedef typename Superclass::PixelType PixelType; + + /** Default constructor. Needed since we provide a cast constructor. */ + ImageRegionIterator() + : ImageRegionConstIterator() + {} + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageRegionIterator(ImageType * ptr, const RegionType & region) + : ImageRegionConstIterator(ptr, region) + {} + + /** Constructor that can be used to cast from an ImageIterator to an + * ImageRegionIterator. Many routines return an ImageIterator but for a + * particular task, you may want an ImageRegionIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageRegionIterator. */ + ImageRegionIterator(const ImageIterator & it) { this->ImageConstIterator::operator=(it); } + + /** Set the pixel value. + * Changing the RLE structure invalidates all other iterators (except this one). */ + void + Set(const PixelType & value) const + { + const_cast(this->m_Image.GetPointer()) + ->SetPixel( + *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + } + +protected: + /** the construction from a const iterator is declared protected + in order to enforce const correctness. */ + ImageRegionIterator(const ImageRegionConstIterator & it) + { + this->ImageConstIterator::operator=(it); + } + Self & + operator=(const ImageRegionConstIterator & it) + { + this->ImageConstIterator::operator=(it); + } +}; + +template +class ImageRegionIteratorWithIndex> + : public ImageRegionConstIteratorWithIndex> +{ +public: + typedef RLEImage ImageType; + + typedef typename itk::ImageConstIterator>::RegionType RegionType; + + /** Default constructor. Needed since we provide a cast constructor. */ + ImageRegionIteratorWithIndex() + : ImageRegionConstIteratorWithIndex() + {} + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageRegionIteratorWithIndex(ImageType * ptr, const RegionType & region) + : ImageRegionConstIteratorWithIndex(ptr, region) + {} + + /** Set the pixel value. + * Changing the RLE structure invalidates all other iterators (except this one). */ + void + Set(const TPixel & value) const + { + const_cast(this->m_Image.GetPointer()) + ->SetPixel( + *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + } + + /** Constructor that can be used to cast from an ImageIterator to an + * ImageRegionIteratorWithIndex. Many routines return an ImageIterator, but for a + * particular task, you may want an ImageRegionConstIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageRegionConstIterator. */ + ImageRegionIteratorWithIndex(const ImageIterator & it) + { + this->ImageRegionConstIteratorWithIndex::operator=(it); + } + + /** Constructor that can be used to cast from an ImageConstIterator to an + * ImageRegionIteratorWithIndex. Many routines return an ImageIterator, but for a + * particular task, you may want an ImageRegionConstIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageRegionIteratorWithIndex. */ + ImageRegionIteratorWithIndex(const ImageConstIterator & it) + { + this->ImageRegionConstIterator::operator=(it); + } + +}; // no additional implementation required +} // end namespace itk + +#endif // RLEImageRegionIterator_h diff --git a/Modules/Filtering/RLEImage/include/RLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/RLEImageScanlineConstIterator.h new file mode 100644 index 00000000000..7bd59ec774f --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLEImageScanlineConstIterator.h @@ -0,0 +1,155 @@ +#ifndef RLEImageScanlineConstIterator_h +#define RLEImageScanlineConstIterator_h + +#include "RLEImageRegionConstIterator.h" +#include "itkImageScanlineIterator.h" + +namespace itk +{ +/** \class ImageScanlineConstIterator + * \brief A multi-dimensional iterator templated over image type that walks a + * region of pixels, scanline by scanline or in the direction of the + * fastest axis. + */ +template +class ImageScanlineConstIterator> + : public ImageRegionConstIterator> +{ +public: + /** Standard class typedef. */ + typedef ImageScanlineConstIterator Self; + typedef ImageRegionConstIterator> Superclass; + + /** Dimension of the image that the iterator walks. This constant is needed so + * functions that are templated over image iterator type (as opposed to + * being templated over pixel type and dimension) can have compile time + * access to the dimension of the image that the iterator walks. */ + itkStaticConstMacro(ImageIteratorDimension, unsigned int, VImageDimension); + + /** + * Index typedef support. While these were already typdef'ed in the superclass, + * they need to be redone here for this subclass to compile properly with gcc. + */ + /** Types inherited from the Superclass */ + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::OffsetType OffsetType; + typedef typename Superclass::RegionType RegionType; + typedef typename Superclass::ImageType ImageType; + typedef typename Superclass::InternalPixelType InternalPixelType; + typedef typename Superclass::PixelType PixelType; + + /** Run-time type information (and related methods). */ + itkTypeMacro(ImageScanlineConstIterator, ImageRegionConstIterator); + + /** Default constructor. Needed since we provide a cast constructor. */ + ImageScanlineConstIterator() + : ImageRegionConstIterator() + {} + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageScanlineConstIterator(const ImageType * ptr, const RegionType & region) + : ImageRegionConstIterator(ptr, region) + {} + + /** Constructor that can be used to cast from an ImageIterator to an + * ImageScanlineConstIterator. Many routines return an ImageIterator, but for a + * particular task, you may want an ImageScanlineConstIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageScanlineConstIterator. */ + ImageScanlineConstIterator(const ImageIterator & it) + : ImageRegionConstIterator(it) + {} + + /** Constructor that can be used to cast from an ImageConstIterator to an + * ImageScanlineConstIterator. Many routines return an ImageIterator, but for a + * particular task, you may want an ImageScanlineConstIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageScanlineConstIterator. */ + ImageScanlineConstIterator(const ImageConstIterator & it) + { + this->ImageRegionConstIterator::operator=(it); + } + + + /** Go to the beginning pixel of the current line. */ + void + GoToBeginOfLine(void) + { + this->m_Index0 = this->m_BeginIndex0; + this->realIndex = 0; + this->segmentRemainder = (*this->rlLine)[this->realIndex].first; + } + + /** Go to the past end pixel of the current line. */ + void + GoToEndOfLine(void) + { + this->m_Index0 = this->m_EndIndex0; + this->realIndex = this->rlLine->size() - 1; + this->segmentRemainder = 0; + } + + /** Test if the index is at the end of line. */ + inline bool + IsAtEndOfLine(void) + { + return this->m_Index0 == this->m_EndIndex0; + } + + /** Go to the next line. */ + inline void + NextLine(void) + { + ++(this->bi); + if (!this->bi.IsAtEnd()) + this->SetIndexInternal(this->m_BeginIndex0); + else + this->m_Index0 = this->m_BeginIndex0; // make this iterator at end too + } + + /** Increment (prefix) along the scanline. + * + * If the iterator is at the end of the scanline ( one past the last + * valid element in the row ), then the results are undefined. Which + * means is may assert in debug mode or result in an undefined + * iterator which may have unknown consequences if used. + */ + Self & + operator++() + { + itkAssertInDebugAndIgnoreInReleaseMacro(!this->IsAtEndOfLine()); + this->m_Index0++; + this->segmentRemainder--; + if (this->segmentRemainder > 0) + return *this; + + if (this->IsAtEndOfLine()) + return *this; + this->realIndex++; + this->segmentRemainder = (*this->rlLine)[this->realIndex].first; + return *this; + } + + /** Decrement (prefix) along the scanline. + * + */ + Self & + operator--() + { + this->m_Index0--; + this->segmentRemainder++; + if (this->segmentRemainder <= (*this->rlLine)[this->realIndex].first) + return *this; + + this->realIndex--; + this->segmentRemainder = 1; + return *this; + } +}; +} // end namespace itk + +#endif // RLEImageScanlineConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h new file mode 100644 index 00000000000..d0fabe33d38 --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h @@ -0,0 +1,86 @@ +#ifndef RLEImageScanlineIterator_h +#define RLEImageScanlineIterator_h + +#include "RLEImageScanlineConstIterator.h" +#include "RLEImageIterator.h" +#include "itkImageScanlineIterator.h" + +namespace itk +{ +/** \class ImageScanlineIterator + * \brief A multi-dimensional iterator templated over image type that walks a + * region of pixels, scanline by scanline or in the direction of the + * fastest axis. + */ +template +class ImageScanlineIterator> + : public ImageScanlineConstIterator> +{ +public: + /** Standard class typedefs. */ + typedef ImageScanlineIterator Self; + typedef ImageScanlineConstIterator> Superclass; + + /** Types inherited from the Superclass */ + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::OffsetType OffsetType; + typedef typename Superclass::RegionType RegionType; + typedef typename Superclass::ImageType ImageType; + typedef typename Superclass::InternalPixelType InternalPixelType; + typedef typename Superclass::PixelType PixelType; + + /** Default constructor. Needed since we provide a cast constructor. */ + ImageScanlineIterator() + : ImageScanlineConstIterator() + {} + + /** Constructor establishes an iterator to walk a particular image and a + * particular region of that image. */ + ImageScanlineIterator(ImageType * ptr, const RegionType & region) + : ImageScanlineConstIterator(ptr, region) + {} + + /** Constructor that can be used to cast from an ImageIterator to an + * ImageScanlineIterator. Many routines return an ImageIterator but for a + * particular task, you may want an ImageScanlineIterator. Rather than + * provide overloaded APIs that return different types of Iterators, itk + * returns ImageIterators and uses constructors to cast from an + * ImageIterator to a ImageScanlineIterator. */ + ImageScanlineIterator(const ImageIterator & it) + : ImageScanlineConstIterator(it) + {} + + /** Set the pixel value */ + void + Set(const PixelType & value) const + { + const_cast(this->m_Image.GetPointer()) + ->SetPixel( + *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + } + + ///** Return a reference to the pixel + //* This method will provide the fastest access to pixel + //* data, but it will NOT support ImageAdaptors. */ + // PixelType & Value(void) + //{ + // return myBuffer[m_Index[2]][m_Index[1]][realIndex].second; + //} + +protected: + /** the construction from a const iterator is declared protected + in order to enforce const correctness. */ + ImageScanlineIterator(const ImageScanlineConstIterator & it) + : ImageScanlineConstIterator(it) + {} + Self & + operator=(const ImageScanlineConstIterator & it) + { + this->ImageScanlineConstIterator::operator=(it); + return *this; + } +}; +} // end namespace itk + +#endif // RLEImageScanlineIterator_h diff --git a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h new file mode 100644 index 00000000000..5a4c6d12cf3 --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h @@ -0,0 +1,293 @@ +#ifndef RLERegionOfInterestImageFilter_h +#define RLERegionOfInterestImageFilter_h + +#include "itkImageToImageFilter.h" +#include "itkSmartPointer.h" +#include "itkRegionOfInterestImageFilter.h" +#include "RLEImage.h" + +namespace itk +{ +/** \class RegionOfInterestImageFilter + * \brief Extract a region of interest from the input image + * or convert between itk::Image and RLEImage (a custom region can be used). + * + * This filter produces an output image of the same dimension as the input + * image. The user specifies the region of the input image that will be + * contained in the output image. The origin coordinates of the output images + * will be computed in such a way that if mapped to physical space, the output + * image will overlay the input image with perfect registration. In other + * words, a registration process between the output image and the input image + * will return an identity transform. + * + * The region to extract is set using the method SetRegionOfInterest. + */ +template +class RegionOfInterestImageFilter, + RLEImage> + : public ImageToImageFilter, + RLEImage> +{ +public: + /** Standard class typedefs. */ + typedef RegionOfInterestImageFilter Self; + typedef RLEImage RLEImageType; + typedef RLEImageType ImageType; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + typedef typename Superclass::InputImageRegionType InputImageRegionType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(RegionOfInterestImageFilter, ImageToImageFilter); + + /** Typedef to describe the input image region types. */ + typedef typename RLEImageType::RegionType RegionType; + typedef typename RLEImageType::IndexType IndexType; + typedef typename RLEImageType::SizeType SizeType; + + /** Typedef to describe the type of pixel. */ + typedef typename RLEImageType::PixelType OutputImagePixelType; + typedef typename RLEImageType::PixelType InputImagePixelType; + + /** Set/Get the output image region. */ + itkSetMacro(RegionOfInterest, RegionType); + itkGetConstMacro(RegionOfInterest, RegionType); + + /** ImageDimension enumeration */ + itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, VImageDimension); + +#ifdef ITK_USE_CONCEPT_CHECKING + // Begin concept checking + itkConceptMacro(SameDimensionCheck, (Concept::SameDimension)); + itkConceptMacro(InputConvertibleToOutputCheck, (Concept::Convertible)); + // End concept checking +#endif + +protected: + RegionOfInterestImageFilter() {} + ~RegionOfInterestImageFilter() {} + void + PrintSelf(std::ostream & os, Indent indent) const; + + virtual void + GenerateInputRequestedRegion(); + + virtual void + EnlargeOutputRequestedRegion(DataObject * output); + + /** RegionOfInterestImageFilter can produce an image which is a different + * size than its input image. As such, RegionOfInterestImageFilter + * needs to provide an implementation for + * GenerateOutputInformation() in order to inform the pipeline + * execution model. The original documentation of this method is + * below. + * + * \sa ProcessObject::GenerateOutputInformaton() */ + virtual void + GenerateOutputInformation(); + + /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. + * Therefore, this implementation provides a ThreadedGenerateData() + * routine which is called for each processing thread. The output + * image data is allocated automatically by the superclass prior to + * calling ThreadedGenerateData(). ThreadedGenerateData can only + * write to the portion of the output image specified by the + * parameter "outputRegionForThread" + * \sa ImageToImageFilter::ThreadedGenerateData(), + * ImageToImageFilter::GenerateData() */ + void + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId); + +private: + RegionOfInterestImageFilter(const Self &); // purposely not implemented + void + operator=(const Self &); // purposely not implemented + + RegionType m_RegionOfInterest; +}; + +template +class RegionOfInterestImageFilter, RLEImage> + : public ImageToImageFilter, RLEImage> +{ +public: + /** Standard class typedefs. */ + typedef RegionOfInterestImageFilter Self; + typedef RLEImage RLEImageType; + typedef Image ImageType; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + typedef typename Superclass::InputImageRegionType InputImageRegionType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(RegionOfInterestImageFilter, ImageToImageFilter); + + /** Typedef to describe the input image region types. */ + typedef typename RLEImageType::RegionType RegionType; + typedef typename RLEImageType::IndexType IndexType; + typedef typename RLEImageType::SizeType SizeType; + + /** Typedef to describe the type of pixel. */ + typedef typename RLEImageType::PixelType OutputImagePixelType; + typedef typename RLEImageType::PixelType InputImagePixelType; + + /** Set/Get the output image region. */ + itkSetMacro(RegionOfInterest, RegionType); + itkGetConstMacro(RegionOfInterest, RegionType); + + /** ImageDimension enumeration */ + itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, VImageDimension); + +#ifdef ITK_USE_CONCEPT_CHECKING + // Begin concept checking + itkConceptMacro(SameDimensionCheck, (Concept::SameDimension)); + itkConceptMacro(InputConvertibleToOutputCheck, (Concept::Convertible)); + // End concept checking +#endif + +protected: + RegionOfInterestImageFilter() {} + ~RegionOfInterestImageFilter() {} + void + PrintSelf(std::ostream & os, Indent indent) const; + + virtual void + GenerateInputRequestedRegion(); + + virtual void + EnlargeOutputRequestedRegion(DataObject * output); + + /** RegionOfInterestImageFilter can produce an image which is a different + * size than its input image. As such, RegionOfInterestImageFilter + * needs to provide an implementation for + * GenerateOutputInformation() in order to inform the pipeline + * execution model. The original documentation of this method is + * below. + * + * \sa ProcessObject::GenerateOutputInformaton() */ + virtual void + GenerateOutputInformation(); + + /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. + * Therefore, this implementation provides a ThreadedGenerateData() + * routine which is called for each processing thread. The output + * image data is allocated automatically by the superclass prior to + * calling ThreadedGenerateData(). ThreadedGenerateData can only + * write to the portion of the output image specified by the + * parameter "outputRegionForThread" + * \sa ImageToImageFilter::ThreadedGenerateData(), + * ImageToImageFilter::GenerateData() */ + void + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId); + +private: + RegionOfInterestImageFilter(const Self &); // purposely not implemented + void + operator=(const Self &); // purposely not implemented + + RegionType m_RegionOfInterest; +}; + +template +class RegionOfInterestImageFilter, Image> + : public ImageToImageFilter, Image> +{ +public: + /** Standard class typedefs. */ + typedef RegionOfInterestImageFilter Self; + typedef RLEImage RLEImageType; + typedef Image ImageType; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + typedef typename Superclass::InputImageRegionType InputImageRegionType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(RegionOfInterestImageFilter, ImageToImageFilter); + + /** Typedef to describe the input image region types. */ + typedef typename RLEImageType::RegionType RegionType; + typedef typename RLEImageType::IndexType IndexType; + typedef typename RLEImageType::SizeType SizeType; + + /** Typedef to describe the type of pixel. */ + typedef typename RLEImageType::PixelType OutputImagePixelType; + typedef typename RLEImageType::PixelType InputImagePixelType; + + /** Set/Get the output image region. */ + itkSetMacro(RegionOfInterest, RegionType); + itkGetConstMacro(RegionOfInterest, RegionType); + + /** ImageDimension enumeration */ + itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, VImageDimension); + +#ifdef ITK_USE_CONCEPT_CHECKING + // Begin concept checking + itkConceptMacro(SameDimensionCheck, (Concept::SameDimension)); + itkConceptMacro(InputConvertibleToOutputCheck, (Concept::Convertible)); + // End concept checking +#endif + +protected: + RegionOfInterestImageFilter() {} + ~RegionOfInterestImageFilter() {} + void + PrintSelf(std::ostream & os, Indent indent) const; + + virtual void + GenerateInputRequestedRegion(); + + virtual void + EnlargeOutputRequestedRegion(DataObject * output); + + /** RegionOfInterestImageFilter can produce an image which is a different + * size than its input image. As such, RegionOfInterestImageFilter + * needs to provide an implementation for + * GenerateOutputInformation() in order to inform the pipeline + * execution model. The original documentation of this method is + * below. + * + * \sa ProcessObject::GenerateOutputInformaton() */ + virtual void + GenerateOutputInformation(); + + /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. + * Therefore, this implementation provides a ThreadedGenerateData() + * routine which is called for each processing thread. The output + * image data is allocated automatically by the superclass prior to + * calling ThreadedGenerateData(). ThreadedGenerateData can only + * write to the portion of the output image specified by the + * parameter "outputRegionForThread" + * \sa ImageToImageFilter::ThreadedGenerateData(), + * ImageToImageFilter::GenerateData() */ + void + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId); + +private: + RegionOfInterestImageFilter(const Self &); // purposely not implemented + void + operator=(const Self &); // purposely not implemented + + RegionType m_RegionOfInterest; +}; +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +# include "RLERegionOfInterestImageFilter.txx" +#endif + +#endif // RLERegionOfInterestImageFilter_h diff --git a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.txx b/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.txx new file mode 100644 index 00000000000..321f7bbf250 --- /dev/null +++ b/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.txx @@ -0,0 +1,531 @@ +#ifndef RLERegionOfInterestImageFilter_txx +#define RLERegionOfInterestImageFilter_txx + +#include "itkRegionOfInterestImageFilter.h" +#include "itkImageAlgorithm.h" +#include "itkObjectFactory.h" +#include "itkProgressReporter.h" +#include "itkImage.h" + +namespace itk +{ +template +void +RegionOfInterestImageFilter, + RLEImage>::PrintSelf(std::ostream & os, + Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "RegionOfInterest: " << m_RegionOfInterest << std::endl; +} + +template +void +RegionOfInterestImageFilter, + RLEImage>::GenerateInputRequestedRegion() +{ + // call the superclass' implementation of this method + Superclass::GenerateInputRequestedRegion(); + + // get pointer to the input + typename Superclass::InputImagePointer inputPtr = const_cast(this->GetInput()); + + if (inputPtr) + { + // request the region of interest + inputPtr->SetRequestedRegion(m_RegionOfInterest); + } +} + +template +void +RegionOfInterestImageFilter, + RLEImage>::EnlargeOutputRequestedRegion(DataObject * + output) +{ + // call the superclass' implementation of this method + Superclass::EnlargeOutputRequestedRegion(output); + + // generate everything in the region of interest + output->SetRequestedRegionToLargestPossibleRegion(); +} + +/** + * RegionOfInterestImageFilter can produce an image which is a different size + * than its input image. As such, RegionOfInterestImageFilter needs to provide an + * implementation for GenerateOutputInformation() in order to inform + * the pipeline execution model. The original documentation of this + * method is below. + * + * \sa ProcessObject::GenerateOutputInformaton() + */ +template +void +RegionOfInterestImageFilter, + RLEImage>::GenerateOutputInformation() +{ + // do not call the superclass' implementation of this method since + // this filter allows the input the output to be of different dimensions + + // get pointers to the input and output + typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); + typename Superclass::InputImageConstPointer inputPtr = this->GetInput(); + + if (!outputPtr || !inputPtr) + { + return; + } + + // Set the output image size to the same value as the region of interest. + RegionType region; + IndexType start; + start.Fill(0); + + region.SetSize(m_RegionOfInterest.GetSize()); + region.SetIndex(start); + + // Copy Information without modification. + outputPtr->CopyInformation(inputPtr); + + // Adjust output region + outputPtr->SetLargestPossibleRegion(region); + + // Correct origin of the extracted region. + IndexType roiStart(m_RegionOfInterest.GetIndex()); + typename Superclass::OutputImageType::PointType outputOrigin; + inputPtr->TransformIndexToPhysicalPoint(roiStart, outputOrigin); + outputPtr->SetOrigin(outputOrigin); +} + +/** + * RegionOfInterestImageFilter can be implemented as a multithreaded filter. + * Therefore, this implementation provides a ThreadedGenerateData() + * routine which is called for each processing thread. The output + * image data is allocated automatically by the superclass prior to + * calling ThreadedGenerateData(). ThreadedGenerateData can only + * write to the portion of the output image specified by the + * parameter "outputRegionForThread" + * + * \sa ImageToImageFilter::ThreadedGenerateData(), + * ImageToImageFilter::GenerateData() + */ +template +void +RegionOfInterestImageFilter< + RLEImage, + RLEImage>::ThreadedGenerateData(const RegionType & outputRegionForThread, + ThreadIdType threadId) +{ + // Get the input and output pointers + const RLEImageType * in = this->GetInput(); + RLEImageType * out = this->GetOutput(); + + // Define the portion of the input to walk for this thread + InputImageRegionType inputRegionForThread; + inputRegionForThread.SetSize(outputRegionForThread.GetSize()); + + IndexType start, end; + IndexType roiStart(m_RegionOfInterest.GetIndex()); + IndexType threadStart(outputRegionForThread.GetIndex()); + for (unsigned int i = 0; i < VImageDimension; i++) + { + start[i] = roiStart[i] + threadStart[i]; + end[i] = roiStart[i] + threadStart[i] + outputRegionForThread.GetSize(i); + } + inputRegionForThread.SetIndex(start); + + bool copyLines = (in->GetLargestPossibleRegion().GetSize(0) == outputRegionForThread.GetSize(0)); + typename ImageType::BufferType::RegionType oReg = ImageType::truncateRegion(outputRegionForThread), + iReg = ImageType::truncateRegion(inputRegionForThread); + ImageRegionConstIterator iIt(in->GetBuffer(), iReg); + ImageRegionIterator oIt(out->GetBuffer(), oReg); + + while (!oIt.IsAtEnd()) + { + if (copyLines) + oIt.Set(iIt.Get()); + else // determine begin and end iterator and copy range + { + typename RLEImageType::RLLine & oLine = oIt.Value(); + oLine.clear(); + const typename RLEImageType::RLLine & iLine = iIt.Value(); + CounterType t = 0; + SizeValueType x = 0; + // find start + for (; x < iLine.size(); x++) + { + t += iLine[x].first; + if (t > start[0]) + break; + } + assert(x < iLine.size()); + + SizeValueType begin = x; + if (t >= end[0]) // both begin and end are in this segment + { + oLine.push_back(typename RLEImageType::RLSegment(end[0] - start[0], iLine[x].second)); + ++iIt; + ++oIt; + continue; // next line + } + else if (t - start[0] < iLine[x].first) // not the first pixel in segment + { + oLine.push_back(typename RLEImageType::RLSegment(t - start[0], iLine[x].second)); + begin++; // start copying from next segment + } + + // if (t < end[0]) + for (x++; x < iLine.size(); x++) + { + t += iLine[x].first; + if (t >= end[0]) + break; + } + if (t == end[0]) + oLine.insert(oLine.end(), iLine.begin() + begin, iLine.begin() + x + 1); + else // we need to take special care of the last segment + { + oLine.insert(oLine.end(), iLine.begin() + begin, iLine.begin() + x); + oLine.push_back(typename RLEImageType::RLSegment(end[0] + iLine[x].first - t, iLine[x].second)); + } + } + ++iIt; + ++oIt; + } +} + + +template +void +RegionOfInterestImageFilter, RLEImage>::PrintSelf( + std::ostream & os, + Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "RegionOfInterest: " << m_RegionOfInterest << std::endl; +} + +template +void +RegionOfInterestImageFilter, + RLEImage>::GenerateInputRequestedRegion() +{ + // call the superclass' implementation of this method + Superclass::GenerateInputRequestedRegion(); + + // get pointer to the input + typename Superclass::InputImagePointer inputPtr = const_cast(this->GetInput()); + + if (inputPtr) + { + // request the region of interest + inputPtr->SetRequestedRegion(m_RegionOfInterest); + } +} + +template +void +RegionOfInterestImageFilter, RLEImage>:: + EnlargeOutputRequestedRegion(DataObject * output) +{ + // call the superclass' implementation of this method + Superclass::EnlargeOutputRequestedRegion(output); + + // generate everything in the region of interest + output->SetRequestedRegionToLargestPossibleRegion(); +} + +/** + * RegionOfInterestImageFilter can produce an image which is a different size + * than its input image. As such, RegionOfInterestImageFilter needs to provide an + * implementation for GenerateOutputInformation() in order to inform + * the pipeline execution model. The original documentation of this + * method is below. + * + * \sa ProcessObject::GenerateOutputInformaton() + */ +template +void +RegionOfInterestImageFilter, + RLEImage>::GenerateOutputInformation() +{ + // do not call the superclass' implementation of this method since + // this filter allows the input the output to be of different dimensions + + // get pointers to the input and output + typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); + typename Superclass::InputImageConstPointer inputPtr = this->GetInput(); + + if (!outputPtr || !inputPtr) + { + return; + } + + // Set the output image size to the same value as the region of interest. + RegionType region; + IndexType start; + start.Fill(0); + + region.SetSize(m_RegionOfInterest.GetSize()); + region.SetIndex(start); + + // Copy Information without modification. + outputPtr->CopyInformation(inputPtr); + + // Adjust output region + outputPtr->SetLargestPossibleRegion(region); + + // Correct origin of the extracted region. + IndexType roiStart(m_RegionOfInterest.GetIndex()); + typename Superclass::OutputImageType::PointType outputOrigin; + inputPtr->TransformIndexToPhysicalPoint(roiStart, outputOrigin); + outputPtr->SetOrigin(outputOrigin); +} + +/** + * RegionOfInterestImageFilter can be implemented as a multithreaded filter. + * Therefore, this implementation provides a ThreadedGenerateData() + * routine which is called for each processing thread. The output + * image data is allocated automatically by the superclass prior to + * calling ThreadedGenerateData(). ThreadedGenerateData can only + * write to the portion of the output image specified by the + * parameter "outputRegionForThread" + * + * \sa ImageToImageFilter::ThreadedGenerateData(), + * ImageToImageFilter::GenerateData() + */ +template +void +RegionOfInterestImageFilter, RLEImage>:: + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) +{ + // Get the input and output pointers + const ImageType * in = this->GetInput(); + RLEImageType * out = this->GetOutput(); + + // Define the portion of the input to walk for this thread + InputImageRegionType inputRegionForThread; + inputRegionForThread.SetSize(outputRegionForThread.GetSize()); + + IndexType start, end; + IndexType roiStart(m_RegionOfInterest.GetIndex()); + IndexType threadStart(outputRegionForThread.GetIndex()); + for (unsigned int i = 0; i < VImageDimension; i++) + { + start[i] = roiStart[i] + threadStart[i]; + end[i] = roiStart[i] + threadStart[i] + outputRegionForThread.GetSize(i); + } + inputRegionForThread.SetIndex(start); + + typename RLEImageType::BufferType::RegionType oReg = RLEImageType::truncateRegion(outputRegionForThread); + ImageRegionConstIterator iIt(in, inputRegionForThread); + ImageRegionIterator oIt(out->GetBuffer(), oReg); + SizeValueType size0 = outputRegionForThread.GetSize(0); + typename RLEImageType::RLLine temp; + temp.reserve(size0); // pessimistically preallocate buffer, otherwise reallocations can occur + + while (!oIt.IsAtEnd()) + { + SizeValueType x = 0; + temp.clear(); + while (x < size0) + { + typename RLEImageType::RLSegment s(0, iIt.Value()); + while (x < size0 && iIt.Value() == s.second) + { + x++; + s.first++; + ++(iIt); + } + temp.push_back(s); + } + oIt.Value() = temp; + ++oIt; + } +} + + +template +void +RegionOfInterestImageFilter, Image>::PrintSelf( + std::ostream & os, + Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "RegionOfInterest: " << m_RegionOfInterest << std::endl; +} + +template +void +RegionOfInterestImageFilter, + Image>::GenerateInputRequestedRegion() +{ + // call the superclass' implementation of this method + Superclass::GenerateInputRequestedRegion(); + + // get pointer to the input + typename Superclass::InputImagePointer inputPtr = const_cast(this->GetInput()); + + if (inputPtr) + { + // request the region of interest + inputPtr->SetRequestedRegion(m_RegionOfInterest); + } +} + +template +void +RegionOfInterestImageFilter, + Image>::EnlargeOutputRequestedRegion(DataObject * output) +{ + // call the superclass' implementation of this method + Superclass::EnlargeOutputRequestedRegion(output); + + // generate everything in the region of interest + output->SetRequestedRegionToLargestPossibleRegion(); +} + +/** + * RegionOfInterestImageFilter can produce an image which is a different size + * than its input image. As such, RegionOfInterestImageFilter needs to provide an + * implementation for GenerateOutputInformation() in order to inform + * the pipeline execution model. The original documentation of this + * method is below. + * + * \sa ProcessObject::GenerateOutputInformaton() + */ +template +void +RegionOfInterestImageFilter, + Image>::GenerateOutputInformation() +{ + // do not call the superclass' implementation of this method since + // this filter allows the input the output to be of different dimensions + + // get pointers to the input and output + typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); + typename Superclass::InputImageConstPointer inputPtr = this->GetInput(); + + if (!outputPtr || !inputPtr) + { + return; + } + + // Set the output image size to the same value as the region of interest. + RegionType region; + IndexType start; + start.Fill(0); + + region.SetSize(m_RegionOfInterest.GetSize()); + region.SetIndex(start); + + // Copy Information without modification. + outputPtr->CopyInformation(inputPtr); + + // Adjust output region + outputPtr->SetLargestPossibleRegion(region); + + // Correct origin of the extracted region. + IndexType roiStart(m_RegionOfInterest.GetIndex()); + typename Superclass::OutputImageType::PointType outputOrigin; + inputPtr->TransformIndexToPhysicalPoint(roiStart, outputOrigin); + outputPtr->SetOrigin(outputOrigin); +} + +/** + * RegionOfInterestImageFilter can be implemented as a multithreaded filter. + * Therefore, this implementation provides a ThreadedGenerateData() + * routine which is called for each processing thread. The output + * image data is allocated automatically by the superclass prior to + * calling ThreadedGenerateData(). ThreadedGenerateData can only + * write to the portion of the output image specified by the + * parameter "outputRegionForThread" + * + * \sa ImageToImageFilter::ThreadedGenerateData(), + * ImageToImageFilter::GenerateData() + */ +template +void +RegionOfInterestImageFilter, Image>:: + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) +{ + // Get the input and output pointers + const RLEImageType * in = this->GetInput(); + ImageType * out = this->GetOutput(); + + // Define the portion of the input to walk for this thread + InputImageRegionType inputRegionForThread; + inputRegionForThread.SetSize(outputRegionForThread.GetSize()); + + IndexType start, end; + IndexType roiStart(m_RegionOfInterest.GetIndex()); + IndexType threadStart(outputRegionForThread.GetIndex()); + for (unsigned int i = 0; i < VImageDimension; i++) + { + start[i] = roiStart[i] + threadStart[i]; + end[i] = roiStart[i] + threadStart[i] + outputRegionForThread.GetSize(i); + } + inputRegionForThread.SetIndex(start); + + typename RLEImageType::BufferType::RegionType iReg = RLEImageType::truncateRegion(inputRegionForThread); + ImageRegionConstIterator iIt(in->GetBuffer(), iReg); + ImageRegionIterator oIt(out, outputRegionForThread); + + while (!iIt.IsAtEnd()) + { + const typename RLEImageType::RLLine & iLine = iIt.Value(); + CounterType t = 0; + SizeValueType x = 0; + // find start + for (; x < iLine.size(); x++) + { + t += iLine[x].first; + if (t > start[0]) + break; + } + assert(x < iLine.size()); + + SizeValueType begin = x; + if (t >= end[0]) // both begin and end are in this segment + { + for (SizeValueType i = start[0]; i < end[0]; i++) + { + oIt.Set(iLine[x].second); + ++oIt; + } + ++iIt; + continue; // next line + } + // else handle the beginning segment + for (SizeValueType i = start[0]; i < t; i++) + { + oIt.Set(iLine[x].second); + ++oIt; + } + // now handle middle segments + for (x++; x < iLine.size(); x++) + { + t += iLine[x].first; + if (t >= end[0]) + break; + for (SizeValueType i = 0; i < iLine[x].first; i++) + { + oIt.Set(iLine[x].second); + ++oIt; + } + } + // handle the last segment + for (SizeValueType i = 0; i < end[0] + iLine[x].first - t; i++) + { + oIt.Set(iLine[x].second); + ++oIt; + } + ++iIt; + } +} +} // end namespace itk + +#endif // RLERegionOfInterestImageFilter_txx From 33618791cb67f4ff9d96a6a611b029ff2f7fb93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 15 Jul 2016 16:17:40 -0400 Subject: [PATCH 03/95] COMP: Adding ITK build infrastructure --- Modules/Filtering/RLEImage/CMakeLists.txt | 10 ++++++++++ Modules/Filtering/RLEImage/itk-module.cmake | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 Modules/Filtering/RLEImage/CMakeLists.txt create mode 100644 Modules/Filtering/RLEImage/itk-module.cmake diff --git a/Modules/Filtering/RLEImage/CMakeLists.txt b/Modules/Filtering/RLEImage/CMakeLists.txt new file mode 100644 index 00000000000..0c9a7900532 --- /dev/null +++ b/Modules/Filtering/RLEImage/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8.9) +project(RLEImage) + +if(NOT ITK_SOURCE_DIR) + find_package(ITK 4.9 REQUIRED) + list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) + include(ITKModuleExternal) +else() + itk_module_impl() +endif() diff --git a/Modules/Filtering/RLEImage/itk-module.cmake b/Modules/Filtering/RLEImage/itk-module.cmake new file mode 100644 index 00000000000..5426abb796c --- /dev/null +++ b/Modules/Filtering/RLEImage/itk-module.cmake @@ -0,0 +1,18 @@ +set( + DOCUMENTATION + "The module provides run-length encoded storage for +image content, iterators for efficient reading and writing, and a +specialization of region of interest filter which can also be used to +convert to and from regular itk::Image." +) + +itk_module( + RLEImage + DEPENDS + ITKCommon + TEST_DEPENDS + ITKIOImageBase + ITKTestKernel + EXCLUDE_FROM_DEFAULT + DESCRIPTION "${DOCUMENTATION}" +) From 98f51e81ee50c385fff09f9cdb72c771041ff37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 10:42:38 -0400 Subject: [PATCH 04/95] ENH: Adding test images --- Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 | 1 + Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 | 1 + Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 | 1 + .../Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 | 1 + .../Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 | 1 + .../Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 | 1 + .../Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 | 1 + .../RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 | 1 + .../RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 | 1 + .../RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 | 1 + .../RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 | 1 + .../RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 | 1 + 27 files changed, 27 insertions(+) create mode 100644 Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 diff --git a/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 new file mode 100644 index 00000000000..cdcfca6fe01 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 @@ -0,0 +1 @@ +073f5da3d2dbf24104a0dbd3c9699bb2 diff --git a/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 new file mode 100644 index 00000000000..aad5e9b5a00 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 @@ -0,0 +1 @@ +512b41f6690b535b9b27de9832c1529b diff --git a/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 new file mode 100644 index 00000000000..341bb86c6fa --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 @@ -0,0 +1 @@ +566aff5e7f160fbf730d8e64bfbdd379 diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 new file mode 100644 index 00000000000..d79cfcf7e99 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 @@ -0,0 +1 @@ +2ff042b68ae1f44127776e8e546223b7 diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 new file mode 100644 index 00000000000..563c4d416b2 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 @@ -0,0 +1 @@ +863f38492ccfd2fdec93508f0e454e63 diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 new file mode 100644 index 00000000000..052244d0860 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 @@ -0,0 +1 @@ +cdacd7d72edfafe4b920228533549a30 diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 new file mode 100644 index 00000000000..61bea75264e --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 @@ -0,0 +1 @@ +e7931fc584d6277a8bc80f50b302338a diff --git a/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 new file mode 100644 index 00000000000..504084e627f --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 @@ -0,0 +1 @@ +73e68c28d7777bccdd3eb0373c5c0ab1 diff --git a/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 new file mode 100644 index 00000000000..0dbfe86827a --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 @@ -0,0 +1 @@ +bc5c266afb4048e06c742ab869cfe800 diff --git a/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 new file mode 100644 index 00000000000..6b0412ff1ca --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 @@ -0,0 +1 @@ +28e953e50f8fde195723a2872b223b3f diff --git a/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 new file mode 100644 index 00000000000..5a012f49c11 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 @@ -0,0 +1 @@ +58e993ac9915bb149cb73e553a895036 diff --git a/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 new file mode 100644 index 00000000000..a20ef2267b6 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 @@ -0,0 +1 @@ +196177de83960d892f79b6c4cbb1dd84 diff --git a/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 new file mode 100644 index 00000000000..735046e484b --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 @@ -0,0 +1 @@ +4d599d3dd9071bd7609ad725e7b53a4b diff --git a/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 new file mode 100644 index 00000000000..1e3f2152d5d --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 @@ -0,0 +1 @@ +3ca36e1bdd48bb2d33a13b21b4b8716a diff --git a/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 new file mode 100644 index 00000000000..c2bc0ee6d79 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 @@ -0,0 +1 @@ +c7018805c6dad7dcb76f51897ded3486 diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 new file mode 100644 index 00000000000..96ddaea9ed5 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 @@ -0,0 +1 @@ +f24e655673e0a28406a2e7e03984900a diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 new file mode 100644 index 00000000000..74e5d869159 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 @@ -0,0 +1 @@ +1a63151e851eb79de8718b6b8ffa03cc diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 new file mode 100644 index 00000000000..12728cb1474 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 @@ -0,0 +1 @@ +0f73a7f34b25e607c638cfde9c29cbe2 diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 new file mode 100644 index 00000000000..d43992fcd20 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 @@ -0,0 +1 @@ +d9c0e6d796a439794019f78b6ae23c3e diff --git a/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 new file mode 100644 index 00000000000..695e97a3b4c --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 @@ -0,0 +1 @@ +efdefd9a493158532651fd4e84728ad4 diff --git a/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 new file mode 100644 index 00000000000..057a80daaf7 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 @@ -0,0 +1 @@ +e3fd590af475e356fb45bdb647141335 diff --git a/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 new file mode 100644 index 00000000000..7a857e4268c --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 @@ -0,0 +1 @@ +df56e390fb449ed184d949946f496f73 diff --git a/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 new file mode 100644 index 00000000000..9417fbcbed0 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 @@ -0,0 +1 @@ +5f0a2ce8efe94f27c1cb79d74320b3b2 diff --git a/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 new file mode 100644 index 00000000000..eddc86babe5 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 @@ -0,0 +1 @@ +7bdb6e5a06f302035e20d57c9c44755f diff --git a/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 new file mode 100644 index 00000000000..a9f35a70d4f --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 @@ -0,0 +1 @@ +74db7779b7c24ac84bc7cc5d6bdadf36 diff --git a/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 new file mode 100644 index 00000000000..6556e621abd --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 @@ -0,0 +1 @@ +76726944bf4261b5098ce6d47c695353 diff --git a/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 new file mode 100644 index 00000000000..4a34b999e98 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 @@ -0,0 +1 @@ +c7fc0c04bf25a032adf3a626d7e11da5 From a70cc9bdb27174ab341a039e6066d0deff9f5978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 11:00:36 -0400 Subject: [PATCH 05/95] ENH: Adding tests --- .../Filtering/RLEImage/test/CMakeLists.txt | 72 ++++ .../Filtering/RLEImage/test/ReadWriteTest.cxx | 115 +++++ .../Filtering/RLEImage/test/iteratorTests.cxx | 33 ++ .../RLEImage/test/itkImageIteratorTest.cxx | 280 ++++++++++++ .../test/itkImageIteratorWithIndexTest.cxx | 400 ++++++++++++++++++ .../itkImageIteratorsForwardBackwardTest.cxx | 168 ++++++++ ...geRegionConstIteratorWithOnlyIndexTest.cxx | 231 ++++++++++ .../test/itkImageRegionIteratorTest.cxx | 237 +++++++++++ .../test/itkImageScanlineIteratorTest1.cxx | 236 +++++++++++ .../RLEImage/test/itkIteratorTests.cxx | 125 ++++++ .../itkRegionOfInterestImageFilterTest.cxx | 138 ++++++ .../Filtering/RLEImage/test/manualTest.cxx | 33 ++ 12 files changed, 2068 insertions(+) create mode 100644 Modules/Filtering/RLEImage/test/CMakeLists.txt create mode 100644 Modules/Filtering/RLEImage/test/ReadWriteTest.cxx create mode 100644 Modules/Filtering/RLEImage/test/iteratorTests.cxx create mode 100644 Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx create mode 100644 Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx create mode 100644 Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx create mode 100644 Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx create mode 100644 Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx create mode 100644 Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx create mode 100644 Modules/Filtering/RLEImage/test/itkIteratorTests.cxx create mode 100644 Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx create mode 100644 Modules/Filtering/RLEImage/test/manualTest.cxx diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt new file mode 100644 index 00000000000..c0bb689bff5 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -0,0 +1,72 @@ +itk_module_test() + +set(RLEImageTest ReadWriteTest.cxx) + +createtestdriver( RLEImage "${RLEImage-Test_LIBRARIES}" "${RLEImageTest}" ) + +add_executable( + runFromIDE + manualTest.cxx + ${RLEImageTest} +) +target_link_libraries(runFromIDE ${RLEImage-Test_LIBRARIES}) + +function(ReadWriteTest ImageName Ext) + set(outImage "${ITK_TEST_OUTPUT_DIR}/${ImageName}.${Ext}") + itk_add_test( + NAME ${ImageName} + COMMAND + RLEImageTestDriver + --compare + DATA{Input/${ImageName}.${Ext}} + ${outImage} + RLEImageTest + DATA{Input/${ImageName}.${Ext}} + ${outImage} + ) +endfunction() + +# Handcrafted tests +readwritetest(Empty nrrd) +readwritetest(NoSlices nrrd) +readwritetest(Micro1 nrrd) +readwritetest(SimplestOneToOne nrrd) +readwritetest(OneToOne nrrd) +readwritetest(OneToThree nrrd) +readwritetest(ExtrapolationAppearing nrrd) +readwritetest(DoubleTwoLabelBranching nrrd) +readwritetest(TwoAxisDoubleTwoLabelBC nrrd) +readwritetest(AccidentalMiddleSliceSeg nrrd) +readwritetest(ThreeAxisFourLabelConflict nrrd) +readwritetest(SevenLabels nrrd) +readwritetest(FullEnd nrrd) +readwritetest(1MN1 nrrd) +readwritetest(ManyToMany16 nrrd) +readwritetest(ManyToMany nrrd) +readwritetest(GridSeg nrrd) +readwritetest(GridSeg2 nrrd) +readwritetest(FaceRoI nrrd) +readwritetest(BigZ nrrd) +readwritetest(FourD nrrd) + +# Paul's test images +readwritetest(105769moving nii.gz) +readwritetest(105769fixed nii.gz) +readwritetest(64816L_amygdala_fin nii.gz) +readwritetest(64816L_amygdala_int nii.gz) +readwritetest(65239R_amygdala_fin nii.gz) +readwritetest(65239R_amygdala_int nii.gz) + +add_executable( + iteratorTests + itkRegionOfInterestImageFilterTest.cxx + itkIteratorTests.cxx + itkImageIteratorsForwardBackwardTest.cxx + itkImageIteratorTest.cxx + itkImageIteratorWithIndexTest.cxx + itkImageRegionConstIteratorWithOnlyIndexTest.cxx + itkImageRegionIteratorTest.cxx + itkImageScanlineIteratorTest1.cxx + iteratorTests.cxx +) +target_link_libraries(iteratorTests ${ITK_LIBRARIES}) diff --git a/Modules/Filtering/RLEImage/test/ReadWriteTest.cxx b/Modules/Filtering/RLEImage/test/ReadWriteTest.cxx new file mode 100644 index 00000000000..9b18f5ccad8 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/ReadWriteTest.cxx @@ -0,0 +1,115 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include "RLEImageScanlineIterator.h" +#include "RLEImageRegionIterator.h" +#include "RLERegionOfInterestImageFilter.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include +#include + +template +void +doTest(std::string inFilename, std::string outFilename) +{ + typedef itk::ImageFileReader ReaderType; + typename ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(inFilename); + reader->Update(); + + typedef RLEImage myRLEImage; + typedef itk::RegionOfInterestImageFilter inConverterType; + typename inConverterType::Pointer inConv = inConverterType::New(); + inConv->SetInput(reader->GetOutput()); + inConv->SetRegionOfInterest(reader->GetOutput()->GetLargestPossibleRegion()); + inConv->Update(); + typename myRLEImage::Pointer test = inConv->GetOutput(); + + // region for partial coverage + typename myRLEImage::RegionType reg = test->GetLargestPossibleRegion(); + // skip X due to RLE representation constraints + // for (int i = 1; i < ImageType::ImageDimension; i++) + // { + // reg.GetModifiableIndex()[i] += (reg.GetSize(i) - 1) / 4; + // reg.SetSize(i, (reg.GetSize(i) + 1) / 2); + // } + + typedef itk::RegionOfInterestImageFilter outConverterType; + typename outConverterType::Pointer outConv = outConverterType::New(); + outConv->SetInput(test); + outConv->SetRegionOfInterest(reg); + outConv->Update(); + + typedef itk::ImageFileWriter WriterType; + typename WriterType::Pointer writer = WriterType::New(); + writer->SetFileName(outFilename); + writer->SetInput(outConv->GetOutput()); + writer->SetUseCompression(true); + writer->Update(); +} + +int +itkRLEImageTest(int argc, char * argv[]) +{ + if (argc < 3) + { + std::cerr << "Usage: " << argv[0] << " inputImage outputImage" << std::endl; + return EXIT_FAILURE; + } + const char * inputImageFileName = argv[1]; + const char * outputImageFileName = argv[2]; + + typedef itk::ImageIOBase::IOComponentType ScalarPixelType; + itk::ImageIOBase::Pointer imageIO = + itk::ImageIOFactory::CreateImageIO(inputImageFileName, itk::ImageIOFactory::ReadMode); + if (!imageIO) + { + std::cerr << "Could not CreateImageIO for: " << inputImageFileName << std::endl; + return EXIT_FAILURE; + } + imageIO->SetFileName(inputImageFileName); + imageIO->ReadImageInformation(); + const ScalarPixelType pixelType = imageIO->GetComponentType(); + const size_t numDimensions = imageIO->GetNumberOfDimensions(); + + try + { + // unused cases are not instantiated because they greatly increase compile time + if (numDimensions == 3 && (pixelType == itk::ImageIOBase::SHORT || pixelType == itk::ImageIOBase::USHORT)) + { + doTest>(inputImageFileName, outputImageFileName); + return EXIT_SUCCESS; + } + if (numDimensions == 4 && pixelType == itk::ImageIOBase::UCHAR) + { + doTest>(inputImageFileName, outputImageFileName); + return EXIT_SUCCESS; + } + + std::cerr << "Unsupported image type:\n Dimensions: " << numDimensions; + std::cerr << "\n Pixel type:" << imageIO->GetComponentTypeAsString(pixelType) << std::endl; + return EXIT_FAILURE; + } + catch (itk::ExceptionObject & error) + { + std::cerr << "Error: " << error << std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/RLEImage/test/iteratorTests.cxx b/Modules/Filtering/RLEImage/test/iteratorTests.cxx new file mode 100644 index 00000000000..a1db0e2c94b --- /dev/null +++ b/Modules/Filtering/RLEImage/test/iteratorTests.cxx @@ -0,0 +1,33 @@ +#include "RLEImageScanlineIterator.h" + +extern int +itkImageScanlineIteratorTest1(int argc, char * argv[]); +extern int +itkIteratorTests(int argc, char * argv[]); +extern int +itkImageIteratorTest(int argc, char * argv[]); +extern int +itkImageIteratorsForwardBackwardTest(int argc, char * argv[]); +extern int +itkImageIteratorWithIndexTest(int argc, char * argv[]); +extern int +itkImageRegionConstIteratorWithOnlyIndexTest(int argc, char * argv[]); +extern int +itkImageRegionIteratorTest(int argc, char * argv[]); +extern int +itkRegionOfInterestImageFilterTest(int argc, char * argv[]); + +int +main(int argc, char * argv[]) +{ + // itkImageRegionIteratorTest(argc, argv); + itkImageScanlineIteratorTest1(argc, argv); + itkIteratorTests(argc, argv); + itkImageIteratorTest(argc, argv); + itkImageIteratorsForwardBackwardTest(argc, argv); + itkImageIteratorWithIndexTest(argc, argv); + itkImageRegionConstIteratorWithOnlyIndexTest(argc, argv); + itkRegionOfInterestImageFilterTest(argc, argv); + typedef RLEImage charred2dType; // test size 256 + typedef RLEImage charred4dType; // test size 65536 +} diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx new file mode 100644 index 00000000000..dbef253061e --- /dev/null +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx @@ -0,0 +1,280 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include +#include "RLEImage.h" +#include "RLEImageRegionIterator.h" + + +// This routine is used to make sure that we call the "const" version +// of GetPixel() (via the operator[]) +template +void +TestConstPixelAccess(const RLEImage & in, RLEImage & out) +{ + typename RLEImage::IndexType regionStartIndex3D = { { 5, 10, 15 } }; + typename RLEImage::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + + T vec; + + vec[0] = 5; + vec[1] = 4; + vec[2] = 3; + vec[3] = 2; + vec[4] = 1; + + out.SetPixel(regionStartIndex3D, vec); + out.SetPixel(regionEndIndex3D, in[regionStartIndex3D]); +} + + +int +itkImageIteratorTest(int, char *[]) +{ + const unsigned int ImageDimension = 3; + + std::cout << "Creating an image" << std::endl; + RLEImage>::Pointer o3 = RLEImage>::New(); + + float origin3D[ImageDimension] = { 5, 2.1, 8.1 }; + float spacing3D[ImageDimension] = { 1.5, 2.1, 1 }; + + RLEImage>::SizeType imageSize3D = { { 20, 40, 60 } }; + + RLEImage>::IndexType startIndex3D = { { 5, 4, 1 } }; + RLEImage>::IndexType regionStartIndex3D = { { 6, 10, 12 } }; + RLEImage>::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + + + RLEImage>::RegionType region; + region.SetSize(imageSize3D); + region.SetIndex(startIndex3D); + o3->SetRegions(region); + o3->SetOrigin(origin3D); + o3->SetSpacing(spacing3D); + + o3->Allocate(); + itk::Vector fillValue; + fillValue.Fill(itk::NumericTraits::max()); + o3->FillBuffer(fillValue); + + std::cout << "Setting/Getting a pixel" << std::endl; + itk::Vector vec; + + vec[0] = 5; + vec[1] = 4; + vec[2] = 3; + vec[3] = 2; + vec[4] = 1; + + (*o3).SetPixel(regionStartIndex3D, vec); + (*o3).SetPixel(regionEndIndex3D, (*o3)[regionStartIndex3D]); + TestConstPixelAccess(*o3, *o3); + + typedef itk::Vector VectorPixelType; + typedef RLEImage VectorImageType; + + typedef itk::ImageIterator VectorImageIterator; + typedef itk::ImageConstIterator VectorImageConstIterator; + + VectorImageIterator itr1(o3, region); + VectorImageConstIterator itr2(o3, region); + + // Exercise copy constructor + VectorImageIterator itr3(itr1); + + // Exercise assignment operator + VectorImageIterator itr4; + itr4 = itr1; + + // Exercise operator!= + if (itr4 != itr1) + { + std::cerr << "Error in operator= or operator!=" << std::endl; + return EXIT_FAILURE; + } + + // Exercise operator== + if (!(itr4 == itr1)) + { + std::cerr << "Error in operator= or operator==" << std::endl; + return EXIT_FAILURE; + } + + // Exercise operator<= + if (!(itr4 <= itr1)) + { + std::cerr << "Error in operator= or operator<=" << std::endl; + return EXIT_FAILURE; + } + + // Exercise operator< + if (itr4 < itr1) + { + std::cerr << "Error in operator= or operator<" << std::endl; + return EXIT_FAILURE; + } + + // Exercise operator>= + if (!(itr4 >= itr1)) + { + std::cerr << "Error in operator= or operator>=" << std::endl; + return EXIT_FAILURE; + } + + // Exercise operator> + if (itr4 > itr1) + { + std::cerr << "Error in operator= or operator>" << std::endl; + return EXIT_FAILURE; + } + + // Exercise GetImageIteratorDimension() + if (itr1.GetImageIteratorDimension() != ImageDimension) + { + std::cerr << "Error in GetImageIteratorDimension" << std::endl; + return EXIT_FAILURE; + } + + // Exercise GetIndex() + VectorImageType::IndexType index1 = itr1.GetIndex(); + if (index1 != startIndex3D) + { + std::cerr << "Error in GetIndex()" << std::endl; + return EXIT_FAILURE; + } + + // Exercise SetIndex() + VectorImageType::IndexType index2 = index1; + index2[0]++; + VectorImageIterator itr5 = itr1; + itr5.SetIndex(index2); + if (itr5.GetIndex() != index2) + { + std::cerr << "Error in GetIndex() and/or SetIndex()" << std::endl; + return EXIT_FAILURE; + } + + if (itr5.GetIndex() == itr1.GetIndex()) + { + std::cerr << "Error in GetIndex() and/or SetIndex()" << std::endl; + return EXIT_FAILURE; + } + + // Exercise GetRegion() + VectorImageType::RegionType region1 = itr1.GetRegion(); + if (region1 != region) + { + std::cerr << "Error in GetRegion()" << std::endl; + return EXIT_FAILURE; + } + + // Exercise GetImage() non-const version + VectorImageType * image1 = itr1.GetImage(); + if (image1 != o3.GetPointer()) + { + std::cerr << "Error in GetImage()" << std::endl; + return EXIT_FAILURE; + } + + // Exercise GetImage() const version + const VectorImageType * image2 = itr2.GetImage(); + if (image2 != o3.GetPointer()) + { + std::cerr << "Error in GetImage()" << std::endl; + return EXIT_FAILURE; + } + + // Exercise Get() non-const and const version + { + VectorPixelType vp1 = itr1.Get(); + VectorPixelType vp2 = itr2.Get(); + std::cout << "vp1: " << vp1 << std::endl; + std::cout << "vp2: " << vp2 << std::endl; + if (vp1 != vp2) + { + std::cerr << "Error in Get()" << std::endl; + return EXIT_FAILURE; + } + // verify that the value can be modified + vp1[0]++; + itr1.Set(vp1); + itr2 = itr1; // we need to do this because Set invalidates other itarators + vp2 = itr2.Get(); + if (vp1 != vp2) + { + std::cerr << "Error in Get() and/or Set()" << std::endl; + return EXIT_FAILURE; + } + } + + + // Exercise Value() const and non-const methods + { + VectorPixelType vp1 = itr1.Value(); + VectorPixelType vp2 = itr2.Value(); + if (vp1 != vp2) + { + std::cerr << "Error in Value()" << std::endl; + return EXIT_FAILURE; + } + // verify that the value can be modified + vp1[0]++; + itr1.Set(vp1); + vp2 = itr2.Value(); + if (vp1 != vp2) + { + std::cerr << "Error in Get() and/or Set()" << std::endl; + return EXIT_FAILURE; + } + } + + // Exercise Begin(), GoToBegin(), IsAtBegin() and IsAtEnd() + { + itr1.GoToBegin(); + if (!itr1.IsAtBegin()) + { + std::cerr << "Error in Begin() and/or IsAtBegin()" << std::endl; + return EXIT_FAILURE; + } + if (itr1.IsAtEnd()) + { + std::cerr << "Error in Begin() and/or IsAtEnd()" << std::endl; + return EXIT_FAILURE; + } + } + + + // Exercise End(), GoToEnd(), IsAtBegin() and IsAtEnd() + { + itr1.GoToEnd(); + if (!itr1.IsAtEnd()) + { + std::cerr << "Error in End() and/or IsAtEnd()" << std::endl; + return EXIT_FAILURE; + } + if (itr1.IsAtBegin()) + { + std::cerr << "Error in End() and/or IsAtBegin()" << std::endl; + return EXIT_FAILURE; + } + } + + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx new file mode 100644 index 00000000000..e7df47bb92f --- /dev/null +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx @@ -0,0 +1,400 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include + +#include "RLEImageRegionIterator.h" +#include "itkNumericTraits.h" + + +template +class itkImageIteratorWithIndexTestIteratorTester +{ + +public: + typedef TPixelType PixelType; + + typedef RLEImage ImageType; + + typedef itk::ImageRegionIteratorWithIndex IteratorType; + + typedef itk::ImageRegionConstIteratorWithIndex ConstIteratorType; + + itkImageIteratorWithIndexTestIteratorTester(const PixelType & value) + { + m_Image = ImageType::New(); + + typename ImageType::SizeType size; + size.Fill(100); + + typename ImageType::IndexType start; + start.Fill(0); + + typename ImageType::RegionType region; + region.SetSize(size); + region.SetIndex(start); + + m_Image->SetRegions(region); + m_Image->Allocate(); + + m_Image->FillBuffer(value); + } + + bool + TestIterator() + { + IteratorType it(m_Image, m_Image->GetBufferedRegion()); + it.GoToBegin(); + while (!it.IsAtEnd()) + { + PixelType value = it.Get(); + PixelType testValue = value * static_cast::ValueType>(2); + it.Set(testValue); + if (it.Get() != testValue) + { + std::cerr << "TestIterator failed!" << std::endl; + return false; + } + ++it; + } + return true; + } + + bool + TestConstIterator() + { + ConstIteratorType it(m_Image, m_Image->GetBufferedRegion()); + it.GoToBegin(); + while (!it.IsAtEnd()) + { + PixelType value = it.Get(); + if (value != it.Get()) // check repeatibility + { + std::cerr << "TestConstIterator failed!" << std::endl; + return false; + } + ++it; + } + return true; + } + + bool + TestReverseIteration() + { + ConstIteratorType it(m_Image, m_Image->GetBufferedRegion()); + it.GoToReverseBegin(); + while (!it.IsAtReverseEnd()) + { + PixelType value = it.Get(); + if (value != it.Get()) // check repeatibility + { + std::cerr << "TestReverseIteration failed!" << std::endl; + return false; + } + --it; + } + return true; + } + +private: + typename ImageType::Pointer m_Image; +}; + +int +itkImageIteratorWithIndexTest(int, char *[]) +{ + + bool testPassed = true; // let's be optimistic + + // Instantiate image of various types and + // test the iterators on them + + std::cout << "Testing with Image< char, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterC(10); + if (TesterC.TestIterator() == false) + { + testPassed = false; + } + if (TesterC.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterC.TestReverseIteration() == false) + { + testPassed = false; + } + + + std::cout << "Testing with Image< unsigned char, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterUC(10); + if (TesterUC.TestIterator() == false) + { + testPassed = false; + } + if (TesterUC.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterUC.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< short, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterS(10); + if (TesterS.TestIterator() == false) + { + testPassed = false; + } + if (TesterS.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterS.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< unsigned short, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterUS(10); + if (TesterUS.TestIterator() == false) + { + testPassed = false; + } + if (TesterUS.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterUS.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< int, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterI(10); + if (TesterI.TestIterator() == false) + { + testPassed = false; + } + if (TesterI.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterI.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< unsigned int, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterUI(10); + if (TesterUI.TestIterator() == false) + { + testPassed = false; + } + if (TesterUI.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterUI.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< float, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterF(10.0); + if (TesterF.TestIterator() == false) + { + testPassed = false; + } + if (TesterF.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterF.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< double, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterD(10.0); + if (TesterD.TestIterator() == false) + { + testPassed = false; + } + if (TesterD.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterD.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; + typedef itk::Vector VC; + VC vc; + vc.Fill(127); + itkImageIteratorWithIndexTestIteratorTester TesterVC(vc); + if (TesterVC.TestIterator() == false) + { + testPassed = false; + } + if (TesterVC.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterVC.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; + typedef itk::Vector VUC; + VUC vuc; + vuc.Fill(10); + itkImageIteratorWithIndexTestIteratorTester TesterVUC(vuc); + if (TesterVUC.TestIterator() == false) + { + testPassed = false; + } + if (TesterVUC.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterVUC.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; + typedef itk::Vector VS; + VS vs; + vs.Fill(10); + itkImageIteratorWithIndexTestIteratorTester TesterVS(vs); + if (TesterVS.TestIterator() == false) + { + testPassed = false; + } + if (TesterVS.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterVS.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; + typedef itk::Vector VUS; + VUS vus; + vus.Fill(10); + itkImageIteratorWithIndexTestIteratorTester TesterVUS(vus); + if (TesterVUS.TestIterator() == false) + { + testPassed = false; + } + if (TesterVUS.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterVUS.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; + typedef itk::Vector VI; + VI vi; + vi.Fill(10); + itkImageIteratorWithIndexTestIteratorTester TesterVI(vi); + if (TesterVI.TestIterator() == false) + { + testPassed = false; + } + if (TesterVI.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterVI.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; + typedef itk::Vector VUI; + VUI vui; + vui.Fill(10); + itkImageIteratorWithIndexTestIteratorTester TesterVUI(vui); + if (TesterVUI.TestIterator() == false) + { + testPassed = false; + } + if (TesterVUI.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterVUI.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; + typedef itk::Vector VF; + VF vf; + vf.Fill(10); + itkImageIteratorWithIndexTestIteratorTester TesterVF(vf); + if (TesterVF.TestIterator() == false) + { + testPassed = false; + } + if (TesterVF.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterVF.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; + typedef itk::Vector VD; + VD vd; + vd.Fill(10); + itkImageIteratorWithIndexTestIteratorTester TesterVD(vd); + if (TesterVD.TestIterator() == false) + { + testPassed = false; + } + if (TesterVD.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterVD.TestReverseIteration() == false) + { + testPassed = false; + } + + if (!testPassed) + { + std::cout << "Failed" << std::endl; + return EXIT_FAILURE; + } + + std::cout << "Success" << std::endl; + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx new file mode 100644 index 00000000000..aedfeb1b382 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx @@ -0,0 +1,168 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include + +#include "RLEImageRegionIterator.h" + +int +itkImageIteratorsForwardBackwardTest(int, char *[]) +{ + + std::cout << "Creating an image" << std::endl; + typedef RLEImage ImageType; + + ImageType::Pointer myImage = ImageType::New(); + + ImageType::SizeType size; + + size[0] = 4; + size[1] = 4; + size[2] = 4; + + ImageType::IndexType start; + start.Fill(0); + + ImageType::RegionType region; + region.SetIndex(start); + region.SetSize(size); + + myImage->SetLargestPossibleRegion(region); + myImage->SetBufferedRegion(region); + myImage->SetRequestedRegion(region); + myImage->Allocate(); + + typedef itk::ImageRegionIteratorWithIndex IteratorType; + + typedef itk::ImageRegionConstIteratorWithIndex ConstIteratorType; + + IteratorType it(myImage, region); + + ImageType::PixelType value; + + value = itk::NumericTraits::ZeroValue(); + + // Store information on the Image + std::cout << "Storing data on the image ... " << std::endl; + + while (!it.IsAtEnd()) + { + value++; + it.Set(value); + ++it; + } + + + // Verification + IteratorType ot(myImage, region); + std::cout << "Verifying the data forwards... "; + + value = itk::NumericTraits::ZeroValue(); + + while (!ot.IsAtEnd()) + { + value++; + + if (ot.Get() != value) + { + std::cerr << "Error in forward pass" << std::endl; + std::cerr << "Values don't correspond to what was stored " << std::endl; + std::cerr << "Test failed at index "; + std::cerr << ot.GetIndex() << std::endl; + std::cerr << "Value stored is = " << ot.Get() << std::endl; + std::cerr << "Value should be = " << value << std::endl; + return EXIT_FAILURE; + } + ++ot; + } + + std::cout << " PASSED !" << std::endl; + + // Verification + std::cout << "Verifying the data backwards... "; + + ot.GoToEnd(); + do + { + --ot; + if (ot.Get() != value) + { + std::cerr << "Error in backwards pass" << std::endl; + std::cerr << "Values don't correspond to what was stored " << std::endl; + std::cerr << "Test failed at index "; + std::cerr << ot.GetIndex() << std::endl; + std::cerr << "Value stored is = " << ot.Get() << std::endl; + std::cerr << "Value should be = " << value << std::endl; + return EXIT_FAILURE; + } + value--; + } while (!ot.IsAtBegin()); + + std::cout << " PASSED !" << std::endl; + + // Verification + ConstIteratorType cot(myImage, region); + std::cout << "Const Iterator: Verifying the data forwards... "; + + value = itk::NumericTraits::ZeroValue(); + + while (!cot.IsAtEnd()) + { + value++; + + if (cot.Get() != value) + { + std::cerr << "Error in forward pass" << std::endl; + std::cerr << "Values don't correspond to what was stored " << std::endl; + std::cerr << "Test failed at index "; + std::cerr << cot.GetIndex() << std::endl; + std::cerr << "Value stored is = " << cot.Get() << std::endl; + std::cerr << "Value should be = " << value << std::endl; + return EXIT_FAILURE; + } + ++cot; + } + + std::cout << " PASSED !" << std::endl; + + // Verification + std::cout << "Const Iterator : Verifying the data backwards... "; + + cot.GoToEnd(); + do + { + --cot; + if (cot.Get() != value) + { + std::cerr << "Error in backwards pass" << std::endl; + std::cerr << "Values don't correspond to what was stored " << std::endl; + std::cerr << "Test failed at index "; + std::cerr << cot.GetIndex() << std::endl; + std::cerr << "Value stored is = " << cot.Get() << std::endl; + std::cerr << "Value should be = " << value << std::endl; + return EXIT_FAILURE; + } + value--; + } while (!cot.IsAtBegin()); + + std::cout << " PASSED !" << std::endl; + + std::cout << std::endl << "Test passed" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx new file mode 100644 index 00000000000..a47bc7c9bd7 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx @@ -0,0 +1,231 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include + +#include "RLEImageRegionIterator.h" + +template +class itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester +{ + +public: + typedef TImage ImageType; + typedef typename ImageType::IndexType IndexType; + + typedef itk::ImageRegionConstIteratorWithOnlyIndex ConstIteratorType; + + itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester() + { + m_Image = ImageType::New(); + + typename ImageType::SizeType size; + size.Fill(100); + + typename ImageType::IndexType start; + start.Fill(0); + + typename ImageType::RegionType region; + region.SetSize(size); + region.SetIndex(start); + + m_Image->SetRegions(region); + m_Image->Allocate(); + + // Setup a smaller requested region + size.Fill(50); + // size[0] = 40; + start.Fill(10); + // start[0] = 8; + region.SetSize(size); + region.SetIndex(start); + m_Image->SetRequestedRegion(region); + } + + bool + TestConstIterator() + { + typename ImageType::RegionType region = m_Image->GetBufferedRegion(); + if (TestByRegion(region) == false) + { + std::cout << "Failed testing buffered region." << std::endl; + return false; + } + + region = m_Image->GetRequestedRegion(); + if (TestByRegion(region) == false) + { + std::cout << "Failed testing requested region." << std::endl; + return false; + } + + return true; + } + + bool + TestByRegion(typename ImageType::RegionType & region) + { + ConstIteratorType it(m_Image, region); + it.GoToBegin(); + typename ImageType::IndexValueType step = 0; + + while (!it.IsAtEnd()) + { + IndexType index = it.GetIndex(); + // Check to see if the index is within allowed bounds + bool isInside = region.IsInside(index); + if (!isInside) + { + std::cout << "Index is not inside region! - " << index << std::endl; + return false; + } + // check repeatibility + if (index != it.GetIndex()) + { + std::cout << "Failed to repeat GetIndex." << std::endl; + return false; + } + // increment and test index + ++it; + IndexType truthIndex; + truthIndex[0] = step % region.GetSize()[0] + region.GetIndex()[0]; + truthIndex[1] = step / region.GetSize()[0] + region.GetIndex()[1]; + if (ImageType::GetImageDimension() > 2) + { + truthIndex[1] = (step / region.GetSize()[0]) % region.GetSize()[1] + region.GetIndex()[1]; + truthIndex[2] = step / (region.GetSize()[0] * region.GetSize()[1]) + region.GetIndex()[2]; + } + + if (index != truthIndex) + { + std::cout << "Failed single increment. step: " << step << " index: " << index << " truthIndex: " << truthIndex + << std::endl; + return false; + } + ++step; + // check repeatibility after decrement + --it; + if (index != it.GetIndex()) + { + std::cout << "Failed to increment and decrement." << std::endl; + return false; + } + ++it; + } + + // Test iterating fwd by line + IndexType index; + it.GoToBegin(); + index = it.GetIndex(); + for (unsigned int i = 0; i < region.GetSize()[0]; i++) + { + ++it; + } + if (index[0] != it.GetIndex()[0] || index[1] != it.GetIndex()[1] - 1) + { + std::cout << "Failed iterating forward by line." << std::endl; + } + + // iterate back + for (unsigned int i = 0; i < region.GetSize()[0]; i++) + { + --it; + } + if (index != it.GetIndex()) + { + std::cout << "Failed iterating back by line." << std::endl; + } + + // Test iterating fwd by slice + if (ImageType::GetImageDimension() > 2) + { + it.GoToBegin(); + index = it.GetIndex(); + for (unsigned int i = 0; i < region.GetSize()[0] * region.GetSize()[1]; i++) + { + ++it; + } + ++it; // extra step + if (index[0] != it.GetIndex()[0] - 1 || index[1] != it.GetIndex()[1] || index[2] != it.GetIndex()[2] - 1) + { + std::cout << "Failed iterating forward by slice." << std::endl; + } + + // iterate back + for (unsigned int i = 0; i < region.GetSize()[0] * region.GetSize()[1]; i++) + { + --it; + } + --it; + if (index != it.GetIndex()) + { + std::cout << "Failed iterating back by slice." << std::endl; + } + } + + return true; + } + +private: + typename ImageType::Pointer m_Image; +}; + +int +itkImageRegionConstIteratorWithOnlyIndexTest(int, char *[]) +{ + bool testPassed = true; // let's be optimistic + + // Instantiate image of various types and + // test the iterators on them + + { + std::cout << "Testing with Image< char, 3 >... " << std::endl; + itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; + if (Tester.TestConstIterator() == false) + { + testPassed = false; + } + } + + { + std::cout << "Testing with ImageBase< 2 >... " << std::endl; + itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; + if (Tester.TestConstIterator() == false) + { + testPassed = false; + } + } + + { + std::cout << "Testing with ImageBase< 3 >... " << std::endl; + itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; + if (Tester.TestConstIterator() == false) + { + testPassed = false; + } + } + + if (!testPassed) + { + std::cout << "Failed" << std::endl; + return EXIT_FAILURE; + } + + std::cout << "Success" << std::endl; + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx new file mode 100644 index 00000000000..932eaedd773 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx @@ -0,0 +1,237 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include + +#include "RLEImageRegionIterator.h" + + +// This routine is used to make sure that we call the "const" version +// of GetPixel() (via the operator[]) +template +void +TestConstPixelAccess(const RLEImage & in, RLEImage & out) +{ + typename RLEImage::IndexType regionStartIndex3D = { { 5, 10, 15 } }; + typename RLEImage::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + + T vec; + + vec[0] = 5; + vec[1] = 4; + vec[2] = 3; + vec[3] = 2; + vec[4] = 1; + + out.SetPixel(regionStartIndex3D, vec); + out.SetPixel(regionEndIndex3D, in[regionStartIndex3D]); + // out[regionStartIndex3D] = vec; + // out[regionEndIndex3D] = in[regionStartIndex3D]; +} + + +int +itkImageRegionIteratorTest(int, char *[]) +{ + std::cout << "Creating an image" << std::endl; + RLEImage>::Pointer o3 = RLEImage>::New(); + + int status = 0; + + float origin3D[3] = { 5, 2.1, 8.1 }; + float spacing3D[3] = { 1.5, 2.1, 1 }; + + RLEImage>::SizeType imageSize3D = { { 20, 40, 60 } }; + RLEImage>::SizeType bufferSize3D = { { 20, 20, 17 } }; + RLEImage>::SizeType regionSize3D = { { 4, 6, 8 } }; + + RLEImage>::IndexType startIndex3D = { { 5, 4, 1 } }; + RLEImage>::IndexType bufferStartIndex3D = { { 5, 5, 1 } }; + RLEImage>::IndexType regionStartIndex3D = { { 5, 10, 12 } }; + RLEImage>::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + + + RLEImage>::RegionType region; + region.SetSize(imageSize3D); + region.SetIndex(startIndex3D); + o3->SetLargestPossibleRegion(region); + region.SetSize(bufferSize3D); + region.SetIndex(bufferStartIndex3D); + o3->SetBufferedRegion(region); + region.SetSize(regionSize3D); + region.SetIndex(regionStartIndex3D); + o3->SetRequestedRegion(region); + + o3->SetOrigin(origin3D); + o3->SetSpacing(spacing3D); + + o3->Allocate(); + + std::cout << "Setting/Getting a pixel" << std::endl; + itk::Vector vec; + + vec[0] = 5; + vec[1] = 4; + vec[2] = 3; + vec[3] = 2; + vec[4] = 1; + + (*o3).SetPixel(regionStartIndex3D, vec); + (*o3).SetPixel(regionEndIndex3D, (*o3)[regionStartIndex3D]); + TestConstPixelAccess(*o3, *o3); + + + itk::ImageIterator>> standardIt(o3, region); + + // Iterate over a region using a simple for loop + itk::ImageRegionIterator>> it(o3, region); + + std::cout << "Simple iterator loop: "; + for (; !it.IsAtEnd(); ++it) + { + RLEImage>::IndexType index = it.GetIndex(); + std::cout << index << std::endl; + } + + itk::ImageRegionConstIterator>> standardCIt(o3, region); + + // Iterate over a region using a simple for loop and a const iterator + itk::ImageRegionConstIterator>> cit(o3, region); + + std::cout << "Simple const iterator loop: "; + for (; !cit.IsAtEnd(); ++cit) + { + RLEImage>::IndexType index = cit.GetIndex(); + std::cout << index << std::endl; + } + + + // Iterator over the region backwards using a simple for loop + itk::ImageRegionIterator>> backIt(o3, region); + + backIt.GoToEnd(); // one pixel past the end of the region + do + { + --backIt; + + RLEImage>::IndexType index = backIt.GetIndex(); + std::cout << "Simple iterator backwards loop: "; + for (unsigned int i = 0; i < index.GetIndexDimension(); i++) + { + std::cout << index[i] << " "; + } + std::cout << std::endl; + } while (!backIt.IsAtBegin()); // stop when we reach the beginning + + // Iterate over a region, then change the region and iterate over the new region + { + // Create an image + typedef RLEImage TestImageType; + TestImageType::IndexType imageCorner; + imageCorner.Fill(0); + + TestImageType::SizeType imageSize; + imageSize.Fill(3); + + TestImageType::RegionType imageRegion(imageCorner, imageSize); + + TestImageType::Pointer image = TestImageType::New(); + image->SetRegions(imageRegion); + image->Allocate(); + + itk::ImageRegionIterator createImageIterator(image, imageRegion); + + // Set all pixels with first index == 0 to 0, and set the rest of the image to 255 + while (!createImageIterator.IsAtEnd()) + { + if (createImageIterator.GetIndex()[0] == 0) + { + createImageIterator.Set(0); + } + else + { + createImageIterator.Set(255); + } + + ++createImageIterator; + } + + // Setup and iterate over the first region + TestImageType::IndexType region1Start; + region1Start.Fill(0); + + TestImageType::SizeType regionSize; + regionSize.Fill(2); + + TestImageType::RegionType region1(region1Start, regionSize); + + itk::ImageRegionConstIterator imageIterator(image, region1); + + std::vector expectedValuesRegion1(4); + expectedValuesRegion1[0] = 0; + expectedValuesRegion1[1] = 255; + expectedValuesRegion1[2] = 0; + expectedValuesRegion1[3] = 255; + unsigned int counter = 0; + while (!imageIterator.IsAtEnd()) + { + if (imageIterator.Get() != expectedValuesRegion1[counter]) + { + status = 1; // Fail + } + counter++; + ++imageIterator; + } + + // Change iteration region + TestImageType::IndexType region2start; + region2start.Fill(1); + + TestImageType::RegionType region2(region2start, regionSize); + + imageIterator.SetRegion(region2); + imageIterator.GoToBegin(); + + std::vector expectedValuesRegion2(4); + expectedValuesRegion2[0] = 255; + expectedValuesRegion2[1] = 255; + expectedValuesRegion2[2] = 255; + expectedValuesRegion2[3] = 255; + counter = 0; + while (!imageIterator.IsAtEnd()) + { + if (imageIterator.Get() != expectedValuesRegion2[counter]) + { + status = 1; // Fail + } + counter++; + ++imageIterator; + } + + } // end "Change Region" test + + if (status == 0) + { + std::cout << "Passed" << std::endl; + } + else + { + std::cout << "Failed" << std::endl; + } + return status; +} diff --git a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx new file mode 100644 index 00000000000..8d38847d1ba --- /dev/null +++ b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx @@ -0,0 +1,236 @@ + +#include + +#include "RLEImageScanlineIterator.h" + +// This routine is used to make sure that we call the "const" version +// of GetPixel() (via the operator[]) +template +void +TestConstPixelAccess(const RLEImage & in, + RLEImage & out) +{ + typename RLEImage::IndexType regionStartIndex3D = { { 5, 10, 15 } }; + typename RLEImage::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + + TPixel vec; + + vec[0] = 5; + vec[1] = 4; + vec[2] = 3; + vec[3] = 2; + vec[4] = 1; + + out.SetPixel(regionStartIndex3D, vec); + out.SetPixel(regionEndIndex3D, in[regionStartIndex3D]); + // out[regionStartIndex3D] = vec; + // out[regionEndIndex3D] = in[regionStartIndex3D]; +} + + +int +itkImageScanlineIteratorTest1(int, char *[]) +{ + RLEImage>::Pointer o3 = RLEImage>::New(); + + int status = EXIT_SUCCESS; + + float origin3D[3] = { 5, 2.1, 8.1 }; + float spacing3D[3] = { 1.5, 2.1, 1 }; + + typedef RLEImage> ImageType; + + ImageType::SizeType imageSize3D = { { 20, 40, 60 } }; + ImageType::SizeType bufferSize3D = { { 20, 20, 14 } }; + ImageType::SizeType regionSize3D = { { 4, 6, 6 } }; + + ImageType::IndexType startIndex3D = { { 5, 4, 1 } }; + ImageType::IndexType bufferStartIndex3D = { { 5, 3, 5 } }; + ImageType::IndexType regionStartIndex3D = { { 5, 10, 12 } }; + ImageType::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + + + ImageType::RegionType region; + region.SetSize(imageSize3D); + region.SetIndex(startIndex3D); + o3->SetLargestPossibleRegion(region); + region.SetSize(bufferSize3D); + region.SetIndex(bufferStartIndex3D); + o3->SetBufferedRegion(region); + region.SetSize(regionSize3D); + region.SetIndex(regionStartIndex3D); + o3->SetRequestedRegion(region); + + o3->SetOrigin(origin3D); + o3->SetSpacing(spacing3D); + + o3->Allocate(); + + std::cout << "Setting/Getting a pixel" << std::endl; + itk::Vector vec; + + vec[0] = 5; + vec[1] = 4; + vec[2] = 3; + vec[3] = 2; + vec[4] = 1; + + (*o3).SetPixel(regionStartIndex3D, vec); + (*o3).SetPixel(regionEndIndex3D, (*o3)[regionStartIndex3D]); + TestConstPixelAccess(*o3, *o3); + + + itk::ImageIterator standardIt(o3, region); + + // Iterate over a region using a simple for loop + itk::ImageScanlineIterator it(standardIt); + + std::cout << "Simple iterator loop 1\n"; + while (!it.IsAtEnd()) + { + while (!it.IsAtEndOfLine()) + { + ++it; + } + it.NextLine(); + } + + itk::ImageScanlineIterator it2(o3, o3->GetBufferedRegion()); + std::cout << "Simple iterator loop 1bis\n"; + while (!it2.IsAtEnd()) + { + while (!it2.IsAtEndOfLine()) + { + ++it2; + } + it2.NextLine(); + } + + itk::ImageScanlineConstIterator testBeginEnd(o3, region); + testBeginEnd.GoToBeginOfLine(); + testBeginEnd.GoToEndOfLine(); + + itk::ImageScanlineConstIterator standardCIt(o3, region); + + // Iterate over a region using a simple loop and a const iterator + itk::ImageScanlineConstIterator cit(standardIt); + + std::cout << "Simple const iterator loop 2\n"; + while (!cit.IsAtEnd()) + { + while (!cit.IsAtEndOfLine()) + { + ++cit; + } + cit.NextLine(); + } + + while (!cit.IsAtEnd()) + { + cit.NextLine(); + } + + + // Iterate over a region, then change the region and iterate over the new region + { + // Create an image + typedef itk::Image TestImageType; + TestImageType::IndexType imageCorner; + imageCorner.Fill(0); + + TestImageType::SizeType imageSize; + imageSize.Fill(3); + + TestImageType::RegionType imageRegion(imageCorner, imageSize); + + TestImageType::Pointer image = TestImageType::New(); + image->SetRegions(imageRegion); + image->Allocate(); + + itk::ImageScanlineIterator createImageIterator(image, imageRegion); + + // Set all pixels with first index == 0 to 0, and set the rest of the image to 255 + while (!createImageIterator.IsAtEnd()) + { + while (!createImageIterator.IsAtEndOfLine()) + { + if (createImageIterator.GetIndex()[0] == 0) + { + createImageIterator.Set(0); + } + else + { + createImageIterator.Set(255); + } + ++createImageIterator; + } + createImageIterator.NextLine(); + } + + // Setup and iterate over the first region + TestImageType::IndexType region1Start; + region1Start.Fill(0); + + TestImageType::SizeType regionSize; + regionSize.Fill(2); + + TestImageType::RegionType region1(region1Start, regionSize); + + itk::ImageScanlineConstIterator imageIterator(image, region1); + + std::vector expectedValuesRegion1(4); + expectedValuesRegion1[0] = 0; + expectedValuesRegion1[1] = 255; + expectedValuesRegion1[2] = 0; + expectedValuesRegion1[3] = 255; + unsigned int counter = 0; + while (!imageIterator.IsAtEnd()) + { + while (!imageIterator.IsAtEndOfLine()) + { + if (imageIterator.Get() != expectedValuesRegion1[counter]) + { + status = EXIT_FAILURE; // Fail + } + counter++; + ++imageIterator; + } + imageIterator.NextLine(); + } + + // Change iteration region + TestImageType::IndexType region2start; + region2start.Fill(1); + + TestImageType::RegionType region2(region2start, regionSize); + + imageIterator.SetRegion(region2); + imageIterator.GoToBegin(); + + std::vector expectedValuesRegion2(4); + expectedValuesRegion2[0] = 255; + expectedValuesRegion2[1] = 255; + expectedValuesRegion2[2] = 255; + expectedValuesRegion2[3] = 255; + counter = 0; + while (!imageIterator.IsAtEnd()) + { + while (!imageIterator.IsAtEndOfLine()) + { + if (imageIterator.Get() != expectedValuesRegion2[counter]) + { + status = EXIT_FAILURE; // Fail + } + counter++; + ++imageIterator; + } + imageIterator.NextLine(); + } + + } // end "Change Region" test + if (status == EXIT_SUCCESS) + std::cout << "All scanline iterator tests successful!\n"; + else + std::cout << "Some scanline iterator tests failed!\n"; + return status; +} diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx new file mode 100644 index 00000000000..884a755fbef --- /dev/null +++ b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx @@ -0,0 +1,125 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include + +#include "itkImage.h" +#include "itkVector.h" +#include "RLEImageRegionIterator.h" +#include + +int +itkIteratorTests(int, char *[]) +{ + std::cout << "Creating an image" << std::endl; + typedef RLEImage ScalarImage; + ScalarImage::Pointer o3 = ScalarImage::New(); + + double origin3D[3] = { 5, 2.1, 8.1 }; + double spacing3D[3] = { 1.5, 2.1, 1 }; + + ScalarImage::SizeType imageSize3D = { { 100, 100, 100 } }; + ScalarImage::SizeType bufferSize3D = { { 100, 100, 100 } }; + ScalarImage::SizeType regionSize3D = { { 91, 93, 87 } }; + + ScalarImage::IndexType startIndex3D = { { 0, 0, 0 } }; + ScalarImage::IndexType bufferStartIndex3D = { { 0, 0, 0 } }; + ScalarImage::IndexType regionStartIndex3D = { { 5, 5, 5 } }; + + + ScalarImage::RegionType region; + region.SetSize(imageSize3D); + region.SetIndex(startIndex3D); + o3->SetLargestPossibleRegion(region); + region.SetSize(bufferSize3D); + region.SetIndex(bufferStartIndex3D); + o3->SetBufferedRegion(region); + region.SetSize(regionSize3D); + region.SetIndex(regionStartIndex3D); + o3->SetRequestedRegion(region); + + o3->SetOrigin(origin3D); + o3->SetSpacing(spacing3D); + + o3->Allocate(); + + // extra variables + double elapsedTime; + clock_t start, end; + unsigned long num = regionSize3D[0] * regionSize3D[1] * regionSize3D[2]; + unsigned long i; + bool passed = true; + + // ImageRegionIterator + start = clock(); + itk::ImageRegionIterator it(o3, region); + + unsigned short scalar; + scalar = 5; + + i = 0; + for (; !it.IsAtEnd(); ++it) + { + it.Set(scalar); + ++i; + } + end = clock(); + elapsedTime = (end - start) / (double)CLOCKS_PER_SEC; + + std::cout << "ImageRegionIterator" << std::endl; + std::cout << "\tTime = " << elapsedTime << std::endl; + std::cout << "\tPixels = " << i << std::endl; + + if (i != num) + { + passed = false; + } + + // ImageRegionIteratorWithIndex + start = clock(); + itk::ImageRegionIteratorWithIndex it2(o3, region); + + i = 0; + for (; !it2.IsAtEnd(); ++it2) + { + it2.Set(scalar); + ++i; + } + end = clock(); + elapsedTime = (end - start) / (double)CLOCKS_PER_SEC; + + std::cout << "ImageRegionIteratorWithIndex" << std::endl; + std::cout << "\tTime = " << elapsedTime << std::endl; + std::cout << "\tPixels = " << i << std::endl; + + if (i != num) + { + passed = false; + } + + if (passed) + { + std::cout << "Iterator tests passed" << std::endl; + return EXIT_SUCCESS; + } + else + { + std::cout << "Iterator tests failed" << std::endl; + return EXIT_FAILURE; + } +} diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx new file mode 100644 index 00000000000..a40bb20cae5 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx @@ -0,0 +1,138 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include +#include "RLERegionOfInterestImageFilter.h" +#include "RLEImageRegionIterator.h" +#include "itkSimpleFilterWatcher.h" + +int +itkRegionOfInterestImageFilterTest(int, char *[]) +{ + + const unsigned int Dimension = 3; + typedef itk::Index PixelType; + + typedef RLEImage ImageType; + + typedef itk::RegionOfInterestImageFilter FilterType; + + + typedef ImageType::RegionType RegionType; + typedef ImageType::SizeType SizeType; + typedef ImageType::IndexType IndexType; + typedef ImageType::DirectionType DirectionType; + + typedef itk::ImageRegionIterator IteratorType; + + FilterType::Pointer filter = FilterType::New(); + + + ImageType::Pointer image = ImageType::New(); + + IndexType start; + start.Fill(0); + + SizeType size; + size[0] = 40; + size[1] = 40; + size[2] = 40; + + RegionType region; + region.SetIndex(start); + region.SetSize(size); + + image->SetRegions(region); + image->Allocate(); + + DirectionType directions; + directions.SetIdentity(); + directions[0][0] = 0.0; + directions[1][0] = 1.0; + directions[2][0] = 0.0; + directions[0][1] = 1.0; + directions[1][1] = 0.0; + directions[2][1] = 0.0; + image->SetDirection(directions); + + // Fill the image pixels with their own index. + IteratorType intr(image, region); + intr.GoToBegin(); + while (!intr.IsAtEnd()) + { + intr.Set(intr.GetIndex()); + ++intr; + } + + + filter->SetInput(image); + + SizeType roiSize; + roiSize[0] = 20; + roiSize[1] = 20; + roiSize[2] = 20; + + IndexType roiStart; + roiStart[0] = 9; + roiStart[1] = 9; + roiStart[2] = 9; + + RegionType regionOfInterest; + regionOfInterest.SetIndex(roiStart); + regionOfInterest.SetSize(roiSize); + + // itk::SimpleFilterWatcher watcher(filter); + filter->SetRegionOfInterest(regionOfInterest); + + // filter->SetNumberOfThreads(1); + filter->Update(); + filter->GetOutput()->Print(std::cout); + + + IteratorType ot(filter->GetOutput(), filter->GetOutput()->GetLargestPossibleRegion()); + + IteratorType it(image, regionOfInterest); + + it.GoToBegin(); + ot.GoToBegin(); + + bool passed = true; + while (!it.IsAtEnd()) + { + IndexType inIndex = it.Get(); + IndexType outIndex = ot.Get(); + if (inIndex[0] != outIndex[0] || inIndex[1] != outIndex[1] || inIndex[2] != outIndex[2]) + { + std::cerr << "Test failed at pixel " << inIndex << std::endl; + std::cerr << "pixel value is " << outIndex << std::endl; + passed = false; + break; + } + + ++it; + ++ot; + } + + if (!passed) + { + return EXIT_FAILURE; + } + + std::cout << "Test PASSED !" << std::endl; + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/RLEImage/test/manualTest.cxx b/Modules/Filtering/RLEImage/test/manualTest.cxx new file mode 100644 index 00000000000..79c2fffdfed --- /dev/null +++ b/Modules/Filtering/RLEImage/test/manualTest.cxx @@ -0,0 +1,33 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#ifdef _MSC_VER +# pragma warning(disable : 4996) /* deprecation */ +#endif + +#include "itkTestDriverIncludeRequiredIOFactories.h" + +extern int +itkRLEImageTest(int argc, char * argv[]); + +int +main(int argc, char * argv[]) +{ + RegisterRequiredFactories(); + itkRLEImageTest(argc, argv); +} From 5b716bf1e2ae5525bfabf58d88527418574bcfb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 13:29:16 -0400 Subject: [PATCH 06/95] COMP: builds --- Modules/Filtering/RLEImage/include/RLEImage.h | 27 +++++++++++++------ Modules/Filtering/RLEImage/itk-module.cmake | 1 + .../Filtering/RLEImage/test/CMakeLists.txt | 8 +++--- ...{ReadWriteTest.cxx => itkRLEImageTest.cxx} | 0 4 files changed, 24 insertions(+), 12 deletions(-) rename Modules/Filtering/RLEImage/test/{ReadWriteTest.cxx => itkRLEImageTest.cxx} (100%) diff --git a/Modules/Filtering/RLEImage/include/RLEImage.h b/Modules/Filtering/RLEImage/include/RLEImage.h index 32f30db30e6..6afd69c28dd 100644 --- a/Modules/Filtering/RLEImage/include/RLEImage.h +++ b/Modules/Filtering/RLEImage/include/RLEImage.h @@ -6,17 +6,28 @@ #include #include -/** Run-Length Encoded image. - * It saves memory for label images at the expense of processing times. - * Unsuitable for ordinary images (in which case it is counterproductive). +/** Class RLEImage * - * BufferedRegion must include complete run-length lines (along X index axis). - * BufferedRegion can be smaller than LargestPossibleRegion along other axes. + * \brief Run-Length Encoded image. + * It saves memory for label images at the expense of processing times. + * Unsuitable for ordinary images (in which case it is counterproductive). * - * It is best if pixel type and counter type have the same byte size - * (for memory alignment purposes). + * \par Details + * BufferedRegion must include complete run-length lines (along X index axis). + * BufferedRegion can be smaller than LargestPossibleRegion along other axes. * - * Copied and adapted from itk::Image. + * It is best if pixel type and counter type have the same byte size + * (for memory alignment purposes). + * + * \par OnTheFlyCleanup + * Should same-valued segments be merged on the fly? + * On the fly merging usually provides better performance. Default: On. + * + * Acknowledgement: + * This work is supported by NIH grant R01 EB014346, "Continued development + * and maintenance of the ITK-SNAP 3D image segmentation software." + * + * \ingroup RLEImage */ template class RLEImage : public itk::ImageBase diff --git a/Modules/Filtering/RLEImage/itk-module.cmake b/Modules/Filtering/RLEImage/itk-module.cmake index 5426abb796c..3f4089dff66 100644 --- a/Modules/Filtering/RLEImage/itk-module.cmake +++ b/Modules/Filtering/RLEImage/itk-module.cmake @@ -10,6 +10,7 @@ itk_module( RLEImage DEPENDS ITKCommon + ITKImageGrid TEST_DEPENDS ITKIOImageBase ITKTestKernel diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index c0bb689bff5..c23886956b1 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -1,13 +1,13 @@ itk_module_test() -set(RLEImageTest ReadWriteTest.cxx) +set(RLEImageTests itkRLEImageTest.cxx) -createtestdriver( RLEImage "${RLEImage-Test_LIBRARIES}" "${RLEImageTest}" ) +createtestdriver( RLEImage "${RLEImage-Test_LIBRARIES}" "${RLEImageTests}" ) add_executable( runFromIDE manualTest.cxx - ${RLEImageTest} + ${RLEImageTests} ) target_link_libraries(runFromIDE ${RLEImage-Test_LIBRARIES}) @@ -20,7 +20,7 @@ function(ReadWriteTest ImageName Ext) --compare DATA{Input/${ImageName}.${Ext}} ${outImage} - RLEImageTest + itkRLEImageTest DATA{Input/${ImageName}.${Ext}} ${outImage} ) diff --git a/Modules/Filtering/RLEImage/test/ReadWriteTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx similarity index 100% rename from Modules/Filtering/RLEImage/test/ReadWriteTest.cxx rename to Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx From d20194153394abfbd7512e406fbe4dbaf72f6b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 14:08:08 -0400 Subject: [PATCH 07/95] ENH: Adding 2D test and putting iterator tests first --- .../Filtering/RLEImage/test/CMakeLists.txt | 34 ++++++++++--------- .../Filtering/RLEImage/test/Input/2D.png.md5 | 1 + .../RLEImage/test/itkRLEImageTest.cxx | 5 +++ 3 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 Modules/Filtering/RLEImage/test/Input/2D.png.md5 diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index c23886956b1..c2ee94d194e 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -11,6 +11,21 @@ add_executable( ) target_link_libraries(runFromIDE ${RLEImage-Test_LIBRARIES}) +add_executable( + iteratorTests + itkRegionOfInterestImageFilterTest.cxx + itkIteratorTests.cxx + itkImageIteratorsForwardBackwardTest.cxx + itkImageIteratorTest.cxx + itkImageIteratorWithIndexTest.cxx + itkImageRegionConstIteratorWithOnlyIndexTest.cxx + itkImageRegionIteratorTest.cxx + itkImageScanlineIteratorTest1.cxx + iteratorTests.cxx +) +target_link_libraries(iteratorTests ${ITK_LIBRARIES}) +itk_add_test(NAME iteratorTests COMMAND iteratorTests) + function(ReadWriteTest ImageName Ext) set(outImage "${ITK_TEST_OUTPUT_DIR}/${ImageName}.${Ext}") itk_add_test( @@ -45,9 +60,10 @@ readwritetest(ManyToMany16 nrrd) readwritetest(ManyToMany nrrd) readwritetest(GridSeg nrrd) readwritetest(GridSeg2 nrrd) -readwritetest(FaceRoI nrrd) -readwritetest(BigZ nrrd) readwritetest(FourD nrrd) +readwritetest(2D png) +readwritetest(BigZ nrrd) +readwritetest(FaceRoI nrrd) # Paul's test images readwritetest(105769moving nii.gz) @@ -56,17 +72,3 @@ readwritetest(64816L_amygdala_fin nii.gz) readwritetest(64816L_amygdala_int nii.gz) readwritetest(65239R_amygdala_fin nii.gz) readwritetest(65239R_amygdala_int nii.gz) - -add_executable( - iteratorTests - itkRegionOfInterestImageFilterTest.cxx - itkIteratorTests.cxx - itkImageIteratorsForwardBackwardTest.cxx - itkImageIteratorTest.cxx - itkImageIteratorWithIndexTest.cxx - itkImageRegionConstIteratorWithOnlyIndexTest.cxx - itkImageRegionIteratorTest.cxx - itkImageScanlineIteratorTest1.cxx - iteratorTests.cxx -) -target_link_libraries(iteratorTests ${ITK_LIBRARIES}) diff --git a/Modules/Filtering/RLEImage/test/Input/2D.png.md5 b/Modules/Filtering/RLEImage/test/Input/2D.png.md5 new file mode 100644 index 00000000000..66c3fddbad2 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/2D.png.md5 @@ -0,0 +1 @@ +e2bb9d7b5efaf7c04b4d8e005f5985f9 diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 9b18f5ccad8..f7680ce4ec3 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -91,6 +91,11 @@ itkRLEImageTest(int argc, char * argv[]) try { // unused cases are not instantiated because they greatly increase compile time + if (numDimensions == 2 && pixelType == itk::ImageIOBase::UCHAR) + { + doTest>(inputImageFileName, outputImageFileName); + return EXIT_SUCCESS; + } if (numDimensions == 3 && (pixelType == itk::ImageIOBase::SHORT || pixelType == itk::ImageIOBase::USHORT)) { doTest>(inputImageFileName, outputImageFileName); From 324b41e8bc485519809d5f6a58c090ad6c676ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 14:12:54 -0400 Subject: [PATCH 08/95] BUG: Fixing and enabling itkImageRegionIteratorTest --- Modules/Filtering/RLEImage/test/iteratorTests.cxx | 2 +- .../RLEImage/test/itkImageRegionIteratorTest.cxx | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/iteratorTests.cxx b/Modules/Filtering/RLEImage/test/iteratorTests.cxx index a1db0e2c94b..938163110a4 100644 --- a/Modules/Filtering/RLEImage/test/iteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/iteratorTests.cxx @@ -20,7 +20,7 @@ itkRegionOfInterestImageFilterTest(int argc, char * argv[]); int main(int argc, char * argv[]) { - // itkImageRegionIteratorTest(argc, argv); + itkImageRegionIteratorTest(argc, argv); itkImageScanlineIteratorTest1(argc, argv); itkIteratorTests(argc, argv); itkImageIteratorTest(argc, argv); diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx index 932eaedd773..62863724c21 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx @@ -58,7 +58,7 @@ itkImageRegionIteratorTest(int, char *[]) RLEImage>::SizeType imageSize3D = { { 20, 40, 60 } }; RLEImage>::SizeType bufferSize3D = { { 20, 20, 17 } }; - RLEImage>::SizeType regionSize3D = { { 4, 6, 8 } }; + RLEImage>::SizeType regionSize3D = { { 4, 6, 6 } }; RLEImage>::IndexType startIndex3D = { { 5, 4, 1 } }; RLEImage>::IndexType bufferStartIndex3D = { { 5, 5, 1 } }; @@ -182,11 +182,15 @@ itkImageRegionIteratorTest(int, char *[]) itk::ImageRegionConstIterator imageIterator(image, region1); - std::vector expectedValuesRegion1(4); + std::vector expectedValuesRegion1(8); expectedValuesRegion1[0] = 0; expectedValuesRegion1[1] = 255; expectedValuesRegion1[2] = 0; expectedValuesRegion1[3] = 255; + expectedValuesRegion1[4] = 0; + expectedValuesRegion1[5] = 255; + expectedValuesRegion1[6] = 0; + expectedValuesRegion1[7] = 255; unsigned int counter = 0; while (!imageIterator.IsAtEnd()) { @@ -207,11 +211,15 @@ itkImageRegionIteratorTest(int, char *[]) imageIterator.SetRegion(region2); imageIterator.GoToBegin(); - std::vector expectedValuesRegion2(4); + std::vector expectedValuesRegion2(8); expectedValuesRegion2[0] = 255; expectedValuesRegion2[1] = 255; expectedValuesRegion2[2] = 255; expectedValuesRegion2[3] = 255; + expectedValuesRegion2[4] = 255; + expectedValuesRegion2[5] = 255; + expectedValuesRegion2[6] = 255; + expectedValuesRegion2[7] = 255; counter = 0; while (!imageIterator.IsAtEnd()) { From 06ab6f0edadc3f84ee7c4cc8b04ca35c35b547dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 15:05:05 -0400 Subject: [PATCH 09/95] ENH: Putting the class into itk namespace --- .../RLEImage/include/RLEImageConstIterator.h | 20 ++++---- .../RLEImage/include/RLEImageIterator.h | 4 +- .../include/RLEImageRegionConstIterator.h | 4 +- .../RLEImage/include/RLEImageRegionIterator.h | 2 +- .../include/RLEImageScanlineIterator.h | 2 +- .../include/RLERegionOfInterestImageFilter.h | 30 +++++------ .../include/{RLEImage.h => itkRLEImage.h} | 49 ++++++++++++------ .../include/{RLEImage.txx => itkRLEImage.hxx} | 51 +++++++++++++------ .../Filtering/RLEImage/test/iteratorTests.cxx | 22 +++++++- .../RLEImage/test/itkImageIteratorTest.cxx | 22 ++++---- .../test/itkImageIteratorWithIndexTest.cxx | 2 +- .../itkImageIteratorsForwardBackwardTest.cxx | 2 +- ...geRegionConstIteratorWithOnlyIndexTest.cxx | 2 +- .../test/itkImageRegionIteratorTest.cxx | 44 ++++++++-------- .../test/itkImageScanlineIteratorTest1.cxx | 29 ++++++++--- .../RLEImage/test/itkIteratorTests.cxx | 4 +- .../RLEImage/test/itkRLEImageTest.cxx | 6 +-- .../itkRegionOfInterestImageFilterTest.cxx | 2 +- 18 files changed, 186 insertions(+), 111 deletions(-) rename Modules/Filtering/RLEImage/include/{RLEImage.h => itkRLEImage.h} (87%) rename Modules/Filtering/RLEImage/include/{RLEImage.txx => itkRLEImage.hxx} (86%) diff --git a/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h index 49ad4d261a1..d5c7de5376b 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h @@ -4,7 +4,7 @@ #include "itkImage.h" #include "itkIndex.h" #include "itkNumericTraits.h" -#include "RLEImage.h" +#include "itkRLEImage.h" #include "itkImageConstIterator.h" #include "itkImageConstIteratorWithIndex.h" #include "itkImageConstIteratorWithOnlyIndex.h" @@ -37,7 +37,7 @@ class ImageConstIterator> itkTypeMacroNoParent(ImageConstIterator); /** Image typedef support. */ - typedef RLEImage ImageType; + typedef itk::RLEImage ImageType; /** Run-Length Line (we iterate along it). */ typedef typename ImageType::RLLine RLLine; @@ -72,7 +72,7 @@ class ImageConstIterator> /** Default Constructor. Need to provide a default constructor since we * provide a copy constructor. */ ImageConstIterator() - : myBuffer(0) + : m_Buffer(0) , rlLine(0) { m_Image = ITK_NULLPTR; @@ -89,7 +89,7 @@ class ImageConstIterator> /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageConstIterator(const Self & it) - : myBuffer(const_cast(it.GetImage())->GetBuffer()) + : m_Buffer(const_cast(it.GetImage())->GetBuffer()) { rlLine = it.rlLine; m_Image = it.m_Image; // copy the smart pointer @@ -105,7 +105,7 @@ class ImageConstIterator> /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ ImageConstIterator(const ImageType * ptr, const RegionType & region) - : myBuffer(const_cast(ptr)->GetBuffer()) + : m_Buffer(const_cast(ptr)->GetBuffer()) { m_Image = ptr; SetRegion(region); @@ -118,7 +118,7 @@ class ImageConstIterator> { if (this != &it) { - myBuffer = it.myBuffer; + m_Buffer = it.m_Buffer; rlLine = it.rlLine; m_Image = it.m_Image; // copy the smart pointer m_Index0 = it.m_Index0; @@ -145,7 +145,7 @@ class ImageConstIterator> "Region " << region << " is outside of buffered region " << bufferedRegion); } - bi = BufferIterator(myBuffer, ImageType::truncateRegion(region)); + bi = BufferIterator(m_Buffer, ImageType::truncateRegion(region)); m_Index0 = region.GetIndex(0); m_BeginIndex0 = m_Index0 - m_Image->GetBufferedRegion().GetIndex(0); m_EndIndex0 = m_BeginIndex0 + region.GetSize(0); @@ -355,7 +355,7 @@ class ImageConstIterator> IndexValueType m_EndIndex0; // index to one pixel past last pixel in region in relation to buffer start BufferIterator bi; // iterator over internal buffer image - typename BufferType::Pointer myBuffer; + typename BufferType::Pointer m_Buffer; }; template @@ -365,7 +365,7 @@ class ImageConstIteratorWithIndex // just inherit constructors public: /** Image typedef support. */ - typedef RLEImage ImageType; + typedef itk::RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; @@ -410,7 +410,7 @@ class ImageConstIteratorWithOnlyIndex ImageType; + typedef itk::RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; diff --git a/Modules/Filtering/RLEImage/include/RLEImageIterator.h b/Modules/Filtering/RLEImage/include/RLEImageIterator.h index d7d60026237..9a4d088c7cb 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageIterator.h @@ -85,7 +85,7 @@ class ImageIterator> // * we would isolate this pixel into its own segment. */ // PixelType & Value(void) //{ - // return myBuffer[m_Index[2]][m_Index[1]][realIndex].second; + // return m_Buffer[m_Index[2]][m_Index[1]][realIndex].second; //} /** Get the image that this iterator walks. */ @@ -116,7 +116,7 @@ class ImageIteratorWithIndex> : public ImageConstIteratorWithIndex> { public: - typedef RLEImage ImageType; + typedef itk::RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; diff --git a/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h index 88951b7f386..49840cb9f6b 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h @@ -150,7 +150,7 @@ class ImageRegionConstIteratorWithIndex> { public: - typedef RLEImage ImageType; + typedef itk::RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; @@ -199,7 +199,7 @@ class ImageRegionConstIteratorWithOnlyIndex ImageType; + typedef itk::RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; diff --git a/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h index 4280e5df047..d3e89ff7bc1 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h @@ -91,7 +91,7 @@ class ImageRegionIteratorWithIndex> { public: - typedef RLEImage ImageType; + typedef itk::RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; diff --git a/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h index d0fabe33d38..8178712f46c 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h @@ -65,7 +65,7 @@ class ImageScanlineIterator> //* data, but it will NOT support ImageAdaptors. */ // PixelType & Value(void) //{ - // return myBuffer[m_Index[2]][m_Index[1]][realIndex].second; + // return m_Buffer[m_Index[2]][m_Index[1]][realIndex].second; //} protected: diff --git a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h index 5a4c6d12cf3..ee509a4aa22 100644 --- a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h @@ -4,7 +4,7 @@ #include "itkImageToImageFilter.h" #include "itkSmartPointer.h" #include "itkRegionOfInterestImageFilter.h" -#include "RLEImage.h" +#include "itkRLEImage.h" namespace itk { @@ -117,13 +117,13 @@ class RegionOfInterestImageFilter, RLEImage RLEImageType; - typedef Image ImageType; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; - typedef typename Superclass::InputImageRegionType InputImageRegionType; + typedef RegionOfInterestImageFilter Self; + typedef itk::RLEImage RLEImageType; + typedef Image ImageType; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + typedef typename Superclass::InputImageRegionType InputImageRegionType; /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -204,13 +204,13 @@ class RegionOfInterestImageFilter { public: /** Standard class typedefs. */ - typedef RegionOfInterestImageFilter Self; - typedef RLEImage RLEImageType; - typedef Image ImageType; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; - typedef typename Superclass::InputImageRegionType InputImageRegionType; + typedef RegionOfInterestImageFilter Self; + typedef itk::RLEImage RLEImageType; + typedef Image ImageType; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + typedef typename Superclass::InputImageRegionType InputImageRegionType; /** Method for creation through the object factory. */ itkNewMacro(Self); diff --git a/Modules/Filtering/RLEImage/include/RLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h similarity index 87% rename from Modules/Filtering/RLEImage/include/RLEImage.h rename to Modules/Filtering/RLEImage/include/itkRLEImage.h index 6afd69c28dd..65a359d083b 100644 --- a/Modules/Filtering/RLEImage/include/RLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -1,12 +1,31 @@ -#ifndef RLEImage_h -#define RLEImage_h +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkRLEImage_h +#define itkRLEImage_h #include //std::pair #include #include #include -/** Class RLEImage +namespace itk +{ +/** \class RLEImage * * \brief Run-Length Encoded image. * It saves memory for label images at the expense of processing times. @@ -27,7 +46,7 @@ * This work is supported by NIH grant R01 EB014346, "Continued development * and maintenance of the ITK-SNAP 3D image segmentation software." * - * \ingroup RLEImage + * \ingroup RLEImage */ template class RLEImage : public itk::ImageBase @@ -119,7 +138,7 @@ class RLEImage : public itk::ImageBase // Call the superclass which should initialize the BufferedRegion ivar. Superclass::Initialize(); m_OnTheFlyCleanup = true; - myBuffer = BufferType::New(); + m_Buffer = BufferType::New(); } /** Fill the image buffer with a value. Be sure to call Allocate() @@ -131,21 +150,21 @@ class RLEImage : public itk::ImageBase SetLargestPossibleRegion(const RegionType & region) { Superclass::SetLargestPossibleRegion(region); - myBuffer->SetLargestPossibleRegion(truncateRegion(region)); + m_Buffer->SetLargestPossibleRegion(truncateRegion(region)); } virtual void SetBufferedRegion(const RegionType & region) { Superclass::SetBufferedRegion(region); - myBuffer->SetBufferedRegion(truncateRegion(region)); + m_Buffer->SetBufferedRegion(truncateRegion(region)); } virtual void SetRequestedRegion(const RegionType & region) { Superclass::SetRequestedRegion(region); - myBuffer->SetRequestedRegion(truncateRegion(region)); + m_Buffer->SetRequestedRegion(truncateRegion(region)); } /** \brief Set a pixel value. @@ -200,14 +219,14 @@ class RLEImage : public itk::ImageBase typename BufferType::Pointer GetBuffer() { - return myBuffer; + return m_Buffer; } /** We need to allow itk-style const iterators to be constructed. */ typename BufferType::Pointer GetBuffer() const { - return myBuffer; + return m_Buffer; } /** Returns N-1-dimensional index, the remainder after 0-index is removed. */ @@ -253,7 +272,7 @@ class RLEImage : public itk::ImageBase : itk::ImageBase() { m_OnTheFlyCleanup = true; - myBuffer = BufferType::New(); + m_Buffer = BufferType::New(); } void PrintSelf(std::ostream & os, itk::Indent indent) const; @@ -283,12 +302,12 @@ class RLEImage : public itk::ImageBase operator=(const Self &); // purposely not implemented /** Memory for the current buffer. */ - mutable typename BufferType::Pointer myBuffer; + mutable typename BufferType::Pointer m_Buffer; }; - +} // namespace itk #ifndef ITK_MANUAL_INSTANTIATION -# include "RLEImage.txx" +# include "itkRLEImage.hxx" #endif -#endif // RLEImage_h +#endif // itkRLEImage_h diff --git a/Modules/Filtering/RLEImage/include/RLEImage.txx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx similarity index 86% rename from Modules/Filtering/RLEImage/include/RLEImage.txx rename to Modules/Filtering/RLEImage/include/itkRLEImage.hxx index 80e1b7f9509..a2ceb2b0262 100644 --- a/Modules/Filtering/RLEImage/include/RLEImage.txx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -1,9 +1,29 @@ -#ifndef RLEImage_txx -#define RLEImage_txx +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkRLEImage_hxx +#define itkRLEImage_hxx -#include "RLEImage.h" +#include "itkRLEImage.h" #include "itkImageRegionConstIterator.h" + +namespace itk +{ template inline typename RLEImage::BufferType::IndexType RLEImage::truncateIndex(const IndexType & index) @@ -44,13 +64,13 @@ RLEImage::Allocate(bool initialize) "CounterType is not large enough to support image's X dimension!"); this->ComputeOffsetTable(); // SizeValueType num = static_cast(this->GetOffsetTable()[VImageDimension]); - myBuffer->Allocate(false); + m_Buffer->Allocate(false); // if (initialize) //there is assumption that the image is fully formed after a call to allocate { RLSegment segment(CounterType(this->GetBufferedRegion().GetSize(0)), TPixel()); RLLine line(1); line[0] = segment; - myBuffer->FillBuffer(line); + m_Buffer->FillBuffer(line); } } @@ -61,7 +81,7 @@ RLEImage::FillBuffer(const TPixel & value) RLSegment segment(CounterType(this->GetBufferedRegion().GetSize(0)), value); RLLine line(1); line[0] = segment; - myBuffer->FillBuffer(line); + m_Buffer->FillBuffer(line); } template @@ -84,13 +104,13 @@ template void RLEImage::CleanUp() const { - assert(!myBuffer.empty()); + assert(!m_Buffer.empty()); if (this->GetLargestPossibleRegion().GetSize(0) == 0) return; #pragma omp parallel for - for (CounterType z = 0; z < myBuffer.size(); z++) - for (CounterType y = 0; y < myBuffer[0].size(); y++) - CleanUpLine(myBuffer[z][y]); + for (CounterType z = 0; z < m_Buffer.size(); z++) + for (CounterType y = 0; y < m_Buffer[0].size(); y++) + CleanUpLine(m_Buffer[z][y]); } template @@ -194,7 +214,7 @@ RLEImage::SetPixel(const IndexType & index "BufferedRegion must contain complete run-length lines!"); IndexValueType bri0 = this->GetBufferedRegion().GetIndex(0); typename BufferType::IndexType bi = truncateIndex(index); - RLLine & line = myBuffer->GetPixel(bi); + RLLine & line = m_Buffer->GetPixel(bi); IndexValueType t = 0; for (IndexValueType x = 0; x < line.size(); x++) { @@ -218,7 +238,7 @@ RLEImage::GetPixel(const IndexType & index "BufferedRegion must contain complete run-length lines!"); IndexValueType bri0 = this->GetBufferedRegion().GetIndex(0); typename BufferType::IndexType bi = truncateIndex(index); - RLLine & line = myBuffer->GetPixel(bi); + RLLine & line = m_Buffer->GetPixel(bi); IndexValueType t = 0; for (IndexValueType x = 0; x < line.size(); x++) { @@ -235,10 +255,10 @@ RLEImage::PrintSelf(std::ostream & os, itk { Superclass::PrintSelf(os, indent); os << indent << "Internal image (for storage of RLLine-s): " << std::endl; - myBuffer->Print(os, indent.GetNextIndent()); + m_Buffer->Print(os, indent.GetNextIndent()); itk::SizeValueType c = 0; - itk::ImageRegionConstIterator it(myBuffer, myBuffer->GetBufferedRegion()); + itk::ImageRegionConstIterator it(m_Buffer, m_Buffer->GetBufferedRegion()); while (!it.IsAtEnd()) { c += it.Get().capacity(); @@ -257,4 +277,5 @@ RLEImage::PrintSelf(std::ostream & os, itk os.precision(prec); } -#endif // RLEImage_txx +} // end namespace itk +#endif // itkRLEImage_hxx diff --git a/Modules/Filtering/RLEImage/test/iteratorTests.cxx b/Modules/Filtering/RLEImage/test/iteratorTests.cxx index 938163110a4..a21c7e31a4d 100644 --- a/Modules/Filtering/RLEImage/test/iteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/iteratorTests.cxx @@ -1,3 +1,21 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + #include "RLEImageScanlineIterator.h" extern int @@ -28,6 +46,6 @@ main(int argc, char * argv[]) itkImageIteratorWithIndexTest(argc, argv); itkImageRegionConstIteratorWithOnlyIndexTest(argc, argv); itkRegionOfInterestImageFilterTest(argc, argv); - typedef RLEImage charred2dType; // test size 256 - typedef RLEImage charred4dType; // test size 65536 + typedef itk::RLEImage charred2dType; // test size 256 + typedef itk::RLEImage charred4dType; // test size 65536 } diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx index dbef253061e..ce753e73290 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx @@ -17,7 +17,7 @@ *=========================================================================*/ #include -#include "RLEImage.h" +#include "itkRLEImage.h" #include "RLEImageRegionIterator.h" @@ -25,10 +25,10 @@ // of GetPixel() (via the operator[]) template void -TestConstPixelAccess(const RLEImage & in, RLEImage & out) +TestConstPixelAccess(const itk::RLEImage & in, itk::RLEImage & out) { - typename RLEImage::IndexType regionStartIndex3D = { { 5, 10, 15 } }; - typename RLEImage::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + typename itk::RLEImage::IndexType regionStartIndex3D = { { 5, 10, 15 } }; + typename itk::RLEImage::IndexType regionEndIndex3D = { { 8, 15, 17 } }; T vec; @@ -49,19 +49,19 @@ itkImageIteratorTest(int, char *[]) const unsigned int ImageDimension = 3; std::cout << "Creating an image" << std::endl; - RLEImage>::Pointer o3 = RLEImage>::New(); + itk::RLEImage>::Pointer o3 = itk::RLEImage>::New(); float origin3D[ImageDimension] = { 5, 2.1, 8.1 }; float spacing3D[ImageDimension] = { 1.5, 2.1, 1 }; - RLEImage>::SizeType imageSize3D = { { 20, 40, 60 } }; + itk::RLEImage>::SizeType imageSize3D = { { 20, 40, 60 } }; - RLEImage>::IndexType startIndex3D = { { 5, 4, 1 } }; - RLEImage>::IndexType regionStartIndex3D = { { 6, 10, 12 } }; - RLEImage>::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + itk::RLEImage>::IndexType startIndex3D = { { 5, 4, 1 } }; + itk::RLEImage>::IndexType regionStartIndex3D = { { 6, 10, 12 } }; + itk::RLEImage>::IndexType regionEndIndex3D = { { 8, 15, 17 } }; - RLEImage>::RegionType region; + itk::RLEImage>::RegionType region; region.SetSize(imageSize3D); region.SetIndex(startIndex3D); o3->SetRegions(region); @@ -87,7 +87,7 @@ itkImageIteratorTest(int, char *[]) TestConstPixelAccess(*o3, *o3); typedef itk::Vector VectorPixelType; - typedef RLEImage VectorImageType; + typedef itk::RLEImage VectorImageType; typedef itk::ImageIterator VectorImageIterator; typedef itk::ImageConstIterator VectorImageConstIterator; diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx index e7df47bb92f..420b795899a 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx @@ -29,7 +29,7 @@ class itkImageIteratorWithIndexTestIteratorTester public: typedef TPixelType PixelType; - typedef RLEImage ImageType; + typedef itk::RLEImage ImageType; typedef itk::ImageRegionIteratorWithIndex IteratorType; diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx index aedfeb1b382..49e05d4d8ae 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx @@ -25,7 +25,7 @@ itkImageIteratorsForwardBackwardTest(int, char *[]) { std::cout << "Creating an image" << std::endl; - typedef RLEImage ImageType; + typedef itk::RLEImage ImageType; ImageType::Pointer myImage = ImageType::New(); diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx index a47bc7c9bd7..e745a2e2ea9 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx @@ -195,7 +195,7 @@ itkImageRegionConstIteratorWithOnlyIndexTest(int, char *[]) { std::cout << "Testing with Image< char, 3 >... " << std::endl; - itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; + itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; if (Tester.TestConstIterator() == false) { testPassed = false; diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx index 62863724c21..d70bf3793e4 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx @@ -25,10 +25,10 @@ // of GetPixel() (via the operator[]) template void -TestConstPixelAccess(const RLEImage & in, RLEImage & out) +TestConstPixelAccess(const itk::RLEImage & in, itk::RLEImage & out) { - typename RLEImage::IndexType regionStartIndex3D = { { 5, 10, 15 } }; - typename RLEImage::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + typename itk::RLEImage::IndexType regionStartIndex3D = { { 5, 10, 15 } }; + typename itk::RLEImage::IndexType regionEndIndex3D = { { 8, 15, 17 } }; T vec; @@ -49,24 +49,24 @@ int itkImageRegionIteratorTest(int, char *[]) { std::cout << "Creating an image" << std::endl; - RLEImage>::Pointer o3 = RLEImage>::New(); + itk::RLEImage>::Pointer o3 = itk::RLEImage>::New(); int status = 0; float origin3D[3] = { 5, 2.1, 8.1 }; float spacing3D[3] = { 1.5, 2.1, 1 }; - RLEImage>::SizeType imageSize3D = { { 20, 40, 60 } }; - RLEImage>::SizeType bufferSize3D = { { 20, 20, 17 } }; - RLEImage>::SizeType regionSize3D = { { 4, 6, 6 } }; + itk::RLEImage>::SizeType imageSize3D = { { 20, 40, 60 } }; + itk::RLEImage>::SizeType bufferSize3D = { { 20, 20, 17 } }; + itk::RLEImage>::SizeType regionSize3D = { { 4, 6, 6 } }; - RLEImage>::IndexType startIndex3D = { { 5, 4, 1 } }; - RLEImage>::IndexType bufferStartIndex3D = { { 5, 5, 1 } }; - RLEImage>::IndexType regionStartIndex3D = { { 5, 10, 12 } }; - RLEImage>::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + itk::RLEImage>::IndexType startIndex3D = { { 5, 4, 1 } }; + itk::RLEImage>::IndexType bufferStartIndex3D = { { 5, 5, 1 } }; + itk::RLEImage>::IndexType regionStartIndex3D = { { 5, 10, 12 } }; + itk::RLEImage>::IndexType regionEndIndex3D = { { 8, 15, 17 } }; - RLEImage>::RegionType region; + itk::RLEImage>::RegionType region; region.SetSize(imageSize3D); region.SetIndex(startIndex3D); o3->SetLargestPossibleRegion(region); @@ -96,40 +96,40 @@ itkImageRegionIteratorTest(int, char *[]) TestConstPixelAccess(*o3, *o3); - itk::ImageIterator>> standardIt(o3, region); + itk::ImageIterator>> standardIt(o3, region); // Iterate over a region using a simple for loop - itk::ImageRegionIterator>> it(o3, region); + itk::ImageRegionIterator>> it(o3, region); std::cout << "Simple iterator loop: "; for (; !it.IsAtEnd(); ++it) { - RLEImage>::IndexType index = it.GetIndex(); + itk::RLEImage>::IndexType index = it.GetIndex(); std::cout << index << std::endl; } - itk::ImageRegionConstIterator>> standardCIt(o3, region); + itk::ImageRegionConstIterator>> standardCIt(o3, region); // Iterate over a region using a simple for loop and a const iterator - itk::ImageRegionConstIterator>> cit(o3, region); + itk::ImageRegionConstIterator>> cit(o3, region); std::cout << "Simple const iterator loop: "; for (; !cit.IsAtEnd(); ++cit) { - RLEImage>::IndexType index = cit.GetIndex(); + itk::RLEImage>::IndexType index = cit.GetIndex(); std::cout << index << std::endl; } // Iterator over the region backwards using a simple for loop - itk::ImageRegionIterator>> backIt(o3, region); + itk::ImageRegionIterator>> backIt(o3, region); backIt.GoToEnd(); // one pixel past the end of the region do { --backIt; - RLEImage>::IndexType index = backIt.GetIndex(); + itk::RLEImage>::IndexType index = backIt.GetIndex(); std::cout << "Simple iterator backwards loop: "; for (unsigned int i = 0; i < index.GetIndexDimension(); i++) { @@ -141,8 +141,8 @@ itkImageRegionIteratorTest(int, char *[]) // Iterate over a region, then change the region and iterate over the new region { // Create an image - typedef RLEImage TestImageType; - TestImageType::IndexType imageCorner; + typedef itk::RLEImage TestImageType; + TestImageType::IndexType imageCorner; imageCorner.Fill(0); TestImageType::SizeType imageSize; diff --git a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx index 8d38847d1ba..144f7d94452 100644 --- a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx @@ -1,3 +1,20 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ #include @@ -7,11 +24,11 @@ // of GetPixel() (via the operator[]) template void -TestConstPixelAccess(const RLEImage & in, - RLEImage & out) +TestConstPixelAccess(const itk::RLEImage & in, + itk::RLEImage & out) { - typename RLEImage::IndexType regionStartIndex3D = { { 5, 10, 15 } }; - typename RLEImage::IndexType regionEndIndex3D = { { 8, 15, 17 } }; + typename itk::RLEImage::IndexType regionStartIndex3D = { { 5, 10, 15 } }; + typename itk::RLEImage::IndexType regionEndIndex3D = { { 8, 15, 17 } }; TPixel vec; @@ -31,14 +48,14 @@ TestConstPixelAccess(const RLEImage & in, int itkImageScanlineIteratorTest1(int, char *[]) { - RLEImage>::Pointer o3 = RLEImage>::New(); + itk::RLEImage>::Pointer o3 = itk::RLEImage>::New(); int status = EXIT_SUCCESS; float origin3D[3] = { 5, 2.1, 8.1 }; float spacing3D[3] = { 1.5, 2.1, 1 }; - typedef RLEImage> ImageType; + typedef itk::RLEImage> ImageType; ImageType::SizeType imageSize3D = { { 20, 40, 60 } }; ImageType::SizeType bufferSize3D = { { 20, 20, 14 } }; diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx index 884a755fbef..ea278c9787c 100644 --- a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx @@ -27,8 +27,8 @@ int itkIteratorTests(int, char *[]) { std::cout << "Creating an image" << std::endl; - typedef RLEImage ScalarImage; - ScalarImage::Pointer o3 = ScalarImage::New(); + typedef itk::RLEImage ScalarImage; + ScalarImage::Pointer o3 = ScalarImage::New(); double origin3D[3] = { 5, 2.1, 8.1 }; double spacing3D[3] = { 1.5, 2.1, 1 }; diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index f7680ce4ec3..6fae8b8214b 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -33,9 +33,9 @@ doTest(std::string inFilename, std::string outFilename) reader->SetFileName(inFilename); reader->Update(); - typedef RLEImage myRLEImage; - typedef itk::RegionOfInterestImageFilter inConverterType; - typename inConverterType::Pointer inConv = inConverterType::New(); + typedef itk::RLEImage myRLEImage; + typedef itk::RegionOfInterestImageFilter inConverterType; + typename inConverterType::Pointer inConv = inConverterType::New(); inConv->SetInput(reader->GetOutput()); inConv->SetRegionOfInterest(reader->GetOutput()->GetLargestPossibleRegion()); inConv->Update(); diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx index a40bb20cae5..30fcc5990cb 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx @@ -28,7 +28,7 @@ itkRegionOfInterestImageFilterTest(int, char *[]) const unsigned int Dimension = 3; typedef itk::Index PixelType; - typedef RLEImage ImageType; + typedef itk::RLEImage ImageType; typedef itk::RegionOfInterestImageFilter FilterType; From 0f219b16f0f0dc3c835a2692eed294bd20bc80aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 15:22:39 -0400 Subject: [PATCH 10/95] DOC: Passing KWStyle test and InDoxygenGroup tests --- .../Filtering/RLEImage/include/RLEImageConstIterator.h | 5 ++++- Modules/Filtering/RLEImage/include/RLEImageIterator.h | 6 +++--- .../RLEImage/include/RLEImageRegionConstIterator.h | 7 +++++-- .../Filtering/RLEImage/include/RLEImageRegionIterator.h | 4 ++++ .../RLEImage/include/RLEImageScanlineConstIterator.h | 8 +++++--- .../RLEImage/include/RLEImageScanlineIterator.h | 8 +++++--- .../RLEImage/include/RLERegionOfInterestImageFilter.h | 9 +++++++-- 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h index d5c7de5376b..65970439d48 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h @@ -15,7 +15,10 @@ class MultiLabelMeshPipeline; namespace itk { /** \class ImageConstIterator - * \brief A multi-dimensional image iterator templated over image type. + * \brief A multi-dimensional image iterator templated over image type. + * Specialized for RLEImage. + * \ingroup RLEImage + * \ingroup ITKCommon */ template diff --git a/Modules/Filtering/RLEImage/include/RLEImageIterator.h b/Modules/Filtering/RLEImage/include/RLEImageIterator.h index 9a4d088c7cb..672eaa9dd6f 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageIterator.h @@ -10,9 +10,9 @@ namespace itk * \class ImageIterator * \brief A multi-dimensional iterator templated over image type. * - * This is a base class of ImageConstIterator that adds write-access - * functionality. Please see ImageConstIterator for more information. - * + * Read-write access. Specialized for RLEImage. + * \ingroup RLEImage + * \ingroup ITKCommon */ template diff --git a/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h index 49840cb9f6b..188f526e874 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h @@ -14,9 +14,12 @@ namespace itk * \brief A multi-dimensional iterator templated over image type that walks a * region of pixels. * - * ImageRegionConstIterator provides read-only access to image data. It is the - * base class for the read/write access ImageRegionIterator. + * ImageRegionConstIterator provides read-only access to image data. + * It is the base class for the read/write access ImageRegionIterator. + * Specialized for RLEImage. * + * \ingroup RLEImage + * \ingroup ITKCommon */ template class ImageRegionConstIterator> diff --git a/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h index d3e89ff7bc1..0b6152f35c7 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageRegionIterator.h @@ -23,6 +23,10 @@ namespace itk * * Most of the functionality is inherited from the ImageRegionConstIterator. * The current class only adds write access to image pixels. + * Specialized for RLEImage. + * + * \ingroup RLEImage + * \ingroup ITKCommon */ template diff --git a/Modules/Filtering/RLEImage/include/RLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/RLEImageScanlineConstIterator.h index 7bd59ec774f..355de3d5501 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageScanlineConstIterator.h @@ -7,9 +7,11 @@ namespace itk { /** \class ImageScanlineConstIterator - * \brief A multi-dimensional iterator templated over image type that walks a - * region of pixels, scanline by scanline or in the direction of the - * fastest axis. + * \brief A multi-dimensional iterator templated over image type that + * walks a region of pixels, scanline by scanline or in the direction + * of the fastest axis. Specialized for RLEImage. + * \ingroup RLEImage + * \ingroup ITKCommon */ template class ImageScanlineConstIterator> diff --git a/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h index 8178712f46c..1d803c4cef3 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h @@ -8,9 +8,11 @@ namespace itk { /** \class ImageScanlineIterator - * \brief A multi-dimensional iterator templated over image type that walks a - * region of pixels, scanline by scanline or in the direction of the - * fastest axis. + * \brief A multi-dimensional iterator templated over image type that + * walks a region of pixels, scanline by scanline or in the direction + * of the fastest axis. Read-write access. Specialized for RLEImage. + * \ingroup RLEImage + * \ingroup ITKCommon */ template class ImageScanlineIterator> diff --git a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h index ee509a4aa22..f0944e45c33 100644 --- a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h @@ -9,8 +9,8 @@ namespace itk { /** \class RegionOfInterestImageFilter - * \brief Extract a region of interest from the input image - * or convert between itk::Image and RLEImage (a custom region can be used). + * \brief Extract a region of interest from the input image or convert + * between itk::Image and itk::RLEImage (a custom region can be used). * * This filter produces an output image of the same dimension as the input * image. The user specifies the region of the input image that will be @@ -21,6 +21,11 @@ namespace itk * will return an identity transform. * * The region to extract is set using the method SetRegionOfInterest. + * + * Specialized for RLEImage. + * + * \ingroup RLEImage + * \ingroup ITKCommon */ template class RegionOfInterestImageFilter, From da11fa527a6eaa4297fc6611e215ccba8405a100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 15:26:48 -0400 Subject: [PATCH 11/95] STYLE: File renames (adding itk prefix) --- ...ImageConstIterator.h => itkRLEImageConstIterator.h} | 6 +++--- .../{RLEImageIterator.h => itkRLEImageIterator.h} | 8 ++++---- ...onstIterator.h => itkRLEImageRegionConstIterator.h} | 8 ++++---- ...ageRegionIterator.h => itkRLEImageRegionIterator.h} | 10 +++++----- ...stIterator.h => itkRLEImageScanlineConstIterator.h} | 8 ++++---- ...canlineIterator.h => itkRLEImageScanlineIterator.h} | 10 +++++----- ...ageFilter.h => itkRLERegionOfInterestImageFilter.h} | 8 ++++---- ...ilter.txx => itkRLERegionOfInterestImageFilter.hxx} | 8 +++++--- Modules/Filtering/RLEImage/test/iteratorTests.cxx | 2 +- .../Filtering/RLEImage/test/itkImageIteratorTest.cxx | 2 +- .../itkImageRegionConstIteratorWithOnlyIndexTest.cxx | 2 +- .../RLEImage/test/itkImageScanlineIteratorTest1.cxx | 2 +- Modules/Filtering/RLEImage/test/itkIteratorTests.cxx | 2 +- Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 6 +++--- .../test/itkRegionOfInterestImageFilterTest.cxx | 4 ++-- 15 files changed, 44 insertions(+), 42 deletions(-) rename Modules/Filtering/RLEImage/include/{RLEImageConstIterator.h => itkRLEImageConstIterator.h} (99%) rename Modules/Filtering/RLEImage/include/{RLEImageIterator.h => itkRLEImageIterator.h} (97%) rename Modules/Filtering/RLEImage/include/{RLEImageRegionConstIterator.h => itkRLEImageRegionConstIterator.h} (98%) rename Modules/Filtering/RLEImage/include/{RLEImageRegionIterator.h => itkRLEImageRegionIterator.h} (97%) rename Modules/Filtering/RLEImage/include/{RLEImageScanlineConstIterator.h => itkRLEImageScanlineConstIterator.h} (96%) rename Modules/Filtering/RLEImage/include/{RLEImageScanlineIterator.h => itkRLEImageScanlineIterator.h} (94%) rename Modules/Filtering/RLEImage/include/{RLERegionOfInterestImageFilter.h => itkRLERegionOfInterestImageFilter.h} (98%) rename Modules/Filtering/RLEImage/include/{RLERegionOfInterestImageFilter.txx => itkRLERegionOfInterestImageFilter.hxx} (99%) diff --git a/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h similarity index 99% rename from Modules/Filtering/RLEImage/include/RLEImageConstIterator.h rename to Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 65970439d48..52fe6fbc3e1 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -1,5 +1,5 @@ -#ifndef RLEImageConstIterator_h -#define RLEImageConstIterator_h +#ifndef itkRLEImageConstIterator_h +#define itkRLEImageConstIterator_h #include "itkImage.h" #include "itkIndex.h" @@ -440,4 +440,4 @@ class ImageConstIteratorWithOnlyIndex> }; // no additional implementation required } // end namespace itk -#endif // RLEImageIterator_h +#endif // itkRLEImageIterator_h diff --git a/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h similarity index 98% rename from Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h rename to Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index 188f526e874..17ae9ce6734 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -1,7 +1,7 @@ -#ifndef RLEImageRegionConstIterator_h -#define RLEImageRegionConstIterator_h +#ifndef itkRLEImageRegionConstIterator_h +#define itkRLEImageRegionConstIterator_h -#include "RLEImageConstIterator.h" +#include "itkRLEImageConstIterator.h" #include "itkImageRegionConstIterator.h" #include "itkImageRegionConstIteratorWithIndex.h" #include "itkImageRegionConstIteratorWithOnlyIndex.h" @@ -232,4 +232,4 @@ class ImageRegionConstIteratorWithOnlyIndex> }; } // end namespace itk -#endif // RLEImageScanlineConstIterator_h +#endif // itkRLEImageScanlineConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h similarity index 94% rename from Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h rename to Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index 1d803c4cef3..b06d592ddc7 100644 --- a/Modules/Filtering/RLEImage/include/RLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -1,8 +1,8 @@ -#ifndef RLEImageScanlineIterator_h -#define RLEImageScanlineIterator_h +#ifndef itkRLEImageScanlineIterator_h +#define itkRLEImageScanlineIterator_h -#include "RLEImageScanlineConstIterator.h" -#include "RLEImageIterator.h" +#include "itkRLEImageScanlineConstIterator.h" +#include "itkRLEImageIterator.h" #include "itkImageScanlineIterator.h" namespace itk @@ -85,4 +85,4 @@ class ImageScanlineIterator> }; } // end namespace itk -#endif // RLEImageScanlineIterator_h +#endif // itkRLEImageScanlineIterator_h diff --git a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h similarity index 98% rename from Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h rename to Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index f0944e45c33..66f31ca1c53 100644 --- a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -1,5 +1,5 @@ -#ifndef RLERegionOfInterestImageFilter_h -#define RLERegionOfInterestImageFilter_h +#ifndef itkRLERegionOfInterestImageFilter_h +#define itkRLERegionOfInterestImageFilter_h #include "itkImageToImageFilter.h" #include "itkSmartPointer.h" @@ -292,7 +292,7 @@ class RegionOfInterestImageFilter } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION -# include "RLERegionOfInterestImageFilter.txx" +# include "itkRLERegionOfInterestImageFilter.hxx" #endif -#endif // RLERegionOfInterestImageFilter_h +#endif // itkRLERegionOfInterestImageFilter_h diff --git a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.txx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx similarity index 99% rename from Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.txx rename to Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 321f7bbf250..092485bf47b 100644 --- a/Modules/Filtering/RLEImage/include/RLERegionOfInterestImageFilter.txx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -1,5 +1,7 @@ -#ifndef RLERegionOfInterestImageFilter_txx -#define RLERegionOfInterestImageFilter_txx +#ifndef itkRLERegionOfInterestImageFilter_hxx +#define itkRLERegionOfInterestImageFilter_hxx + +#include "itkRLERegionOfInterestImageFilter.h" #include "itkRegionOfInterestImageFilter.h" #include "itkImageAlgorithm.h" @@ -528,4 +530,4 @@ RegionOfInterestImageFilter, Imag } } // end namespace itk -#endif // RLERegionOfInterestImageFilter_txx +#endif // itkRLERegionOfInterestImageFilter_hxx diff --git a/Modules/Filtering/RLEImage/test/iteratorTests.cxx b/Modules/Filtering/RLEImage/test/iteratorTests.cxx index a21c7e31a4d..ae9badfd7be 100644 --- a/Modules/Filtering/RLEImage/test/iteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/iteratorTests.cxx @@ -16,7 +16,7 @@ * *=========================================================================*/ -#include "RLEImageScanlineIterator.h" +#include "itkRLEImageScanlineIterator.h" extern int itkImageScanlineIteratorTest1(int argc, char * argv[]); diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx index ce753e73290..10854862e9f 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx @@ -18,7 +18,7 @@ #include #include "itkRLEImage.h" -#include "RLEImageRegionIterator.h" +#include "itkRLEImageRegionIterator.h" // This routine is used to make sure that we call the "const" version diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx index e745a2e2ea9..43aae4613f7 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx @@ -18,7 +18,7 @@ #include -#include "RLEImageRegionIterator.h" +#include "itkRLEImageRegionIterator.h" template class itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester diff --git a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx index 144f7d94452..01dcf655cc3 100644 --- a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx @@ -18,7 +18,7 @@ #include -#include "RLEImageScanlineIterator.h" +#include "itkRLEImageScanlineIterator.h" // This routine is used to make sure that we call the "const" version // of GetPixel() (via the operator[]) diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx index ea278c9787c..bf7eb676ec6 100644 --- a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx @@ -20,7 +20,7 @@ #include "itkImage.h" #include "itkVector.h" -#include "RLEImageRegionIterator.h" +#include "itkRLEImageRegionIterator.h" #include int diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 6fae8b8214b..21233e28e26 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -16,9 +16,9 @@ * *=========================================================================*/ -#include "RLEImageScanlineIterator.h" -#include "RLEImageRegionIterator.h" -#include "RLERegionOfInterestImageFilter.h" +#include "itkRLEImageScanlineIterator.h" +#include "itkRLEImageRegionIterator.h" +#include "itkRLERegionOfInterestImageFilter.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx index 30fcc5990cb..3df3863043a 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx @@ -17,8 +17,8 @@ *=========================================================================*/ #include -#include "RLERegionOfInterestImageFilter.h" -#include "RLEImageRegionIterator.h" +#include "itkRLERegionOfInterestImageFilter.h" +#include "itkRLEImageRegionIterator.h" #include "itkSimpleFilterWatcher.h" int From 9a41670698c514897838d4dbc95ae0fbee9d3464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 15:59:46 -0400 Subject: [PATCH 12/95] ENH: Only #include is needed in user code --- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 7 ++++++- Modules/Filtering/RLEImage/test/iteratorTests.cxx | 2 +- Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx | 1 - .../RLEImage/test/itkImageIteratorWithIndexTest.cxx | 2 +- .../RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx | 2 +- .../test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx | 2 +- .../Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx | 2 +- .../RLEImage/test/itkImageScanlineIteratorTest1.cxx | 2 +- Modules/Filtering/RLEImage/test/itkIteratorTests.cxx | 2 +- Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 4 +--- .../RLEImage/test/itkRegionOfInterestImageFilterTest.cxx | 3 +-- 11 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index a2ceb2b0262..f4095418bfb 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -19,8 +19,13 @@ #define itkRLEImage_hxx #include "itkRLEImage.h" -#include "itkImageRegionConstIterator.h" +#include "itkImageRegionConstIterator.h" //for underlying buffer +// include all specializations of iterators and filters +// so only #include is needed in user code +#include "itkRLEImageScanlineIterator.h" +#include "itkRLEImageRegionIterator.h" +#include "itkRLERegionOfInterestImageFilter.h" namespace itk { diff --git a/Modules/Filtering/RLEImage/test/iteratorTests.cxx b/Modules/Filtering/RLEImage/test/iteratorTests.cxx index ae9badfd7be..fd3391c7840 100644 --- a/Modules/Filtering/RLEImage/test/iteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/iteratorTests.cxx @@ -16,7 +16,7 @@ * *=========================================================================*/ -#include "itkRLEImageScanlineIterator.h" +#include "itkRLEImage.h" extern int itkImageScanlineIteratorTest1(int argc, char * argv[]); diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx index 10854862e9f..ce4fce8ca93 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx @@ -18,7 +18,6 @@ #include #include "itkRLEImage.h" -#include "itkRLEImageRegionIterator.h" // This routine is used to make sure that we call the "const" version diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx index 420b795899a..56e808f8f36 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx @@ -18,7 +18,7 @@ #include -#include "RLEImageRegionIterator.h" +#include "itkRLEImage.h" #include "itkNumericTraits.h" diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx index 49e05d4d8ae..3a2fcedcc98 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx @@ -18,7 +18,7 @@ #include -#include "RLEImageRegionIterator.h" +#include "itkRLEImage.h" int itkImageIteratorsForwardBackwardTest(int, char *[]) diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx index 43aae4613f7..909d27dd947 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx @@ -18,7 +18,7 @@ #include -#include "itkRLEImageRegionIterator.h" +#include "itkRLEImage.h" template class itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx index d70bf3793e4..d789604ea82 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx @@ -18,7 +18,7 @@ #include -#include "RLEImageRegionIterator.h" +#include "itkRLEImage.h" // This routine is used to make sure that we call the "const" version diff --git a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx index 01dcf655cc3..4220d64f4ac 100644 --- a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx @@ -18,7 +18,7 @@ #include -#include "itkRLEImageScanlineIterator.h" +#include "itkRLEImage.h" // This routine is used to make sure that we call the "const" version // of GetPixel() (via the operator[]) diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx index bf7eb676ec6..12ff7475a3e 100644 --- a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx @@ -20,7 +20,7 @@ #include "itkImage.h" #include "itkVector.h" -#include "itkRLEImageRegionIterator.h" +#include "itkRLEImage.h" #include int diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 21233e28e26..83546ffa7c7 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -16,9 +16,7 @@ * *=========================================================================*/ -#include "itkRLEImageScanlineIterator.h" -#include "itkRLEImageRegionIterator.h" -#include "itkRLERegionOfInterestImageFilter.h" +#include "itkRLEImage.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx index 3df3863043a..1a7f7575f68 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx @@ -17,8 +17,7 @@ *=========================================================================*/ #include -#include "itkRLERegionOfInterestImageFilter.h" -#include "itkRLEImageRegionIterator.h" +#include "itkRLEImage.h" #include "itkSimpleFilterWatcher.h" int From c98e22cf0b761db9a377d6f7e4b544eff23ee5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 16:10:11 -0400 Subject: [PATCH 13/95] DOC: Adding Apache 2.0 license --- .../RLEImage/include/itkRLEImageConstIterator.h | 17 +++++++++++++++++ .../RLEImage/include/itkRLEImageIterator.h | 17 +++++++++++++++++ .../include/itkRLEImageRegionConstIterator.h | 17 +++++++++++++++++ .../include/itkRLEImageRegionIterator.h | 17 +++++++++++++++++ .../include/itkRLEImageScanlineConstIterator.h | 17 +++++++++++++++++ .../include/itkRLEImageScanlineIterator.h | 17 +++++++++++++++++ .../include/itkRLERegionOfInterestImageFilter.h | 17 +++++++++++++++++ .../itkRLERegionOfInterestImageFilter.hxx | 17 +++++++++++++++++ 8 files changed, 136 insertions(+) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 52fe6fbc3e1..e18132ae329 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -1,3 +1,20 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ #ifndef itkRLEImageConstIterator_h #define itkRLEImageConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index afb14a7c00a..7982aaee983 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -1,3 +1,20 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ #ifndef itkRLEImageIterator_h #define itkRLEImageIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index 17ae9ce6734..c33d0d6ac57 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -1,3 +1,20 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ #ifndef itkRLEImageRegionConstIterator_h #define itkRLEImageRegionConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index 1a5c0f3c132..cabdcafca1e 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -1,3 +1,20 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ #ifndef itkRLEImageRegionIterator_h #define itkRLEImageRegionIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index e69b9cd2122..186a3576646 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -1,3 +1,20 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ #ifndef itkRLEImageScanlineConstIterator_h #define itkRLEImageScanlineConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index b06d592ddc7..7b967821139 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -1,3 +1,20 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ #ifndef itkRLEImageScanlineIterator_h #define itkRLEImageScanlineIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 66f31ca1c53..96634046ee6 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -1,3 +1,20 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ #ifndef itkRLERegionOfInterestImageFilter_h #define itkRLERegionOfInterestImageFilter_h diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 092485bf47b..b2aa3129fd9 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -1,3 +1,20 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ #ifndef itkRLERegionOfInterestImageFilter_hxx #define itkRLERegionOfInterestImageFilter_hxx From 3a7f1f57b67f45b900d1b251ac6d43199629fba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 16:25:08 -0400 Subject: [PATCH 14/95] ENH: Renaming internal variables to comply with m_Name pattern --- .../Filtering/RLEImage/include/itkRLEImage.h | 4 +- .../RLEImage/include/itkRLEImage.hxx | 72 +++++++-------- .../include/itkRLEImageConstIterator.h | 88 +++++++++---------- .../RLEImage/include/itkRLEImageIterator.h | 14 +-- .../include/itkRLEImageRegionConstIterator.h | 28 +++--- .../include/itkRLEImageRegionIterator.h | 12 ++- .../itkRLEImageScanlineConstIterator.h | 28 +++--- .../include/itkRLEImageScanlineIterator.h | 8 +- 8 files changed, 132 insertions(+), 122 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 65a359d083b..c4f1fab7890 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -176,11 +176,11 @@ class RLEImage : public itk::ImageBase SetPixel(const IndexType & index, const TPixel & value); /** Set a pixel value in the given line and updates segmentRemainder - * and realIndex to refer to the same pixel. + * and m_RealIndex to refer to the same pixel. * Returns difference in line length which happens due to merging or splitting segments. * This method is used by iterators directly. */ int - SetPixel(RLLine & line, IndexValueType & segmentRemainder, IndexValueType & realIndex, const TPixel & value); + SetPixel(RLLine & line, IndexValueType & segmentRemainder, IndexValueType & m_RealIndex, const TPixel & value); /** \brief Get a pixel. SLOW! Better use iterators for pixel access. */ const TPixel & diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index f4095418bfb..59ee094ecbb 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -122,89 +122,89 @@ template int RLEImage::SetPixel(RLLine & line, IndexValueType & segmentRemainder, - IndexValueType & realIndex, + IndexValueType & m_RealIndex, const TPixel & value) { // complete Run-Length Lines have to be buffered itkAssertOrThrowMacro(this->GetBufferedRegion().GetSize(0) == this->GetLargestPossibleRegion().GetSize(0), "BufferedRegion must contain complete run-length lines!"); - if (line[realIndex].second == value) // already correct value + if (line[m_RealIndex].second == value) // already correct value return 0; - else if (line[realIndex].first == 1) // single pixel segment + else if (line[m_RealIndex].first == 1) // single pixel segment { - line[realIndex].second = value; + line[m_RealIndex].second = value; if (m_OnTheFlyCleanup) // now see if we can merge it into adjacent segments { - if (realIndex > 0 && realIndex < line.size() - 1 && line[realIndex + 1].second == value && - line[realIndex - 1].second == value) + if (m_RealIndex > 0 && m_RealIndex < line.size() - 1 && line[m_RealIndex + 1].second == value && + line[m_RealIndex - 1].second == value) { // merge these 3 segments - line[realIndex - 1].first += 1 + line[realIndex + 1].first; - segmentRemainder += line[realIndex + 1].first; - line.erase(line.begin() + realIndex, line.begin() + realIndex + 2); - realIndex--; + line[m_RealIndex - 1].first += 1 + line[m_RealIndex + 1].first; + segmentRemainder += line[m_RealIndex + 1].first; + line.erase(line.begin() + m_RealIndex, line.begin() + m_RealIndex + 2); + m_RealIndex--; return -2; } - if (realIndex > 0 && line[realIndex - 1].second == value) + if (m_RealIndex > 0 && line[m_RealIndex - 1].second == value) { // merge into previous - line[realIndex - 1].first++; - line.erase(line.begin() + realIndex); - realIndex--; + line[m_RealIndex - 1].first++; + line.erase(line.begin() + m_RealIndex); + m_RealIndex--; assert(segmentRemainder == 1); return -1; } - else if (realIndex < line.size() - 1 && line[realIndex + 1].second == value) + else if (m_RealIndex < line.size() - 1 && line[m_RealIndex + 1].second == value) { // merge into next - segmentRemainder = ++(line[realIndex + 1].first); - line.erase(line.begin() + realIndex); + segmentRemainder = ++(line[m_RealIndex + 1].first); + line.erase(line.begin() + m_RealIndex); return -1; } } return 0; } - else if (segmentRemainder == 1 && realIndex < line.size() - 1 && line[realIndex + 1].second == value) + else if (segmentRemainder == 1 && m_RealIndex < line.size() - 1 && line[m_RealIndex + 1].second == value) { // shift this pixel to next segment - line[realIndex].first--; - segmentRemainder = ++(line[realIndex + 1].first); - realIndex++; + line[m_RealIndex].first--; + segmentRemainder = ++(line[m_RealIndex + 1].first); + m_RealIndex++; return 0; } - else if (realIndex > 0 && segmentRemainder == line[realIndex].first && line[realIndex - 1].second == value) + else if (m_RealIndex > 0 && segmentRemainder == line[m_RealIndex].first && line[m_RealIndex - 1].second == value) { // shift this pixel to previous segment - line[realIndex].first--; - line[realIndex - 1].first++; - realIndex--; + line[m_RealIndex].first--; + line[m_RealIndex - 1].first++; + m_RealIndex--; segmentRemainder = 1; return 0; } else if (segmentRemainder == 1) // insert after { - line[realIndex].first--; - line.insert(line.begin() + realIndex + 1, RLSegment(1, value)); - realIndex++; + line[m_RealIndex].first--; + line.insert(line.begin() + m_RealIndex + 1, RLSegment(1, value)); + m_RealIndex++; return +1; } - else if (segmentRemainder == line[realIndex].first) // insert before + else if (segmentRemainder == line[m_RealIndex].first) // insert before { - line[realIndex].first--; - line.insert(line.begin() + realIndex, RLSegment(1, value)); + line[m_RealIndex].first--; + line.insert(line.begin() + m_RealIndex, RLSegment(1, value)); segmentRemainder = 1; return +1; } else // general case: split a segment into 3 segments { // first take care of values - line.insert(line.begin() + realIndex + 1, 2, RLSegment(1, value)); - line[realIndex + 2].second = line[realIndex].second; + line.insert(line.begin() + m_RealIndex + 1, 2, RLSegment(1, value)); + line[m_RealIndex + 2].second = line[m_RealIndex].second; // now take care of counts - line[realIndex].first -= segmentRemainder; - line[realIndex + 2].first = segmentRemainder - 1; - realIndex++; + line[m_RealIndex].first -= segmentRemainder; + line[m_RealIndex + 2].first = segmentRemainder - 1; + m_RealIndex++; segmentRemainder = 1; return +2; } diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index e18132ae329..2f7893e869a 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -93,14 +93,14 @@ class ImageConstIterator> * provide a copy constructor. */ ImageConstIterator() : m_Buffer(0) - , rlLine(0) + , m_RunLengthLine(0) { m_Image = ITK_NULLPTR; m_Index0 = 0; m_BeginIndex0 = 0; m_EndIndex0 = 0; - realIndex = 0; - segmentRemainder = 0; + m_RealIndex = 0; + m_SegmentRemainder = 0; } /** Default Destructor. */ @@ -111,13 +111,13 @@ class ImageConstIterator> ImageConstIterator(const Self & it) : m_Buffer(const_cast(it.GetImage())->GetBuffer()) { - rlLine = it.rlLine; + m_RunLengthLine = it.m_RunLengthLine; m_Image = it.m_Image; // copy the smart pointer m_Index0 = it.m_Index0; - this->bi = it.bi; + this->m_BI = it.m_BI; - realIndex = it.realIndex; - segmentRemainder = it.segmentRemainder; + m_RealIndex = it.m_RealIndex; + m_SegmentRemainder = it.m_SegmentRemainder; m_BeginIndex0 = it.m_BeginIndex0; m_EndIndex0 = it.m_EndIndex0; } @@ -139,13 +139,13 @@ class ImageConstIterator> if (this != &it) { m_Buffer = it.m_Buffer; - rlLine = it.rlLine; + m_RunLengthLine = it.m_RunLengthLine; m_Image = it.m_Image; // copy the smart pointer m_Index0 = it.m_Index0; - bi = it.bi; + m_BI = it.m_BI; - realIndex = it.realIndex; - segmentRemainder = it.segmentRemainder; + m_RealIndex = it.m_RealIndex; + m_SegmentRemainder = it.m_SegmentRemainder; m_BeginIndex0 = it.m_BeginIndex0; m_EndIndex0 = it.m_EndIndex0; } @@ -165,11 +165,11 @@ class ImageConstIterator> "Region " << region << " is outside of buffered region " << bufferedRegion); } - bi = BufferIterator(m_Buffer, ImageType::truncateRegion(region)); + m_BI = BufferIterator(m_Buffer, ImageType::truncateRegion(region)); m_Index0 = region.GetIndex(0); m_BeginIndex0 = m_Index0 - m_Image->GetBufferedRegion().GetIndex(0); m_EndIndex0 = m_BeginIndex0 + region.GetSize(0); - SetIndexInternal(m_BeginIndex0); // sets realIndex and segmentRemainder + SetIndexInternal(m_BeginIndex0); // sets m_RealIndex and m_SegmentRemainder } /** Get the dimension (size) of the index. */ @@ -184,7 +184,7 @@ class ImageConstIterator> bool operator!=(const Self & it) const { - return bi != it.bi || m_Index0 + m_BeginIndex0 != it.m_Index0 + it.m_BeginIndex0; + return m_BI != it.m_BI || m_Index0 + m_BeginIndex0 != it.m_Index0 + it.m_BeginIndex0; } /** Comparison operator. Two iterators are the same if they "point to" the @@ -192,7 +192,7 @@ class ImageConstIterator> bool operator==(const Self & it) const { - return bi == it.bi && m_Index0 + m_BeginIndex0 == it.m_Index0 + it.m_BeginIndex0; + return m_BI == it.m_BI && m_Index0 + m_BeginIndex0 == it.m_Index0 + it.m_BeginIndex0; } /** Comparison operator. An iterator is "less than" another if it "points to" @@ -200,9 +200,9 @@ class ImageConstIterator> bool operator<=(const Self & it) const { - if (bi < it.bi) + if (m_BI < it.m_BI) return true; - else if (bi > it.bi) + else if (m_BI > it.m_BI) return false; return m_Index0 + m_BeginIndex0 <= it.m_Index0 + it.m_BeginIndex0; } @@ -212,9 +212,9 @@ class ImageConstIterator> bool operator<(const Self & it) const { - if (bi < it.bi) + if (m_BI < it.m_BI) return true; - else if (bi > it.bi) + else if (m_BI > it.m_BI) return false; return m_Index0 + m_BeginIndex0 < it.m_Index0 + it.m_BeginIndex0; } @@ -224,9 +224,9 @@ class ImageConstIterator> bool operator>=(const Self & it) const { - if (bi > it.bi) + if (m_BI > it.m_BI) return true; - else if (bi < it.bi) + else if (m_BI < it.m_BI) return false; return m_Index0 + m_BeginIndex0 >= it.m_Index0 + it.m_BeginIndex0; } @@ -236,9 +236,9 @@ class ImageConstIterator> bool operator>(const Self & it) const { - if (bi > it.bi) + if (m_BI > it.m_BI) return true; - else if (bi < it.bi) + else if (m_BI < it.m_BI) return false; return m_Index0 + m_BeginIndex0 > it.m_Index0 + it.m_BeginIndex0; } @@ -249,7 +249,7 @@ class ImageConstIterator> { IndexType indR(m_Image->GetBufferedRegion().GetIndex()); indR[0] += m_Index0; - typename BufferType::IndexType bufInd = bi.GetIndex(); + typename BufferType::IndexType bufInd = m_BI.GetIndex(); for (IndexValueType i = 1; i < VImageDimension; i++) indR[i] = bufInd[i - 1]; return indR; @@ -262,7 +262,7 @@ class ImageConstIterator> typename BufferType::IndexType bufInd; for (IndexValueType i = 1; i < VImageDimension; i++) bufInd[i - 1] = ind[i]; - bi.SetIndex(bufInd); + m_BI.SetIndex(bufInd); SetIndexInternal(ind[0] - m_Image->GetBufferedRegion().GetIndex(0)); } @@ -274,7 +274,7 @@ class ImageConstIterator> RegionType r; r.SetIndex(0, m_BeginIndex0 + m_Image->GetBufferedRegion().GetIndex(0)); r.SetSize(0, m_EndIndex0 - m_BeginIndex0); - typename BufferType::RegionType ir = bi.GetRegion(); + typename BufferType::RegionType ir = m_BI.GetRegion(); for (IndexValueType i = 1; i < VImageDimension; i++) { r.SetIndex(i, ir.GetIndex(i - 1)); @@ -303,8 +303,8 @@ class ImageConstIterator> const PixelType & Value(void) const { - RLLine & line = const_cast(this)->bi.Value(); - return line[realIndex].second; + RLLine & line = const_cast(this)->m_BI.Value(); + return line[m_RealIndex].second; } /** Move an iterator to the beginning of the region. "Begin" is @@ -312,7 +312,7 @@ class ImageConstIterator> void GoToBegin() { - bi.GoToBegin(); + m_BI.GoToBegin(); SetIndexInternal(m_BeginIndex0); } @@ -321,7 +321,7 @@ class ImageConstIterator> void GoToEnd() { - bi.GoToEnd(); + m_BI.GoToEnd(); m_Index0 = m_BeginIndex0; } @@ -330,7 +330,7 @@ class ImageConstIterator> bool IsAtBegin(void) const { - return m_Index0 == m_BeginIndex0 && bi.IsAtBegin(); + return m_Index0 == m_BeginIndex0 && m_BI.IsAtBegin(); } /** Is the iterator at the end of the region? "End" is defined as one @@ -338,43 +338,43 @@ class ImageConstIterator> bool IsAtEnd(void) const { - return m_Index0 == m_BeginIndex0 && bi.IsAtEnd(); + return m_Index0 == m_BeginIndex0 && m_BI.IsAtEnd(); } protected: // made protected so other iterators can access - /** Set the internal index, realIndex and segmentRemainder. */ + /** Set the internal index, m_RealIndex and m_SegmentRemainder. */ virtual void SetIndexInternal(const IndexValueType ind0) { m_Index0 = ind0; - rlLine = &bi.Value(); + m_RunLengthLine = &m_BI.Value(); CounterType t = 0; SizeValueType x = 0; - for (; x < (*rlLine).size(); x++) + for (; x < (*m_RunLengthLine).size(); x++) { - t += (*rlLine)[x].first; + t += (*m_RunLengthLine)[x].first; if (t > m_Index0) break; } - realIndex = x; - segmentRemainder = t - m_Index0; + m_RealIndex = x; + m_SegmentRemainder = t - m_Index0; } typename ImageType::ConstWeakPointer m_Image; IndexValueType m_Index0; // index into the RLLine - const RLLine * rlLine; + const RLLine * m_RunLengthLine; - mutable IndexValueType realIndex; // index into line's segment - mutable IndexValueType segmentRemainder; // how many pixels remain in current segment + mutable IndexValueType m_RealIndex; // index into line's segment + mutable IndexValueType m_SegmentRemainder; // how many pixels remain in current segment IndexValueType m_BeginIndex0; // index to first pixel in region in relation to buffer start IndexValueType m_EndIndex0; // index to one pixel past last pixel in region in relation to buffer start - BufferIterator bi; // iterator over internal buffer image + BufferIterator m_BI; // iterator over internal buffer image typename BufferType::Pointer m_Buffer; }; @@ -392,7 +392,7 @@ class ImageConstIteratorWithIndex void GoToReverseBegin() { - this->bi.GoToReverseBegin(); + this->m_BI.GoToReverseBegin(); this->m_Index0 = this->m_EndIndex0 - 1; SetIndexInternal(this->m_Index0); } @@ -400,7 +400,7 @@ class ImageConstIteratorWithIndex bool IsAtReverseEnd() { - return this->bi.IsAtReverseEnd(); + return this->m_BI.IsAtReverseEnd(); } /** Default Constructor. Need to provide a default constructor since we diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 7982aaee983..9b1d91520a9 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -92,8 +92,10 @@ class ImageIterator> Set(const PixelType & value) const { const_cast(this->m_Image.GetPointer()) - ->SetPixel( - *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + ->SetPixel(*const_cast(this->m_RunLengthLine), + this->m_SegmentRemainder, + this->m_RealIndex, + value); } ///** Return a reference to the pixel @@ -102,7 +104,7 @@ class ImageIterator> // * we would isolate this pixel into its own segment. */ // PixelType & Value(void) //{ - // return m_Buffer[m_Index[2]][m_Index[1]][realIndex].second; + // return m_Buffer[m_Index[2]][m_Index[1]][m_RealIndex].second; //} /** Get the image that this iterator walks. */ @@ -160,8 +162,10 @@ class ImageIteratorWithIndex> Set(const TPixel & value) const { const_cast(this->m_Image.GetPointer()) - ->SetPixel( - *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + ->SetPixel(*const_cast(this->m_RunLengthLine), + this->m_SegmentRemainder, + this->m_RealIndex, + value); } /** Get the image that this iterator walks. */ diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index c33d0d6ac57..bbf42385e46 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -119,20 +119,20 @@ class ImageRegionConstIterator> if (this->m_Index0 >= this->m_EndIndex0) { - ++(this->bi); - if (!this->bi.IsAtEnd()) + ++(this->m_BI); + if (!this->m_BI.IsAtEnd()) this->SetIndexInternal(this->m_BeginIndex0); else this->m_Index0 = this->m_BeginIndex0; return *this; } - this->segmentRemainder--; - if (this->segmentRemainder > 0) + this->m_SegmentRemainder--; + if (this->m_SegmentRemainder > 0) return *this; - this->realIndex++; - this->segmentRemainder = (*this->rlLine)[this->realIndex].first; + this->m_RealIndex++; + this->m_SegmentRemainder = (*this->m_RunLengthLine)[this->m_RealIndex].first; return *this; } @@ -150,17 +150,17 @@ class ImageRegionConstIterator> if (this->m_Index0 < this->m_BeginIndex0) { - --(this->bi); + --(this->m_BI); this->SetIndexInternal(this->m_EndIndex0 - 1); return *this; } - this->segmentRemainder++; - if (this->segmentRemainder <= (*this->rlLine)[this->realIndex].first) + this->m_SegmentRemainder++; + if (this->m_SegmentRemainder <= (*this->m_RunLengthLine)[this->m_RealIndex].first) return *this; - this->realIndex--; - this->segmentRemainder = 1; + this->m_RealIndex--; + this->m_SegmentRemainder = 1; return *this; } }; @@ -188,8 +188,8 @@ class ImageRegionConstIteratorWithIndexbi.GoToEnd(); // after last pixel - --(this->bi); // go to last valid pixel + this->m_BI.GoToEnd(); // after last pixel + --(this->m_BI); // go to last valid pixel this->m_Index0 = this->m_EndIndex0 - 1; this->SetIndexInternal(this->m_Index0); // valid index required } @@ -197,7 +197,7 @@ class ImageRegionConstIteratorWithIndexm_Index0 == this->m_BeginIndex0) && this->bi.IsAtBegin(); + return (this->m_Index0 == this->m_BeginIndex0) && this->m_BI.IsAtBegin(); } /** Constructor that can be used to cast from an ImageIterator to an diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index cabdcafca1e..089f4a02236 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -89,8 +89,10 @@ class ImageRegionIterator> Set(const PixelType & value) const { const_cast(this->m_Image.GetPointer()) - ->SetPixel( - *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + ->SetPixel(*const_cast(this->m_RunLengthLine), + this->m_SegmentRemainder, + this->m_RealIndex, + value); } protected: @@ -133,8 +135,10 @@ class ImageRegionIteratorWithIndex(this->m_Image.GetPointer()) - ->SetPixel( - *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + ->SetPixel(*const_cast(this->m_RunLengthLine), + this->m_SegmentRemainder, + this->m_RealIndex, + value); } /** Constructor that can be used to cast from an ImageIterator to an diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index 186a3576646..e21c0da8f8f 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -99,8 +99,8 @@ class ImageScanlineConstIterator> GoToBeginOfLine(void) { this->m_Index0 = this->m_BeginIndex0; - this->realIndex = 0; - this->segmentRemainder = (*this->rlLine)[this->realIndex].first; + this->m_RealIndex = 0; + this->m_SegmentRemainder = (*this->m_RunLengthLine)[this->m_RealIndex].first; } /** Go to the past end pixel of the current line. */ @@ -108,8 +108,8 @@ class ImageScanlineConstIterator> GoToEndOfLine(void) { this->m_Index0 = this->m_EndIndex0; - this->realIndex = this->rlLine->size() - 1; - this->segmentRemainder = 0; + this->m_RealIndex = this->m_RunLengthLine->size() - 1; + this->m_SegmentRemainder = 0; } /** Test if the index is at the end of line. */ @@ -123,8 +123,8 @@ class ImageScanlineConstIterator> inline void NextLine(void) { - ++(this->bi); - if (!this->bi.IsAtEnd()) + ++(this->m_BI); + if (!this->m_BI.IsAtEnd()) this->SetIndexInternal(this->m_BeginIndex0); else this->m_Index0 = this->m_BeginIndex0; // make this iterator at end too @@ -142,14 +142,14 @@ class ImageScanlineConstIterator> { itkAssertInDebugAndIgnoreInReleaseMacro(!this->IsAtEndOfLine()); this->m_Index0++; - this->segmentRemainder--; - if (this->segmentRemainder > 0) + this->m_SegmentRemainder--; + if (this->m_SegmentRemainder > 0) return *this; if (this->IsAtEndOfLine()) return *this; - this->realIndex++; - this->segmentRemainder = (*this->rlLine)[this->realIndex].first; + this->m_RealIndex++; + this->m_SegmentRemainder = (*this->m_RunLengthLine)[this->m_RealIndex].first; return *this; } @@ -160,12 +160,12 @@ class ImageScanlineConstIterator> operator--() { this->m_Index0--; - this->segmentRemainder++; - if (this->segmentRemainder <= (*this->rlLine)[this->realIndex].first) + this->m_SegmentRemainder++; + if (this->m_SegmentRemainder <= (*this->m_RunLengthLine)[this->m_RealIndex].first) return *this; - this->realIndex--; - this->segmentRemainder = 1; + this->m_RealIndex--; + this->m_SegmentRemainder = 1; return *this; } }; diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index 7b967821139..605b0e8a447 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -75,8 +75,10 @@ class ImageScanlineIterator> Set(const PixelType & value) const { const_cast(this->m_Image.GetPointer()) - ->SetPixel( - *const_cast(this->rlLine), this->segmentRemainder, this->realIndex, value); + ->SetPixel(*const_cast(this->m_RunLengthLine), + this->m_SegmentRemainder, + this->m_RealIndex, + value); } ///** Return a reference to the pixel @@ -84,7 +86,7 @@ class ImageScanlineIterator> //* data, but it will NOT support ImageAdaptors. */ // PixelType & Value(void) //{ - // return m_Buffer[m_Index[2]][m_Index[1]][realIndex].second; + // return m_Buffer[m_Index[2]][m_Index[1]][m_RealIndex].second; //} protected: From c574a2ad36b2e79beee213e37b86eb5da61efb05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 19 Jul 2016 16:29:53 -0400 Subject: [PATCH 15/95] STYLE: KWStyle: variable declaration alignment --- .../include/itkRLEImageConstIterator.h | 2 +- .../itkRLERegionOfInterestImageFilter.h | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 2f7893e869a..5bd84b7fa1f 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -373,8 +373,8 @@ class ImageConstIterator> IndexValueType m_BeginIndex0; // index to first pixel in region in relation to buffer start IndexValueType m_EndIndex0; // index to one pixel past last pixel in region in relation to buffer start + BufferIterator m_BI; // iterator over internal buffer image - BufferIterator m_BI; // iterator over internal buffer image typename BufferType::Pointer m_Buffer; }; diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 96634046ee6..bed31530da8 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -139,13 +139,14 @@ class RegionOfInterestImageFilter, RLEImage RLEImageType; - typedef Image ImageType; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; - typedef typename Superclass::InputImageRegionType InputImageRegionType; + + typedef RegionOfInterestImageFilter Self; + typedef Image ImageType; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + typedef typename Superclass::InputImageRegionType InputImageRegionType; /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -226,13 +227,14 @@ class RegionOfInterestImageFilter { public: /** Standard class typedefs. */ - typedef RegionOfInterestImageFilter Self; typedef itk::RLEImage RLEImageType; - typedef Image ImageType; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; - typedef typename Superclass::InputImageRegionType InputImageRegionType; + + typedef RegionOfInterestImageFilter Self; + typedef Image ImageType; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + typedef typename Superclass::InputImageRegionType InputImageRegionType; /** Method for creation through the object factory. */ itkNewMacro(Self); From ba0c27cea4f7066ee66d5c150dbf62db745893bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 25 Jul 2016 12:40:25 -0400 Subject: [PATCH 16/95] STYLE: Minor constructor style modification --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index c4f1fab7890..8b3e3c2b677 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -270,8 +270,9 @@ class RLEImage : public itk::ImageBase protected: RLEImage() : itk::ImageBase() + , m_OnTheFlyCleanup(true) { - m_OnTheFlyCleanup = true; + // m_OnTheFlyCleanup = true; m_Buffer = BufferType::New(); } void From 18edc9f3cee6cbedebf2f291bc9a0c701a88a84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 25 Jul 2016 15:46:55 -0400 Subject: [PATCH 17/95] STYLE: Applied clang-format --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 11 ++++------- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 4 ++-- .../RLEImage/include/itkRLEImageConstIterator.h | 9 +++------ .../Filtering/RLEImage/include/itkRLEImageIterator.h | 5 +---- .../RLEImage/include/itkRLEImageRegionConstIterator.h | 5 +---- .../RLEImage/include/itkRLEImageRegionIterator.h | 5 +---- .../include/itkRLEImageScanlineConstIterator.h | 4 +--- .../RLEImage/include/itkRLEImageScanlineIterator.h | 4 ++-- .../include/itkRLERegionOfInterestImageFilter.h | 10 +++++----- .../include/itkRLERegionOfInterestImageFilter.hxx | 4 ++-- 10 files changed, 22 insertions(+), 39 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 8b3e3c2b677..26898ba4831 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -18,10 +18,10 @@ #ifndef itkRLEImage_h #define itkRLEImage_h +#include +#include #include //std::pair #include -#include -#include namespace itk { @@ -51,7 +51,6 @@ namespace itk template class RLEImage : public itk::ImageBase { - public: /** Standard class typedefs */ typedef RLEImage Self; @@ -192,8 +191,8 @@ class RLEImage : public itk::ImageBase ///** \brief Access a pixel. Chaning it changes the whole RLE segment! */ // TPixel & operator[](const IndexType & index) //{ - // return this->GetPixel(index); - // } + // return this->GetPixel(index); + //} /** \brief Access a pixel. This version can only be an rvalue. * SLOW -> Use iterators instead. */ @@ -202,7 +201,6 @@ class RLEImage : public itk::ImageBase { return this->GetPixel(index); } - virtual unsigned int GetNumberOfComponentsPerPixel() const { @@ -279,7 +277,6 @@ class RLEImage : public itk::ImageBase PrintSelf(std::ostream & os, itk::Indent indent) const; virtual ~RLEImage() {} - /** Compute helper matrices used to transform Index coordinates to * PhysicalPoint coordinates and back. This method is virtual and will be * overloaded in derived classes in order to provide backward compatibility diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index 59ee094ecbb..ea58b7f5d44 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -18,13 +18,13 @@ #ifndef itkRLEImage_hxx #define itkRLEImage_hxx -#include "itkRLEImage.h" #include "itkImageRegionConstIterator.h" //for underlying buffer +#include "itkRLEImage.h" // include all specializations of iterators and filters // so only #include is needed in user code -#include "itkRLEImageScanlineIterator.h" #include "itkRLEImageRegionIterator.h" +#include "itkRLEImageScanlineIterator.h" #include "itkRLERegionOfInterestImageFilter.h" namespace itk diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 5bd84b7fa1f..d0e210a29da 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -19,13 +19,13 @@ #define itkRLEImageConstIterator_h #include "itkImage.h" -#include "itkIndex.h" -#include "itkNumericTraits.h" -#include "itkRLEImage.h" #include "itkImageConstIterator.h" #include "itkImageConstIteratorWithIndex.h" #include "itkImageConstIteratorWithOnlyIndex.h" #include "itkImageRegionIterator.h" +#include "itkIndex.h" +#include "itkNumericTraits.h" +#include "itkRLEImage.h" class MultiLabelMeshPipeline; @@ -105,7 +105,6 @@ class ImageConstIterator> /** Default Destructor. */ virtual ~ImageConstIterator() {} - /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageConstIterator(const Self & it) @@ -415,7 +414,6 @@ class ImageConstIteratorWithIndex { this->ImageConstIterator::operator=(it); } - /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ ImageConstIteratorWithIndex(const ImageType * ptr, const RegionType & region) @@ -447,7 +445,6 @@ class ImageConstIteratorWithOnlyIndexImageConstIterator::operator=(it); } - /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ ImageConstIteratorWithOnlyIndex(const ImageType * ptr, const RegionType & region) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 9b1d91520a9..631d3442c4e 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -18,8 +18,8 @@ #ifndef itkRLEImageIterator_h #define itkRLEImageIterator_h -#include "itkRLEImageConstIterator.h" #include "itkImageIteratorWithIndex.h" +#include "itkRLEImageConstIterator.h" namespace itk { @@ -61,10 +61,8 @@ class ImageIterator> /** Default Constructor. Need to provide a default constructor since we * provide a copy constructor. */ ImageIterator() {} - /** Default Destructor */ ~ImageIterator() {} - /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageIterator(const Self & it) @@ -149,7 +147,6 @@ class ImageIteratorWithIndex> /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageIteratorWithIndex(const ImageIteratorWithIndex & it) { this->ImageIterator::operator=(it); } - /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ ImageIteratorWithIndex(const ImageType * ptr, const RegionType & region) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index bbf42385e46..17deeebe9d4 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -18,10 +18,10 @@ #ifndef itkRLEImageRegionConstIterator_h #define itkRLEImageRegionConstIterator_h -#include "itkRLEImageConstIterator.h" #include "itkImageRegionConstIterator.h" #include "itkImageRegionConstIteratorWithIndex.h" #include "itkImageRegionConstIteratorWithOnlyIndex.h" +#include "itkRLEImageConstIterator.h" class MultiLabelMeshPipeline; @@ -104,7 +104,6 @@ class ImageRegionConstIterator> { this->ImageConstIterator::operator=(it); } - /** Increment (prefix) the fastest moving dimension of the iterator's index. * This operator will constrain the iterator within the region (i.e. the * iterator will automatically wrap from the end of the row of the region @@ -210,7 +209,6 @@ class ImageRegionConstIteratorWithIndexImageRegionConstIterator::operator=(it); } - }; // no additional implementation required template @@ -244,7 +242,6 @@ class ImageRegionConstIteratorWithOnlyIndexImageRegionConstIterator::operator=(it); } - }; // no additional implementation required } // end namespace itk diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index 089f4a02236..fd53e0cb85d 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -18,10 +18,10 @@ #ifndef itkRLEImageRegionIterator_h #define itkRLEImageRegionIterator_h -#include "itkRLEImageRegionConstIterator.h" #include "itkImageRegionIterator.h" #include "itkImageRegionIteratorWithIndex.h" #include "itkRLEImageIterator.h" +#include "itkRLEImageRegionConstIterator.h" namespace itk { @@ -82,7 +82,6 @@ class ImageRegionIterator> * returns ImageIterators and uses constructors to cast from an * ImageIterator to a ImageRegionIterator. */ ImageRegionIterator(const ImageIterator & it) { this->ImageConstIterator::operator=(it); } - /** Set the pixel value. * Changing the RLE structure invalidates all other iterators (except this one). */ void @@ -151,7 +150,6 @@ class ImageRegionIteratorWithIndexImageRegionConstIteratorWithIndex::operator=(it); } - /** Constructor that can be used to cast from an ImageConstIterator to an * ImageRegionIteratorWithIndex. Many routines return an ImageIterator, but for a * particular task, you may want an ImageRegionConstIterator. Rather than @@ -162,7 +160,6 @@ class ImageRegionIteratorWithIndexImageRegionConstIterator::operator=(it); } - }; // no additional implementation required } // end namespace itk diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index e21c0da8f8f..176711e4dfb 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -18,8 +18,8 @@ #ifndef itkRLEImageScanlineConstIterator_h #define itkRLEImageScanlineConstIterator_h -#include "itkRLEImageRegionConstIterator.h" #include "itkImageScanlineIterator.h" +#include "itkRLEImageRegionConstIterator.h" namespace itk { @@ -92,8 +92,6 @@ class ImageScanlineConstIterator> { this->ImageRegionConstIterator::operator=(it); } - - /** Go to the beginning pixel of the current line. */ void GoToBeginOfLine(void) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index 605b0e8a447..4ccacd70afb 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -18,9 +18,9 @@ #ifndef itkRLEImageScanlineIterator_h #define itkRLEImageScanlineIterator_h -#include "itkRLEImageScanlineConstIterator.h" -#include "itkRLEImageIterator.h" #include "itkImageScanlineIterator.h" +#include "itkRLEImageIterator.h" +#include "itkRLEImageScanlineConstIterator.h" namespace itk { diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index bed31530da8..cbd69e62e90 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -19,9 +19,9 @@ #define itkRLERegionOfInterestImageFilter_h #include "itkImageToImageFilter.h" -#include "itkSmartPointer.h" -#include "itkRegionOfInterestImageFilter.h" #include "itkRLEImage.h" +#include "itkRegionOfInterestImageFilter.h" +#include "itkSmartPointer.h" namespace itk { @@ -87,7 +87,7 @@ class RegionOfInterestImageFilter // Begin concept checking itkConceptMacro(SameDimensionCheck, (Concept::SameDimension)); itkConceptMacro(InputConvertibleToOutputCheck, (Concept::Convertible)); - // End concept checking +// End concept checking #endif protected: @@ -175,7 +175,7 @@ class RegionOfInterestImageFilter, RLEImage)); itkConceptMacro(InputConvertibleToOutputCheck, (Concept::Convertible)); - // End concept checking +// End concept checking #endif protected: @@ -263,7 +263,7 @@ class RegionOfInterestImageFilter // Begin concept checking itkConceptMacro(SameDimensionCheck, (Concept::SameDimension)); itkConceptMacro(InputConvertibleToOutputCheck, (Concept::Convertible)); - // End concept checking +// End concept checking #endif protected: diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index b2aa3129fd9..5a951b9d015 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -20,11 +20,11 @@ #include "itkRLERegionOfInterestImageFilter.h" -#include "itkRegionOfInterestImageFilter.h" +#include "itkImage.h" #include "itkImageAlgorithm.h" #include "itkObjectFactory.h" #include "itkProgressReporter.h" -#include "itkImage.h" +#include "itkRegionOfInterestImageFilter.h" namespace itk { From d70950820ceb7f1f85b978b30441f03135060fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 26 Jul 2016 12:38:25 -0400 Subject: [PATCH 18/95] ENH: Uncrustifying --- .../Filtering/RLEImage/include/itkRLEImage.h | 4 +++ .../RLEImage/include/itkRLEImage.hxx | 25 +++++++++++++++---- .../include/itkRLEImageConstIterator.h | 25 +++++++++++++++++-- .../include/itkRLEImageRegionConstIterator.h | 13 +++++++--- .../itkRLEImageScanlineConstIterator.h | 12 ++++++++- .../itkRLERegionOfInterestImageFilter.hxx | 24 +++++++++++++----- 6 files changed, 86 insertions(+), 17 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 26898ba4831..7f9b8e04f54 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -258,10 +258,14 @@ class RLEImage : public itk::ImageBase SetOnTheFlyCleanup(bool value) { if (value == m_OnTheFlyCleanup) + { return; + } m_OnTheFlyCleanup = value; if (m_OnTheFlyCleanup) + { CleanUp(); // put the image into a clean state + } } diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index ea58b7f5d44..93e423dfd09 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -35,7 +35,9 @@ RLEImage::truncateIndex(const IndexType & { typename BufferType::IndexType result; for (IndexValueType i = 0; i < VImageDimension - 1; i++) + { result[i] = index[i + 1]; + } return result; } @@ -45,7 +47,9 @@ RLEImage::truncateSize(const SizeType & si { typename BufferType::SizeType result; for (IndexValueType i = 0; i < VImageDimension - 1; i++) + { result[i] = size[i + 1]; + } return result; } @@ -100,7 +104,9 @@ RLEImage::CleanUpLine(RLLine & line) const { out.push_back(line[x]); while (++x < line.size() && line[x].second == line[x - 1].second) + { out.back().first += line[x].first; + } } while (x < line.size()); out.swap(line); } @@ -111,11 +117,17 @@ RLEImage::CleanUp() const { assert(!m_Buffer.empty()); if (this->GetLargestPossibleRegion().GetSize(0) == 0) + { return; + } #pragma omp parallel for for (CounterType z = 0; z < m_Buffer.size(); z++) + { for (CounterType y = 0; y < m_Buffer[0].size(); y++) + { CleanUpLine(m_Buffer[z][y]); + } + } } template @@ -129,7 +141,9 @@ RLEImage::SetPixel(RLLine & line, itkAssertOrThrowMacro(this->GetBufferedRegion().GetSize(0) == this->GetLargestPossibleRegion().GetSize(0), "BufferedRegion must contain complete run-length lines!"); if (line[m_RealIndex].second == value) // already correct value + { return 0; + } else if (line[m_RealIndex].first == 1) // single pixel segment { line[m_RealIndex].second = value; @@ -208,7 +222,7 @@ RLEImage::SetPixel(RLLine & line, segmentRemainder = 1; return +2; } -} +} // >::SetPixel template void @@ -232,7 +246,7 @@ RLEImage::SetPixel(const IndexType & index } } throw itk::ExceptionObject(__FILE__, __LINE__, "Reached past the end of Run-Length line!", __FUNCTION__); -} +} // >::SetPixel template const TPixel & @@ -249,10 +263,12 @@ RLEImage::GetPixel(const IndexType & index { t += line[x].first; if (t > index[0] - bri0) + { return line[x].second; + } } throw itk::ExceptionObject(__FILE__, __LINE__, "Reached past the end of Run-Length line!", __FUNCTION__); -} +} // >::GetPixel template void @@ -280,7 +296,6 @@ RLEImage::PrintSelf(std::ostream & os, itk int prec = os.precision(3); os << indent << "Compressed size in relation to original size: " << cr * 100 << "%" << std::endl; os.precision(prec); -} - +} // >::PrintSelf } // end namespace itk #endif // itkRLEImage_hxx diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index d0e210a29da..c3ecaa811a8 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -200,9 +200,13 @@ class ImageConstIterator> operator<=(const Self & it) const { if (m_BI < it.m_BI) + { return true; + } else if (m_BI > it.m_BI) + { return false; + } return m_Index0 + m_BeginIndex0 <= it.m_Index0 + it.m_BeginIndex0; } @@ -212,9 +216,13 @@ class ImageConstIterator> operator<(const Self & it) const { if (m_BI < it.m_BI) + { return true; + } else if (m_BI > it.m_BI) + { return false; + } return m_Index0 + m_BeginIndex0 < it.m_Index0 + it.m_BeginIndex0; } @@ -224,9 +232,13 @@ class ImageConstIterator> operator>=(const Self & it) const { if (m_BI > it.m_BI) + { return true; + } else if (m_BI < it.m_BI) + { return false; + } return m_Index0 + m_BeginIndex0 >= it.m_Index0 + it.m_BeginIndex0; } @@ -236,9 +248,13 @@ class ImageConstIterator> operator>(const Self & it) const { if (m_BI > it.m_BI) + { return true; + } else if (m_BI < it.m_BI) + { return false; + } return m_Index0 + m_BeginIndex0 > it.m_Index0 + it.m_BeginIndex0; } @@ -250,7 +266,9 @@ class ImageConstIterator> indR[0] += m_Index0; typename BufferType::IndexType bufInd = m_BI.GetIndex(); for (IndexValueType i = 1; i < VImageDimension; i++) + { indR[i] = bufInd[i - 1]; + } return indR; } @@ -260,7 +278,9 @@ class ImageConstIterator> { typename BufferType::IndexType bufInd; for (IndexValueType i = 1; i < VImageDimension; i++) + { bufInd[i - 1] = ind[i]; + } m_BI.SetIndex(bufInd); SetIndexInternal(ind[0] - m_Image->GetBufferedRegion().GetIndex(0)); } @@ -355,11 +375,13 @@ class ImageConstIterator> { t += (*m_RunLengthLine)[x].first; if (t > m_Index0) + { break; + } } m_RealIndex = x; m_SegmentRemainder = t - m_Index0; - } + } // SetIndexInternal typename ImageType::ConstWeakPointer m_Image; @@ -451,7 +473,6 @@ class ImageConstIteratorWithOnlyIndex(ptr, region) {} }; // no additional implementation required - } // end namespace itk #endif // itkRLEImageConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index 17deeebe9d4..f344d411228 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -120,20 +120,26 @@ class ImageRegionConstIterator> { ++(this->m_BI); if (!this->m_BI.IsAtEnd()) + { this->SetIndexInternal(this->m_BeginIndex0); + } else + { this->m_Index0 = this->m_BeginIndex0; + } return *this; } this->m_SegmentRemainder--; if (this->m_SegmentRemainder > 0) + { return *this; + } this->m_RealIndex++; this->m_SegmentRemainder = (*this->m_RunLengthLine)[this->m_RealIndex].first; return *this; - } + } // ++ /** Decrement (prefix) the fastest moving dimension of the iterator's index. * This operator will constrain the iterator within the region (i.e. the @@ -156,12 +162,14 @@ class ImageRegionConstIterator> this->m_SegmentRemainder++; if (this->m_SegmentRemainder <= (*this->m_RunLengthLine)[this->m_RealIndex].first) + { return *this; + } this->m_RealIndex--; this->m_SegmentRemainder = 1; return *this; - } + } // -- }; template @@ -243,7 +251,6 @@ class ImageRegionConstIteratorWithOnlyIndexImageRegionConstIterator::operator=(it); } }; // no additional implementation required - } // end namespace itk #endif // itkRLEImageRegionConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index 176711e4dfb..2c852c728d4 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -123,9 +123,13 @@ class ImageScanlineConstIterator> { ++(this->m_BI); if (!this->m_BI.IsAtEnd()) + { this->SetIndexInternal(this->m_BeginIndex0); + } else + { this->m_Index0 = this->m_BeginIndex0; // make this iterator at end too + } } /** Increment (prefix) along the scanline. @@ -142,14 +146,18 @@ class ImageScanlineConstIterator> this->m_Index0++; this->m_SegmentRemainder--; if (this->m_SegmentRemainder > 0) + { return *this; + } if (this->IsAtEndOfLine()) + { return *this; + } this->m_RealIndex++; this->m_SegmentRemainder = (*this->m_RunLengthLine)[this->m_RealIndex].first; return *this; - } + } // ++ /** Decrement (prefix) along the scanline. * @@ -160,7 +168,9 @@ class ImageScanlineConstIterator> this->m_Index0--; this->m_SegmentRemainder++; if (this->m_SegmentRemainder <= (*this->m_RunLengthLine)[this->m_RealIndex].first) + { return *this; + } this->m_RealIndex--; this->m_SegmentRemainder = 1; diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 5a951b9d015..360e37f9c5a 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -115,7 +115,7 @@ RegionOfInterestImageFilter, typename Superclass::OutputImageType::PointType outputOrigin; inputPtr->TransformIndexToPhysicalPoint(roiStart, outputOrigin); outputPtr->SetOrigin(outputOrigin); -} +} // >::GenerateOutputInformation /** * RegionOfInterestImageFilter can be implemented as a multithreaded filter. @@ -163,7 +163,9 @@ RegionOfInterestImageFilter< while (!oIt.IsAtEnd()) { if (copyLines) + { oIt.Set(iIt.Get()); + } else // determine begin and end iterator and copy range { typename RLEImageType::RLLine & oLine = oIt.Value(); @@ -176,7 +178,9 @@ RegionOfInterestImageFilter< { t += iLine[x].first; if (t > start[0]) + { break; + } } assert(x < iLine.size()); @@ -199,10 +203,14 @@ RegionOfInterestImageFilter< { t += iLine[x].first; if (t >= end[0]) + { break; + } } if (t == end[0]) + { oLine.insert(oLine.end(), iLine.begin() + begin, iLine.begin() + x + 1); + } else // we need to take special care of the last segment { oLine.insert(oLine.end(), iLine.begin() + begin, iLine.begin() + x); @@ -212,7 +220,7 @@ RegionOfInterestImageFilter< ++iIt; ++oIt; } -} +} // >::ThreadedGenerateData template @@ -301,7 +309,7 @@ RegionOfInterestImageFilter, typename Superclass::OutputImageType::PointType outputOrigin; inputPtr->TransformIndexToPhysicalPoint(roiStart, outputOrigin); outputPtr->SetOrigin(outputOrigin); -} +} // >::GenerateOutputInformation /** * RegionOfInterestImageFilter can be implemented as a multithreaded filter. @@ -363,7 +371,7 @@ RegionOfInterestImageFilter, RLEImage::ThreadedGenerateData template @@ -452,7 +460,7 @@ RegionOfInterestImageFilter, typename Superclass::OutputImageType::PointType outputOrigin; inputPtr->TransformIndexToPhysicalPoint(roiStart, outputOrigin); outputPtr->SetOrigin(outputOrigin); -} +} // >::GenerateOutputInformation /** * RegionOfInterestImageFilter can be implemented as a multithreaded filter. @@ -503,7 +511,9 @@ RegionOfInterestImageFilter, Imag { t += iLine[x].first; if (t > start[0]) + { break; + } } assert(x < iLine.size()); @@ -529,7 +539,9 @@ RegionOfInterestImageFilter, Imag { t += iLine[x].first; if (t >= end[0]) + { break; + } for (SizeValueType i = 0; i < iLine[x].first; i++) { oIt.Set(iLine[x].second); @@ -544,7 +556,7 @@ RegionOfInterestImageFilter, Imag } ++iIt; } -} +} // >::ThreadedGenerateData } // end namespace itk #endif // itkRLERegionOfInterestImageFilter_hxx From 07a636c4814d81a91362295dd3815f4bb116e959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 27 Jul 2016 16:12:26 -0400 Subject: [PATCH 19/95] ENH: Specialization for different in/out pixel/counter types and signed/unsigned correctness --- .../Filtering/RLEImage/include/itkRLEImage.h | 4 +- .../RLEImage/include/itkRLEImage.hxx | 6 +- .../include/itkRLEImageConstIterator.h | 2 +- .../itkRLERegionOfInterestImageFilter.h | 111 +++++++ .../itkRLERegionOfInterestImageFilter.hxx | 288 ++++++++++++++---- .../RLEImage/test/itkImageIteratorTest.cxx | 4 +- .../test/itkImageRegionIteratorTest.cxx | 4 +- .../test/itkImageScanlineIteratorTest1.cxx | 4 +- .../RLEImage/test/itkRLEImageTest.cxx | 153 +++++++++- 9 files changed, 498 insertions(+), 78 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 7f9b8e04f54..418ca23d3d9 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -69,6 +69,8 @@ class RLEImage : public itk::ImageBase * or other operations. */ typedef TPixel PixelType; + typedef CounterType RLCounterType; + /** Typedef alias for PixelType */ typedef TPixel ValueType; @@ -179,7 +181,7 @@ class RLEImage : public itk::ImageBase * Returns difference in line length which happens due to merging or splitting segments. * This method is used by iterators directly. */ int - SetPixel(RLLine & line, IndexValueType & segmentRemainder, IndexValueType & m_RealIndex, const TPixel & value); + SetPixel(RLLine & line, IndexValueType & segmentRemainder, SizeValueType & m_RealIndex, const TPixel & value); /** \brief Get a pixel. SLOW! Better use iterators for pixel access. */ const TPixel & diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index 93e423dfd09..38f0853527e 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -134,7 +134,7 @@ template int RLEImage::SetPixel(RLLine & line, IndexValueType & segmentRemainder, - IndexValueType & m_RealIndex, + SizeValueType & m_RealIndex, const TPixel & value) { // complete Run-Length Lines have to be buffered @@ -235,7 +235,7 @@ RLEImage::SetPixel(const IndexType & index typename BufferType::IndexType bi = truncateIndex(index); RLLine & line = m_Buffer->GetPixel(bi); IndexValueType t = 0; - for (IndexValueType x = 0; x < line.size(); x++) + for (SizeValueType x = 0; x < line.size(); x++) { t += line[x].first; if (t > index[0] - bri0) @@ -259,7 +259,7 @@ RLEImage::GetPixel(const IndexType & index typename BufferType::IndexType bi = truncateIndex(index); RLLine & line = m_Buffer->GetPixel(bi); IndexValueType t = 0; - for (IndexValueType x = 0; x < line.size(); x++) + for (SizeValueType x = 0; x < line.size(); x++) { t += line[x].first; if (t > index[0] - bri0) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index c3ecaa811a8..425b425a3ea 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -389,7 +389,7 @@ class ImageConstIterator> const RLLine * m_RunLengthLine; - mutable IndexValueType m_RealIndex; // index into line's segment + mutable SizeValueType m_RealIndex; // index into line's segment mutable IndexValueType m_SegmentRemainder; // how many pixels remain in current segment IndexValueType m_BeginIndex0; // index to first pixel in region in relation to buffer start diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index cbd69e62e90..fcd534d274f 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -133,6 +133,117 @@ class RegionOfInterestImageFilter RegionType m_RegionOfInterest; }; +template +class RegionOfInterestImageFilter, + RLEImage> + : public ImageToImageFilter, + RLEImage> +{ +public: + /** Standard class typedefs. */ + typedef RegionOfInterestImageFilter Self; + typedef RLEImage RLEImageTypeIn; + typedef RLEImage RLEImageTypeOut; + typedef RLEImageTypeOut ImageType; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + typedef typename Superclass::InputImageRegionType InputImageRegionType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(RegionOfInterestImageFilter, ImageToImageFilter); + + /** Typedef to describe the input image region types. */ + typedef typename RLEImageTypeIn::RegionType RegionType; + typedef typename RLEImageTypeIn::IndexType IndexType; + typedef typename RLEImageTypeIn::SizeType SizeType; + + /** Typedef to describe the type of pixel. */ + typedef typename RLEImageTypeOut::PixelType OutputImagePixelType; + typedef typename RLEImageTypeIn::PixelType InputImagePixelType; + + /** Set/Get the output image region. */ + itkSetMacro(RegionOfInterest, RegionType); + itkGetConstMacro(RegionOfInterest, RegionType); + + /** ImageDimension enumeration */ + itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, VImageDimension); + +#ifdef ITK_USE_CONCEPT_CHECKING + // Begin concept checking + itkConceptMacro(SameDimensionCheck, (Concept::SameDimension)); + itkConceptMacro(InputConvertibleToOutputCheck, (Concept::Convertible)); +// End concept checking +#endif + +protected: + RegionOfInterestImageFilter() {} + ~RegionOfInterestImageFilter() {} + void + PrintSelf(std::ostream & os, Indent indent) const; + + virtual void + GenerateInputRequestedRegion(); + + virtual void + EnlargeOutputRequestedRegion(DataObject * output); + + /** RegionOfInterestImageFilter can produce an image which is a different + * size than its input image. As such, RegionOfInterestImageFilter + * needs to provide an implementation for + * GenerateOutputInformation() in order to inform the pipeline + * execution model. The original documentation of this method is + * below. + * + * \sa ProcessObject::GenerateOutputInformaton() */ + virtual void + GenerateOutputInformation(); + + /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. + * Therefore, this implementation provides a ThreadedGenerateData() + * routine which is called for each processing thread. The output + * image data is allocated automatically by the superclass prior to + * calling ThreadedGenerateData(). ThreadedGenerateData can only + * write to the portion of the output image specified by the + * parameter "outputRegionForThread" + * \sa ImageToImageFilter::ThreadedGenerateData(), + * ImageToImageFilter::GenerateData() */ + void + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId); + +private: + RegionOfInterestImageFilter(const Self &); // purposely not implemented + void + operator=(const Self &); // purposely not implemented + + RegionType m_RegionOfInterest; +}; + +// not implemented on purpose, so it will produce a meaningful error message +template +class InputAndOutputImagesMustHaveSameDimension; + +// input and output images must have the same dimension (e.g. both 2D or both 3D) +// so disallow this by inheriting from unimplemented base class +template +class RegionOfInterestImageFilter, + RLEImage> + : InputAndOutputImagesMustHaveSameDimension +{}; + template class RegionOfInterestImageFilter, RLEImage> : public ImageToImageFilter, RLEImage> diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 360e37f9c5a..cde20e3d2a2 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -25,9 +25,73 @@ #include "itkObjectFactory.h" #include "itkProgressReporter.h" #include "itkRegionOfInterestImageFilter.h" +#include namespace itk { +template +void +copyImagePortion(ImageRegionConstIterator iIt, + ImageRegionIterator oIt, + IndexValueType start0, + IndexValueType end0) +{ + while (!oIt.IsAtEnd()) + { + // determine begin and end iterator and copy range + typename RLEImageTypeOut::RLLine & oLine = oIt.Value(); + oLine.clear(); + const typename RLEImageTypeIn::RLLine & iLine = iIt.Value(); + typename RLEImageTypeIn::RLCounterType t = 0; + SizeValueType x = 0; + // find start + for (; x < iLine.size(); x++) + { + t += iLine[x].first; + if (t > start0) + { + break; + } + } + assert(x < iLine.size()); + + SizeValueType begin = x; + if (t >= end0) // both begin and end are in this segment + { + oLine.push_back(typename RLEImageTypeOut::RLSegment(end0 - start0, iLine[x].second)); + ++iIt; + ++oIt; + continue; // next line + } + else if (t - start0 < iLine[x].first) // not the first pixel in segment + { + oLine.push_back(typename RLEImageTypeOut::RLSegment(t - start0, iLine[x].second)); + begin++; // start copying from next segment + } + + for (x++; x < iLine.size(); x++) + { + t += iLine[x].first; + if (t >= end0) + { + break; + } + } + if (t == end0) + { + oLine.insert(oLine.end(), iLine.begin() + begin, iLine.begin() + x + 1); + } + else // we need to take special care of the last segment + { + oLine.insert(oLine.end(), iLine.begin() + begin, iLine.begin() + x); + oLine.push_back(typename RLEImageTypeOut::RLSegment(end0 + iLine[x].first - t, iLine[x].second)); + } + + ++iIt; + ++oIt; + } +} // copyImagePortion + template void RegionOfInterestImageFilter, @@ -160,66 +224,175 @@ RegionOfInterestImageFilter< ImageRegionConstIterator iIt(in->GetBuffer(), iReg); ImageRegionIterator oIt(out->GetBuffer(), oReg); - while (!oIt.IsAtEnd()) + if (copyLines) { - if (copyLines) + while (!oIt.IsAtEnd()) { oIt.Set(iIt.Get()); + + ++iIt; + ++oIt; } - else // determine begin and end iterator and copy range - { - typename RLEImageType::RLLine & oLine = oIt.Value(); - oLine.clear(); - const typename RLEImageType::RLLine & iLine = iIt.Value(); - CounterType t = 0; - SizeValueType x = 0; - // find start - for (; x < iLine.size(); x++) - { - t += iLine[x].first; - if (t > start[0]) - { - break; - } - } - assert(x < iLine.size()); + } + else + { + copyImagePortion(iIt, oIt, start[0], end[0]); + } +} // >::ThreadedGenerateData - SizeValueType begin = x; - if (t >= end[0]) // both begin and end are in this segment - { - oLine.push_back(typename RLEImageType::RLSegment(end[0] - start[0], iLine[x].second)); - ++iIt; - ++oIt; - continue; // next line - } - else if (t - start[0] < iLine[x].first) // not the first pixel in segment - { - oLine.push_back(typename RLEImageType::RLSegment(t - start[0], iLine[x].second)); - begin++; // start copying from next segment - } - // if (t < end[0]) - for (x++; x < iLine.size(); x++) - { - t += iLine[x].first; - if (t >= end[0]) - { - break; - } - } - if (t == end[0]) - { - oLine.insert(oLine.end(), iLine.begin() + begin, iLine.begin() + x + 1); - } - else // we need to take special care of the last segment - { - oLine.insert(oLine.end(), iLine.begin() + begin, iLine.begin() + x); - oLine.push_back(typename RLEImageType::RLSegment(end[0] + iLine[x].first - t, iLine[x].second)); - } - } - ++iIt; - ++oIt; +template +void +RegionOfInterestImageFilter, + RLEImage>::PrintSelf(std::ostream & os, + Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "RegionOfInterest: " << m_RegionOfInterest << std::endl; +} + +template +void +RegionOfInterestImageFilter, + RLEImage>::GenerateInputRequestedRegion() +{ + // call the superclass' implementation of this method + Superclass::GenerateInputRequestedRegion(); + + // get pointer to the input + typename Superclass::InputImagePointer inputPtr = const_cast(this->GetInput()); + + if (inputPtr) + { + // request the region of interest + inputPtr->SetRequestedRegion(m_RegionOfInterest); } +} + +template +void +RegionOfInterestImageFilter< + RLEImage, + RLEImage>::EnlargeOutputRequestedRegion(DataObject * output) +{ + // call the superclass' implementation of this method + Superclass::EnlargeOutputRequestedRegion(output); + + // generate everything in the region of interest + output->SetRequestedRegionToLargestPossibleRegion(); +} + +/** + * RegionOfInterestImageFilter can produce an image which is a different size + * than its input image. As such, RegionOfInterestImageFilter needs to provide an + * implementation for GenerateOutputInformation() in order to inform + * the pipeline execution model. The original documentation of this + * method is below. + * + * \sa ProcessObject::GenerateOutputInformaton() + */ +template +void +RegionOfInterestImageFilter, + RLEImage>::GenerateOutputInformation() +{ + // do not call the superclass' implementation of this method since + // this filter allows the input the output to be of different dimensions + + // get pointers to the input and output + typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); + typename Superclass::InputImageConstPointer inputPtr = this->GetInput(); + + if (!outputPtr || !inputPtr) + { + return; + } + + // Set the output image size to the same value as the region of interest. + RegionType region; + IndexType start; + start.Fill(0); + + region.SetSize(m_RegionOfInterest.GetSize()); + region.SetIndex(start); + + // Copy Information without modification. + outputPtr->CopyInformation(inputPtr); + + // Adjust output region + outputPtr->SetLargestPossibleRegion(region); + + // Correct origin of the extracted region. + IndexType roiStart(m_RegionOfInterest.GetIndex()); + typename Superclass::OutputImageType::PointType outputOrigin; + inputPtr->TransformIndexToPhysicalPoint(roiStart, outputOrigin); + outputPtr->SetOrigin(outputOrigin); +} // >::GenerateOutputInformation + +/** + * RegionOfInterestImageFilter can be implemented as a multithreaded filter. + * Therefore, this implementation provides a ThreadedGenerateData() + * routine which is called for each processing thread. The output + * image data is allocated automatically by the superclass prior to + * calling ThreadedGenerateData(). ThreadedGenerateData can only + * write to the portion of the output image specified by the + * parameter "outputRegionForThread" + * + * \sa ImageToImageFilter::ThreadedGenerateData(), + * ImageToImageFilter::GenerateData() + */ +template +void +RegionOfInterestImageFilter< + RLEImage, + RLEImage>::ThreadedGenerateData(const RegionType & outputRegionForThread, + ThreadIdType threadId) +{ + // Get the input and output pointers + const RLEImageTypeIn * in = this->GetInput(); + RLEImageTypeOut * out = this->GetOutput(); + + // Define the portion of the input to walk for this thread + InputImageRegionType inputRegionForThread; + inputRegionForThread.SetSize(outputRegionForThread.GetSize()); + + IndexType start, end; + IndexType roiStart(m_RegionOfInterest.GetIndex()); + IndexType threadStart(outputRegionForThread.GetIndex()); + for (unsigned int i = 0; i < VImageDimension; i++) + { + start[i] = roiStart[i] + threadStart[i]; + end[i] = roiStart[i] + threadStart[i] + outputRegionForThread.GetSize(i); + } + inputRegionForThread.SetIndex(start); + + typename RLEImageTypeIn::BufferType::RegionType iReg = RLEImageTypeIn::truncateRegion(inputRegionForThread); + typename RLEImageTypeOut::BufferType::RegionType oReg = RLEImageTypeOut::truncateRegion(outputRegionForThread); + ImageRegionConstIterator iIt(in->GetBuffer(), iReg); + ImageRegionIterator oIt(out->GetBuffer(), oReg); + + copyImagePortion(iIt, oIt, start[0], end[0]); } // >::ThreadedGenerateData @@ -517,10 +690,9 @@ RegionOfInterestImageFilter, Imag } assert(x < iLine.size()); - SizeValueType begin = x; if (t >= end[0]) // both begin and end are in this segment { - for (SizeValueType i = start[0]; i < end[0]; i++) + for (IndexValueType i = start[0]; i < end[0]; i++) { oIt.Set(iLine[x].second); ++oIt; @@ -529,7 +701,7 @@ RegionOfInterestImageFilter, Imag continue; // next line } // else handle the beginning segment - for (SizeValueType i = start[0]; i < t; i++) + for (IndexValueType i = start[0]; i < t; i++) { oIt.Set(iLine[x].second); ++oIt; @@ -542,14 +714,14 @@ RegionOfInterestImageFilter, Imag { break; } - for (SizeValueType i = 0; i < iLine[x].first; i++) + for (CounterType i = 0; i < iLine[x].first; i++) { oIt.Set(iLine[x].second); ++oIt; } } // handle the last segment - for (SizeValueType i = 0; i < end[0] + iLine[x].first - t; i++) + for (IndexValueType i = 0; i < end[0] + iLine[x].first - t; i++) { oIt.Set(iLine[x].second); ++oIt; diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx index ce4fce8ca93..e34f29ee027 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx @@ -50,8 +50,8 @@ itkImageIteratorTest(int, char *[]) std::cout << "Creating an image" << std::endl; itk::RLEImage>::Pointer o3 = itk::RLEImage>::New(); - float origin3D[ImageDimension] = { 5, 2.1, 8.1 }; - float spacing3D[ImageDimension] = { 1.5, 2.1, 1 }; + float origin3D[ImageDimension] = { 5.f, 2.1f, 8.1f }; + float spacing3D[ImageDimension] = { 1.5f, 2.1f, 1.f }; itk::RLEImage>::SizeType imageSize3D = { { 20, 40, 60 } }; diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx index d789604ea82..c688a6fa943 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx @@ -53,8 +53,8 @@ itkImageRegionIteratorTest(int, char *[]) int status = 0; - float origin3D[3] = { 5, 2.1, 8.1 }; - float spacing3D[3] = { 1.5, 2.1, 1 }; + float origin3D[3] = { 5.f, 2.1f, 8.1f }; + float spacing3D[3] = { 1.5f, 2.1f, 1.f }; itk::RLEImage>::SizeType imageSize3D = { { 20, 40, 60 } }; itk::RLEImage>::SizeType bufferSize3D = { { 20, 20, 17 } }; diff --git a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx index 4220d64f4ac..f3528e21e8f 100644 --- a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx @@ -52,8 +52,8 @@ itkImageScanlineIteratorTest1(int, char *[]) int status = EXIT_SUCCESS; - float origin3D[3] = { 5, 2.1, 8.1 }; - float spacing3D[3] = { 1.5, 2.1, 1 }; + float origin3D[3] = { 5.f, 2.1f, 8.1f }; + float spacing3D[3] = { 1.5f, 2.1f, 1.f }; typedef itk::RLEImage> ImageType; diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 83546ffa7c7..071f182bd0e 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -22,6 +22,103 @@ #include #include +template +void +compare(itk::SmartPointer im1, itk::SmartPointer im2) +{ + itk::ImageRegionConstIterator it1(im1, im1->GetLargestPossibleRegion()); + itk::ImageRegionConstIterator it2(im2, im2->GetLargestPossibleRegion()); + while (!it1.IsAtEnd()) + { + if (it1.Get() != it2.Get()) + { + itkGenericExceptionMacro(<< "Images differ. Val1: " << it1.Get() << " Val2: " << it2.Get() + << "\nInd1: " << it1.GetIndex() << " Ind2: " << it2.GetIndex()); + } + ++it1; + ++it2; + } +} + +template +void +roiTest(itk::SmartPointer> orig) +{ + typedef itk::RLEImage myRLEImage; + typedef itk::RLEImage charRLEImage; + typedef itk::RegionOfInterestImageFilter charConverterType; + typename charConverterType::Pointer cConv = charConverterType::New(); + cConv->SetInput(orig); + cConv->SetRegionOfInterest(orig->GetLargestPossibleRegion()); + cConv->Update(); + typename charRLEImage::Pointer cIn = cConv->GetOutput(); + + typedef itk::RLEImage ucharRLEImage; + typedef itk::RegionOfInterestImageFilter ucharConverterType; + typename ucharConverterType::Pointer ucConv = ucharConverterType::New(); + ucConv->SetInput(orig); + ucConv->SetRegionOfInterest(orig->GetLargestPossibleRegion()); + ucConv->Update(); + typename ucharRLEImage::Pointer ucIn = ucConv->GetOutput(); + + std::cout << "Comparing direct conversions..."; + compare(cIn, ucIn); + std::cout << "OK" << std::endl; + + typename myRLEImage::RegionType reg = orig->GetLargestPossibleRegion(); + typename myRLEImage::RegionType rNeg = reg; + for (int i = 0; i < ImageType::ImageDimension; i++) + { + rNeg.SetIndex(i, -typename myRLEImage::IndexValueType(reg.GetSize(i)) * 3 / 4); + } + cIn->SetRegions(rNeg); + ucIn->SetRegions(rNeg); + std::cout << "Comparing LPR with negative indices..."; + compare(cIn, ucIn); + std::cout << "OK" << std::endl; + + // region for partial coverage, skip X due to RLE representation constraints + for (int i = 1; i < ImageType::ImageDimension; i++) + { + reg.GetModifiableIndex()[i] += (reg.GetSize(i) - 1) / 4; + rNeg.GetModifiableIndex()[i] += typename myRLEImage::IndexValueType(rNeg.GetSize(i) - 1) / 4; + reg.SetSize(i, (reg.GetSize(i) + 1) / 2); + rNeg.SetSize(i, (rNeg.GetSize(i) + 1) / 2); + } + + typedef itk::RegionOfInterestImageFilter myConverterType; + typename myConverterType::Pointer myConv = myConverterType::New(); + myConv->SetInput(orig); + myConv->SetRegionOfInterest(reg); + myConv->Update(); + typename myRLEImage::Pointer myIn = myConv->GetOutput(); + + typedef itk::RegionOfInterestImageFilter cRoIType; + typename cRoIType::Pointer cRoI = cRoIType::New(); + cRoI->SetInput(cIn); + cRoI->SetRegionOfInterest(rNeg); + cRoI->Update(); + cIn = cRoI->GetOutput(); + cIn->DisconnectPipeline(); + + typedef itk::RegionOfInterestImageFilter ucRoIType; + typename ucRoIType::Pointer ucRoI = ucRoIType::New(); + ucRoI->SetInput(ucIn); + ucRoI->SetRegionOfInterest(rNeg); + ucRoI->Update(); + ucIn = ucRoI->GetOutput(); + ucIn->DisconnectPipeline(); + + std::cout << "Comparing RoIs with negative indices..."; + compare(cIn, ucIn); + std::cout << "OK" << std::endl; + + std::cout << "Comparing RoIs with negative and positive indices..."; + compare(cIn, myIn); + compare(ucIn, myIn); + std::cout << "OK" << std::endl; +} + template void doTest(std::string inFilename, std::string outFilename) @@ -29,6 +126,7 @@ doTest(std::string inFilename, std::string outFilename) typedef itk::ImageFileReader ReaderType; typename ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inFilename); + std::cout << "Reading " << inFilename << std::endl; reader->Update(); typedef itk::RLEImage myRLEImage; @@ -36,22 +134,45 @@ doTest(std::string inFilename, std::string outFilename) typename inConverterType::Pointer inConv = inConverterType::New(); inConv->SetInput(reader->GetOutput()); inConv->SetRegionOfInterest(reader->GetOutput()->GetLargestPossibleRegion()); + std::cout << "Converting regular image to RLEImage" << std::endl; inConv->Update(); typename myRLEImage::Pointer test = inConv->GetOutput(); + itk::SizeValueType xSize = test->GetLargestPossibleRegion().GetSize(0); - // region for partial coverage - typename myRLEImage::RegionType reg = test->GetLargestPossibleRegion(); - // skip X due to RLE representation constraints - // for (int i = 1; i < ImageType::ImageDimension; i++) - // { - // reg.GetModifiableIndex()[i] += (reg.GetSize(i) - 1) / 4; - // reg.SetSize(i, (reg.GetSize(i) + 1) / 2); - // } + std::cout << "Running region of interest tests" << std::endl; + bool shouldHaveThrown = false; + if (xSize > 127) + { + std::cout << "\nThis test should fail because xSize>127" << std::endl; + shouldHaveThrown = true; + } + try + { + roiTest(test); + } + catch (itk::ExceptionObject & error) + { + std::cerr << error << std::endl; + if (shouldHaveThrown) + { + std::cout << "Exception caught successfully" << std::endl; + shouldHaveThrown = false; + } + else + { + throw error; + } + } + if (shouldHaveThrown) + { + itkGenericExceptionMacro(<< "Exception was expected but none occurred (xSize>127)"); + } typedef itk::RegionOfInterestImageFilter outConverterType; typename outConverterType::Pointer outConv = outConverterType::New(); outConv->SetInput(test); - outConv->SetRegionOfInterest(reg); + outConv->SetRegionOfInterest(test->GetLargestPossibleRegion()); + std::cout << "Converting RLEImage to regular image" << std::endl; outConv->Update(); typedef itk::ImageFileWriter WriterType; @@ -59,7 +180,21 @@ doTest(std::string inFilename, std::string outFilename) writer->SetFileName(outFilename); writer->SetInput(outConv->GetOutput()); writer->SetUseCompression(true); + std::cout << "Writing " << outFilename << std::endl; writer->Update(); + std::cout << "Test finished" << std::endl; +} + +void +dimTest() +{ + typedef itk::RLEImage S2Type; // 2D + typedef itk::RLEImage S3Type; // 2D + typedef itk::RegionOfInterestImageFilter RoIType; + + // instantiation of "RoIType" is dissalowed due to different dimension + // uncommenting the line below should give a meaningful error message + // typename RoIType::Pointer roi = RoIType::New(); } int From b3a9dc12f7cd2d1aa67882aadb2e74e325713c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 29 Jul 2016 11:29:35 -0400 Subject: [PATCH 20/95] ENH: Adding RLEImage specific tests --- Modules/Filtering/RLEImage/test/CMakeLists.txt | 10 +++++++++- .../Filtering/RLEImage/test/Input/brainParc.mha.md5 | 1 + Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 | 1 + Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 | 1 + .../Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 | 1 + Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 5 +++++ 8 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 Modules/Filtering/RLEImage/test/Input/brainParc.mha.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index c2ee94d194e..85372e1fc81 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -41,7 +41,15 @@ function(ReadWriteTest ImageName Ext) ) endfunction() -# Handcrafted tests +# RLEImage specific tests +readwritetest(brainParc mha) +readwritetest(vb-seg mha) +readwritetest(ws nrrd) +readwritetest(wb-crop nrrd) +readwritetest(wb-seg nrrd) +readwritetest(wb-seg32 nrrd) + +# Handcrafted tests for MorphologicalContourInterpolation readwritetest(Empty nrrd) readwritetest(NoSlices nrrd) readwritetest(Micro1 nrrd) diff --git a/Modules/Filtering/RLEImage/test/Input/brainParc.mha.md5 b/Modules/Filtering/RLEImage/test/Input/brainParc.mha.md5 new file mode 100644 index 00000000000..be61e4db0f4 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/brainParc.mha.md5 @@ -0,0 +1 @@ +00b63181ddcf7a188b8d56317778ca8e diff --git a/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 b/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 new file mode 100644 index 00000000000..c6bbae2bb8d --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 @@ -0,0 +1 @@ +2b7dc9466c4b72915eddbe1623958b28 diff --git a/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 new file mode 100644 index 00000000000..f792bfb9242 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 @@ -0,0 +1 @@ +76d18476a7d4b202c4fa06cd7d23cca3 diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 new file mode 100644 index 00000000000..2931c4383e6 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 @@ -0,0 +1 @@ +0a7a975f6f0506d639e69df057cf8aef diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 new file mode 100644 index 00000000000..965bed64a39 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 @@ -0,0 +1 @@ +e0cc36e9f1db3f7b23207914b10e112d diff --git a/Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 new file mode 100644 index 00000000000..861be820b86 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 @@ -0,0 +1 @@ +17c66c3683cd20442f81ee2ea1a3aad9 diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 071f182bd0e..258b7d6e9fb 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -234,6 +234,11 @@ itkRLEImageTest(int argc, char * argv[]) doTest>(inputImageFileName, outputImageFileName); return EXIT_SUCCESS; } + if (numDimensions == 3) // if not (u)short, then interpret as uint + { + doTest>(inputImageFileName, outputImageFileName); + return EXIT_SUCCESS; + } if (numDimensions == 4 && pixelType == itk::ImageIOBase::UCHAR) { doTest>(inputImageFileName, outputImageFileName); From 1e08e910c284a0890effb70c81bee6f817fdfc39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 29 Jul 2016 14:55:52 -0400 Subject: [PATCH 21/95] COMP: Trying to resolve build failures in the main repository --- Modules/Filtering/RLEImage/itk-module.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Filtering/RLEImage/itk-module.cmake b/Modules/Filtering/RLEImage/itk-module.cmake index 3f4089dff66..fde36ae4330 100644 --- a/Modules/Filtering/RLEImage/itk-module.cmake +++ b/Modules/Filtering/RLEImage/itk-module.cmake @@ -12,6 +12,7 @@ itk_module( ITKCommon ITKImageGrid TEST_DEPENDS + ITKCommon ITKIOImageBase ITKTestKernel EXCLUDE_FROM_DEFAULT From 9a1f7cd7af16075e21907a707f0c35a904814371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 15 Aug 2016 17:32:16 -0400 Subject: [PATCH 22/95] ENH: Manual update before using uncrustify --- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 13 +++++++------ .../RLEImage/include/itkRLEImageConstIterator.h | 7 ++----- .../RLEImage/include/itkRLEImageIterator.h | 6 +++--- .../include/itkRLEImageRegionConstIterator.h | 11 ++--------- .../RLEImage/include/itkRLEImageRegionIterator.h | 9 +++------ .../include/itkRLERegionOfInterestImageFilter.hxx | 4 ++-- 6 files changed, 19 insertions(+), 31 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index 38f0853527e..f097a412113 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -278,7 +278,9 @@ RLEImage::PrintSelf(std::ostream & os, itk os << indent << "Internal image (for storage of RLLine-s): " << std::endl; m_Buffer->Print(os, indent.GetNextIndent()); - itk::SizeValueType c = 0; + itk::SizeValueType c = 0; + itk::SizeValueType pixelCount = this->GetOffsetTable()[VImageDimension]; + itk::ImageRegionConstIterator it(m_Buffer, m_Buffer->GetBufferedRegion()); while (!it.IsAtEnd()) { @@ -286,13 +288,12 @@ RLEImage::PrintSelf(std::ostream & os, itk ++it; } - double cr = - double(c * (sizeof(PixelType) + sizeof(CounterType)) + - sizeof(std::vector) * this->GetOffsetTable()[VImageDimension] / this->GetOffsetTable()[1]) / - (this->GetOffsetTable()[VImageDimension] * sizeof(PixelType)); + itk::SizeValueType memUsed = + c * sizeof(RLSegment) + sizeof(std::vector) * (pixelCount / this->GetOffsetTable()[1]); + double cr = double(memUsed) / (pixelCount * sizeof(PixelType)); os << indent << "OnTheFlyCleanup: " << (m_OnTheFlyCleanup ? "On" : "Off") << std::endl; - os << indent << "RLEImage compressed pixel count: " << c << std::endl; + os << indent << "RLSegment count: " << c << std::endl; int prec = os.precision(3); os << indent << "Compressed size in relation to original size: " << cr * 100 << "%" << std::endl; os.precision(prec); diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 425b425a3ea..7903e1b95fe 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -432,10 +432,7 @@ class ImageConstIteratorWithIndex /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ - ImageConstIteratorWithIndex(const ImageConstIteratorWithIndex & it) - { - this->ImageConstIterator::operator=(it); - } + ImageConstIteratorWithIndex(const ImageConstIteratorWithIndex & it) { ImageConstIterator::operator=(it); } /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ ImageConstIteratorWithIndex(const ImageType * ptr, const RegionType & region) @@ -465,7 +462,7 @@ class ImageConstIteratorWithOnlyIndexImageConstIterator::operator=(it); + ImageConstIterator::operator=(it); } /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 631d3442c4e..86caca3eb56 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -80,7 +80,7 @@ class ImageIterator> Self & operator=(const Self & it) { - this->ImageConstIterator::operator=(it); + ImageConstIterator::operator=(it); return *this; } @@ -123,7 +123,7 @@ class ImageIterator> Self & operator=(const ImageConstIterator & it) { - this->ImageConstIterator::operator=(it); + ImageConstIterator::operator=(it); return *this; } }; @@ -143,10 +143,10 @@ class ImageIteratorWithIndex> : ImageConstIteratorWithIndex() {} - /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageIteratorWithIndex(const ImageIteratorWithIndex & it) { this->ImageIterator::operator=(it); } + /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ ImageIteratorWithIndex(const ImageType * ptr, const RegionType & region) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index f344d411228..75fa2462abf 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -88,11 +88,7 @@ class ImageRegionConstIterator> * provide overloaded APIs that return different types of Iterators, itk * returns ImageIterators and uses constructors to cast from an * ImageIterator to a ImageRegionConstIterator. */ - ImageRegionConstIterator(const ImageIterator & it) - { - this->ImageConstIterator::operator=(it); - // this->ImageConstIterator< ImageType >::operator=(static_cast >(it)); - } + ImageRegionConstIterator(const ImageIterator & it) { ImageConstIterator::operator=(it); } /** Constructor that can be used to cast from an ImageConstIterator to an * ImageRegionConstIterator. Many routines return an ImageIterator, but for a @@ -100,10 +96,7 @@ class ImageRegionConstIterator> * provide overloaded APIs that return different types of Iterators, itk * returns ImageIterators and uses constructors to cast from an * ImageIterator to a ImageRegionConstIterator. */ - ImageRegionConstIterator(const ImageConstIterator & it) - { - this->ImageConstIterator::operator=(it); - } + ImageRegionConstIterator(const ImageConstIterator & it) { ImageConstIterator::operator=(it); } /** Increment (prefix) the fastest moving dimension of the iterator's index. * This operator will constrain the iterator within the region (i.e. the * iterator will automatically wrap from the end of the row of the region diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index fd53e0cb85d..3b5de31004c 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -81,7 +81,7 @@ class ImageRegionIterator> * provide overloaded APIs that return different types of Iterators, itk * returns ImageIterators and uses constructors to cast from an * ImageIterator to a ImageRegionIterator. */ - ImageRegionIterator(const ImageIterator & it) { this->ImageConstIterator::operator=(it); } + ImageRegionIterator(const ImageIterator & it) { ImageConstIterator::operator=(it); } /** Set the pixel value. * Changing the RLE structure invalidates all other iterators (except this one). */ void @@ -97,14 +97,11 @@ class ImageRegionIterator> protected: /** the construction from a const iterator is declared protected in order to enforce const correctness. */ - ImageRegionIterator(const ImageRegionConstIterator & it) - { - this->ImageConstIterator::operator=(it); - } + ImageRegionIterator(const ImageRegionConstIterator & it) { ImageConstIterator::operator=(it); } Self & operator=(const ImageRegionConstIterator & it) { - this->ImageConstIterator::operator=(it); + ImageConstIterator::operator=(it); } }; diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index cde20e3d2a2..44e0205bba7 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -219,8 +219,8 @@ RegionOfInterestImageFilter< inputRegionForThread.SetIndex(start); bool copyLines = (in->GetLargestPossibleRegion().GetSize(0) == outputRegionForThread.GetSize(0)); - typename ImageType::BufferType::RegionType oReg = ImageType::truncateRegion(outputRegionForThread), - iReg = ImageType::truncateRegion(inputRegionForThread); + typename ImageType::BufferType::RegionType oReg = ImageType::truncateRegion(outputRegionForThread); + typename ImageType::BufferType::RegionType iReg = ImageType::truncateRegion(inputRegionForThread); ImageRegionConstIterator iIt(in->GetBuffer(), iReg); ImageRegionIterator oIt(out->GetBuffer(), oReg); From cce7f6bb26303ea108a31285f568a3e6d92f3220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 16 Aug 2016 16:11:25 -0400 Subject: [PATCH 23/95] ENH: Aggressive uncrustify with manual corrections --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 10 ++++++---- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 6 +++++- .../RLEImage/include/itkRLEImageConstIterator.h | 9 +++++++-- .../Filtering/RLEImage/include/itkRLEImageIterator.h | 6 +++--- .../RLEImage/include/itkRLEImageRegionConstIterator.h | 6 ++++-- .../RLEImage/include/itkRLEImageRegionIterator.h | 7 +++++-- .../include/itkRLEImageScanlineConstIterator.h | 3 ++- .../RLEImage/include/itkRLEImageScanlineIterator.h | 8 ++++---- .../include/itkRLERegionOfInterestImageFilter.hxx | 10 ++++++---- 9 files changed, 42 insertions(+), 23 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 418ca23d3d9..10bfb4d3c86 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -20,7 +20,7 @@ #include #include -#include //std::pair +#include // std::pair #include namespace itk @@ -192,9 +192,9 @@ class RLEImage : public itk::ImageBase ///** \brief Access a pixel. Chaning it changes the whole RLE segment! */ // TPixel & operator[](const IndexType & index) - //{ + // { // return this->GetPixel(index); - //} + // } /** \brief Access a pixel. This version can only be an rvalue. * SLOW -> Use iterators instead. */ @@ -203,12 +203,14 @@ class RLEImage : public itk::ImageBase { return this->GetPixel(index); } + virtual unsigned int GetNumberOfComponentsPerPixel() const { // use the GetLength() method which works with variable length arrays, // to make it work with as much pixel types as possible PixelType p; + return itk::NumericTraits::GetLength(p); } @@ -270,7 +272,6 @@ class RLEImage : public itk::ImageBase } } - protected: RLEImage() : itk::ImageBase() @@ -279,6 +280,7 @@ class RLEImage : public itk::ImageBase // m_OnTheFlyCleanup = true; m_Buffer = BufferType::New(); } + void PrintSelf(std::ostream & os, itk::Indent indent) const; diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index f097a412113..dab317ce561 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -18,7 +18,7 @@ #ifndef itkRLEImage_hxx #define itkRLEImage_hxx -#include "itkImageRegionConstIterator.h" //for underlying buffer +#include "itkImageRegionConstIterator.h" // for underlying buffer #include "itkRLEImage.h" // include all specializations of iterators and filters @@ -89,6 +89,7 @@ RLEImage::FillBuffer(const TPixel & value) { RLSegment segment(CounterType(this->GetBufferedRegion().GetSize(0)), value); RLLine line(1); + line[0] = segment; m_Buffer->FillBuffer(line); } @@ -99,7 +100,9 @@ RLEImage::CleanUpLine(RLLine & line) const { CounterType x = 0; RLLine out; + out.reserve(this->GetLargestPossibleRegion().GetSize(0)); + do { out.push_back(line[x]); @@ -108,6 +111,7 @@ RLEImage::CleanUpLine(RLLine & line) const out.back().first += line[x].first; } } while (x < line.size()); + out.swap(line); } diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 7903e1b95fe..1170996a8ab 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -263,6 +263,7 @@ class ImageConstIterator> GetIndex() const { IndexType indR(m_Image->GetBufferedRegion().GetIndex()); + indR[0] += m_Index0; typename BufferType::IndexType bufInd = m_BI.GetIndex(); for (IndexValueType i = 1; i < VImageDimension; i++) @@ -291,6 +292,7 @@ class ImageConstIterator> GetRegion() const { RegionType r; + r.SetIndex(0, m_BeginIndex0 + m_Image->GetBufferedRegion().GetIndex(0)); r.SetSize(0, m_EndIndex0 - m_BeginIndex0); typename BufferType::RegionType ir = m_BI.GetRegion(); @@ -323,6 +325,7 @@ class ImageConstIterator> Value(void) const { RLLine & line = const_cast(this)->m_BI.Value(); + return line[m_RealIndex].second; } @@ -370,7 +373,6 @@ class ImageConstIterator> CounterType t = 0; SizeValueType x = 0; - for (; x < (*m_RunLengthLine).size(); x++) { t += (*m_RunLengthLine)[x].first; @@ -404,6 +406,7 @@ class ImageConstIteratorWithIndex : public ImageConstIterator> { // just inherit constructors + public: /** Image typedef support. */ typedef itk::RLEImage ImageType; @@ -433,6 +436,7 @@ class ImageConstIteratorWithIndex /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageConstIteratorWithIndex(const ImageConstIteratorWithIndex & it) { ImageConstIterator::operator=(it); } + /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ ImageConstIteratorWithIndex(const ImageType * ptr, const RegionType & region) @@ -445,6 +449,7 @@ class ImageConstIteratorWithOnlyIndex> { // just inherit constructors + public: /** Image typedef support. */ typedef itk::RLEImage ImageType; @@ -457,13 +462,13 @@ class ImageConstIteratorWithOnlyIndex() {} - /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageConstIteratorWithOnlyIndex(const ImageConstIteratorWithOnlyIndex & it) { ImageConstIterator::operator=(it); } + /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ ImageConstIteratorWithOnlyIndex(const ImageType * ptr, const RegionType & region) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 86caca3eb56..e99822c4736 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -101,9 +101,9 @@ class ImageIterator> // * If we wanted to safely enable it, // * we would isolate this pixel into its own segment. */ // PixelType & Value(void) - //{ + // { // return m_Buffer[m_Index[2]][m_Index[1]][m_RealIndex].second; - //} + // } /** Get the image that this iterator walks. */ ImageType * @@ -145,7 +145,7 @@ class ImageIteratorWithIndex> /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ - ImageIteratorWithIndex(const ImageIteratorWithIndex & it) { this->ImageIterator::operator=(it); } + ImageIteratorWithIndex(const ImageIteratorWithIndex & it) { ImageIterator::operator=(it); } /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index 75fa2462abf..332190eb0d3 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -97,6 +97,7 @@ class ImageRegionConstIterator> * returns ImageIterators and uses constructors to cast from an * ImageIterator to a ImageRegionConstIterator. */ ImageRegionConstIterator(const ImageConstIterator & it) { ImageConstIterator::operator=(it); } + /** Increment (prefix) the fastest moving dimension of the iterator's index. * This operator will constrain the iterator within the region (i.e. the * iterator will automatically wrap from the end of the row of the region @@ -208,7 +209,7 @@ class ImageRegionConstIteratorWithIndex & it) { - this->ImageRegionConstIterator::operator=(it); + ImageRegionConstIterator::operator=(it); } }; // no additional implementation required @@ -217,6 +218,7 @@ class ImageRegionConstIteratorWithOnlyIndex> { // just inherit constructors + public: typedef itk::RLEImage ImageType; @@ -241,7 +243,7 @@ class ImageRegionConstIteratorWithOnlyIndex & it) { - this->ImageRegionConstIterator::operator=(it); + ImageRegionConstIterator::operator=(it); } }; // no additional implementation required } // end namespace itk diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index 3b5de31004c..1a89bdf157d 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -82,6 +82,7 @@ class ImageRegionIterator> * returns ImageIterators and uses constructors to cast from an * ImageIterator to a ImageRegionIterator. */ ImageRegionIterator(const ImageIterator & it) { ImageConstIterator::operator=(it); } + /** Set the pixel value. * Changing the RLE structure invalidates all other iterators (except this one). */ void @@ -98,6 +99,7 @@ class ImageRegionIterator> /** the construction from a const iterator is declared protected in order to enforce const correctness. */ ImageRegionIterator(const ImageRegionConstIterator & it) { ImageConstIterator::operator=(it); } + Self & operator=(const ImageRegionConstIterator & it) { @@ -145,8 +147,9 @@ class ImageRegionIteratorWithIndex & it) { - this->ImageRegionConstIteratorWithIndex::operator=(it); + ImageRegionConstIteratorWithIndex::operator=(it); } + /** Constructor that can be used to cast from an ImageConstIterator to an * ImageRegionIteratorWithIndex. Many routines return an ImageIterator, but for a * particular task, you may want an ImageRegionConstIterator. Rather than @@ -155,7 +158,7 @@ class ImageRegionIteratorWithIndex & it) { - this->ImageRegionConstIterator::operator=(it); + ImageRegionConstIterator::operator=(it); } }; // no additional implementation required } // end namespace itk diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index 2c852c728d4..ce06f03f454 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -90,8 +90,9 @@ class ImageScanlineConstIterator> * ImageIterator to a ImageScanlineConstIterator. */ ImageScanlineConstIterator(const ImageConstIterator & it) { - this->ImageRegionConstIterator::operator=(it); + ImageRegionConstIterator::operator=(it); } + /** Go to the beginning pixel of the current line. */ void GoToBeginOfLine(void) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index 4ccacd70afb..af9b5a0d645 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -82,12 +82,12 @@ class ImageScanlineIterator> } ///** Return a reference to the pixel - //* This method will provide the fastest access to pixel - //* data, but it will NOT support ImageAdaptors. */ + // * This method will provide the fastest access to pixel + // * data, but it will NOT support ImageAdaptors. */ // PixelType & Value(void) - //{ + // { // return m_Buffer[m_Index[2]][m_Index[1]][m_RealIndex].second; - //} + // } protected: /** the construction from a const iterator is declared protected diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 44e0205bba7..01a5277a96a 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -68,7 +68,6 @@ copyImagePortion(ImageRegionConstIterator i oLine.push_back(typename RLEImageTypeOut::RLSegment(t - start0, iLine[x].second)); begin++; // start copying from next segment } - for (x++; x < iLine.size(); x++) { t += iLine[x].first; @@ -206,6 +205,7 @@ RegionOfInterestImageFilter< // Define the portion of the input to walk for this thread InputImageRegionType inputRegionForThread; + inputRegionForThread.SetSize(outputRegionForThread.GetSize()); IndexType start, end; @@ -240,7 +240,6 @@ RegionOfInterestImageFilter< } } // >::ThreadedGenerateData - template (iIt, oIt, start[0], end[0]); } // >::ThreadedGenerateData - template void RegionOfInterestImageFilter, RLEImage>::PrintSelf( @@ -507,6 +506,7 @@ RegionOfInterestImageFilter, RLEImage, RLEImage::ThreadedGenerateData - template void RegionOfInterestImageFilter, Image>::PrintSelf( @@ -658,6 +659,7 @@ RegionOfInterestImageFilter, Imag // Define the portion of the input to walk for this thread InputImageRegionType inputRegionForThread; + inputRegionForThread.SetSize(outputRegionForThread.GetSize()); IndexType start, end; From 910846475cb70898a9f7653c82d83da2540cbc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 22 Aug 2016 13:36:25 -0400 Subject: [PATCH 24/95] BUG: Fixing the linking errors for tests when default modules are not built This should prevent failures of automatic build tests on dashboards --- Modules/Filtering/RLEImage/itk-module.cmake | 3 --- Modules/Filtering/RLEImage/test/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Modules/Filtering/RLEImage/itk-module.cmake b/Modules/Filtering/RLEImage/itk-module.cmake index fde36ae4330..df13c98f547 100644 --- a/Modules/Filtering/RLEImage/itk-module.cmake +++ b/Modules/Filtering/RLEImage/itk-module.cmake @@ -9,11 +9,8 @@ convert to and from regular itk::Image." itk_module( RLEImage DEPENDS - ITKCommon ITKImageGrid TEST_DEPENDS - ITKCommon - ITKIOImageBase ITKTestKernel EXCLUDE_FROM_DEFAULT DESCRIPTION "${DOCUMENTATION}" diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index 85372e1fc81..8d605263f76 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -23,7 +23,7 @@ add_executable( itkImageScanlineIteratorTest1.cxx iteratorTests.cxx ) -target_link_libraries(iteratorTests ${ITK_LIBRARIES}) +target_link_libraries(iteratorTests "${RLEImage-Test_LIBRARIES}") itk_add_test(NAME iteratorTests COMMAND iteratorTests) function(ReadWriteTest ImageName Ext) From 7c3fc70db102d72a739e5b5ba87f3fa902db6e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 22 Aug 2016 15:30:07 -0400 Subject: [PATCH 25/95] COMP: Addressing compiler warnings --- .../Filtering/RLEImage/include/itkRLEImage.hxx | 9 ++++++--- .../RLEImage/include/itkRLEImageConstIterator.h | 4 ++-- .../itkRLERegionOfInterestImageFilter.hxx | 17 ++++++++++------- .../Filtering/RLEImage/test/iteratorTests.cxx | 2 ++ .../Filtering/RLEImage/test/itkRLEImageTest.cxx | 14 +++++++------- 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index dab317ce561..563bf6984cf 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -65,11 +65,12 @@ RLEImage::truncateRegion(const RegionType template void -RLEImage::Allocate(bool initialize) +RLEImage::Allocate(bool itkNotUsed(initialize)) { itkAssertOrThrowMacro(this->GetBufferedRegion().GetSize(0) == this->GetLargestPossibleRegion().GetSize(0), "BufferedRegion must contain complete run-length lines!"); - itkAssertOrThrowMacro(this->GetLargestPossibleRegion().GetSize(0) <= std::numeric_limits::max(), + itkAssertOrThrowMacro(this->GetLargestPossibleRegion().GetSize(0) <= + itk::SizeValueType(std::numeric_limits::max()), "CounterType is not large enough to support image's X dimension!"); this->ComputeOffsetTable(); // SizeValueType num = static_cast(this->GetOffsetTable()[VImageDimension]); @@ -124,7 +125,9 @@ RLEImage::CleanUp() const { return; } -#pragma omp parallel for +#ifndef __GNUC__ +# pragma omp parallel for +#endif for (CounterType z = 0; z < m_Buffer.size(); z++) { for (CounterType y = 0; y < m_Buffer[0].size(); y++) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 1170996a8ab..dfa79a36138 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -92,8 +92,8 @@ class ImageConstIterator> /** Default Constructor. Need to provide a default constructor since we * provide a copy constructor. */ ImageConstIterator() - : m_Buffer(0) - , m_RunLengthLine(0) + : m_RunLengthLine(0) + , m_Buffer(0) { m_Image = ITK_NULLPTR; m_Index0 = 0; diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 01a5277a96a..f84325754d0 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -58,14 +58,16 @@ copyImagePortion(ImageRegionConstIterator i SizeValueType begin = x; if (t >= end0) // both begin and end are in this segment { - oLine.push_back(typename RLEImageTypeOut::RLSegment(end0 - start0, iLine[x].second)); + oLine.push_back( + typename RLEImageTypeOut::RLSegment(typename RLEImageTypeOut::RLCounterType(end0 - start0), iLine[x].second)); ++iIt; ++oIt; continue; // next line } else if (t - start0 < iLine[x].first) // not the first pixel in segment { - oLine.push_back(typename RLEImageTypeOut::RLSegment(t - start0, iLine[x].second)); + oLine.push_back( + typename RLEImageTypeOut::RLSegment(typename RLEImageTypeOut::RLCounterType(t - start0), iLine[x].second)); begin++; // start copying from next segment } for (x++; x < iLine.size(); x++) @@ -83,7 +85,8 @@ copyImagePortion(ImageRegionConstIterator i else // we need to take special care of the last segment { oLine.insert(oLine.end(), iLine.begin() + begin, iLine.begin() + x); - oLine.push_back(typename RLEImageTypeOut::RLSegment(end0 + iLine[x].first - t, iLine[x].second)); + oLine.push_back(typename RLEImageTypeOut::RLSegment( + typename RLEImageTypeOut::RLCounterType(end0 + iLine[x].first - t), iLine[x].second)); } ++iIt; @@ -197,7 +200,7 @@ void RegionOfInterestImageFilter< RLEImage, RLEImage>::ThreadedGenerateData(const RegionType & outputRegionForThread, - ThreadIdType threadId) + ThreadIdType itkNotUsed(threadId)) { // Get the input and output pointers const RLEImageType * in = this->GetInput(); @@ -366,7 +369,7 @@ void RegionOfInterestImageFilter< RLEImage, RLEImage>::ThreadedGenerateData(const RegionType & outputRegionForThread, - ThreadIdType threadId) + ThreadIdType itkNotUsed(threadId)) { // Get the input and output pointers const RLEImageTypeIn * in = this->GetInput(); @@ -498,7 +501,7 @@ RegionOfInterestImageFilter, template void RegionOfInterestImageFilter, RLEImage>:: - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType itkNotUsed(threadId)) { // Get the input and output pointers const ImageType * in = this->GetInput(); @@ -651,7 +654,7 @@ RegionOfInterestImageFilter, template void RegionOfInterestImageFilter, Image>:: - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType itkNotUsed(threadId)) { // Get the input and output pointers const RLEImageType * in = this->GetInput(); diff --git a/Modules/Filtering/RLEImage/test/iteratorTests.cxx b/Modules/Filtering/RLEImage/test/iteratorTests.cxx index fd3391c7840..05a015841c1 100644 --- a/Modules/Filtering/RLEImage/test/iteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/iteratorTests.cxx @@ -47,5 +47,7 @@ main(int argc, char * argv[]) itkImageRegionConstIteratorWithOnlyIndexTest(argc, argv); itkRegionOfInterestImageFilterTest(argc, argv); typedef itk::RLEImage charred2dType; // test size 256 + charred2dType::Pointer t2 = charred2dType::New(); typedef itk::RLEImage charred4dType; // test size 65536 + charred4dType::Pointer t4 = charred4dType::New(); } diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 258b7d6e9fb..f94ed761665 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -67,7 +67,7 @@ roiTest(itk::SmartPointerGetLargestPossibleRegion(); typename myRLEImage::RegionType rNeg = reg; - for (int i = 0; i < ImageType::ImageDimension; i++) + for (unsigned i = 0; i < ImageType::ImageDimension; i++) { rNeg.SetIndex(i, -typename myRLEImage::IndexValueType(reg.GetSize(i)) * 3 / 4); } @@ -78,7 +78,7 @@ roiTest(itk::SmartPointer S2Type; // 2D - typedef itk::RLEImage S3Type; // 2D - typedef itk::RegionOfInterestImageFilter RoIType; - // instantiation of "RoIType" is dissalowed due to different dimension - // uncommenting the line below should give a meaningful error message + // uncommenting the lines below should give a meaningful error message + + // typedef itk::RLEImage S2Type; //2D + // typedef itk::RLEImage S3Type; //2D + // typedef itk::RegionOfInterestImageFilter RoIType; // typename RoIType::Pointer roi = RoIType::New(); } From c4b737642c971621af6722de17254fe756299848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 23 Aug 2016 09:10:29 -0400 Subject: [PATCH 26/95] COMP: More warning avoidance --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 10bfb4d3c86..19e69049aac 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -161,6 +161,8 @@ class RLEImage : public itk::ImageBase m_Buffer->SetBufferedRegion(truncateRegion(region)); } + using ImageBase::SetRequestedRegion; + virtual void SetRequestedRegion(const RegionType & region) { From badda1186e326ac3a896fc9a6a79a42ab65cf873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Thu, 1 Sep 2016 14:31:23 -0400 Subject: [PATCH 27/95] ENH: Clearing itk:: prefix --- .../Filtering/RLEImage/include/itkRLEImageConstIterator.h | 6 +++--- Modules/Filtering/RLEImage/include/itkRLEImageIterator.h | 2 +- .../RLEImage/include/itkRLEImageRegionConstIterator.h | 4 ++-- .../Filtering/RLEImage/include/itkRLEImageRegionIterator.h | 2 +- .../RLEImage/include/itkRLERegionOfInterestImageFilter.h | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index dfa79a36138..4648a617928 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -57,7 +57,7 @@ class ImageConstIterator> itkTypeMacroNoParent(ImageConstIterator); /** Image typedef support. */ - typedef itk::RLEImage ImageType; + typedef RLEImage ImageType; /** Run-Length Line (we iterate along it). */ typedef typename ImageType::RLLine RLLine; @@ -409,7 +409,7 @@ class ImageConstIteratorWithIndex public: /** Image typedef support. */ - typedef itk::RLEImage ImageType; + typedef RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; @@ -452,7 +452,7 @@ class ImageConstIteratorWithOnlyIndex ImageType; + typedef RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index e99822c4736..1151fbf8227 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -133,7 +133,7 @@ class ImageIteratorWithIndex> : public ImageConstIteratorWithIndex> { public: - typedef itk::RLEImage ImageType; + typedef RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index 332190eb0d3..b5430692f0e 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -171,7 +171,7 @@ class ImageRegionConstIteratorWithIndex> { public: - typedef itk::RLEImage ImageType; + typedef RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; @@ -220,7 +220,7 @@ class ImageRegionConstIteratorWithOnlyIndex ImageType; + typedef RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index 1a89bdf157d..dacd860885f 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -112,7 +112,7 @@ class ImageRegionIteratorWithIndex> { public: - typedef itk::RLEImage ImageType; + typedef RLEImage ImageType; typedef typename itk::ImageConstIterator>::RegionType RegionType; diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index fcd534d274f..7f81a6f6dad 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -27,7 +27,7 @@ namespace itk { /** \class RegionOfInterestImageFilter * \brief Extract a region of interest from the input image or convert - * between itk::Image and itk::RLEImage (a custom region can be used). + * between itk::Image and RLEImage (a custom region can be used). * * This filter produces an output image of the same dimension as the input * image. The user specifies the region of the input image that will be @@ -250,7 +250,7 @@ class RegionOfInterestImageFilter, RLEImage RLEImageType; + typedef RLEImage RLEImageType; typedef RegionOfInterestImageFilter Self; typedef Image ImageType; @@ -338,7 +338,7 @@ class RegionOfInterestImageFilter { public: /** Standard class typedefs. */ - typedef itk::RLEImage RLEImageType; + typedef RLEImage RLEImageType; typedef RegionOfInterestImageFilter Self; typedef Image ImageType; From bba7aacde422dd1c6a7a05c9a9438f55300a8c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 2 Sep 2016 12:31:12 -0400 Subject: [PATCH 28/95] ENH: A short example to display compression ratio --- .../Filtering/RLEImage/test/CMakeLists.txt | 3 + Modules/Filtering/RLEImage/test/rleStats.cxx | 60 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 Modules/Filtering/RLEImage/test/rleStats.cxx diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index 8d605263f76..66b19f5e828 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -11,6 +11,9 @@ add_executable( ) target_link_libraries(runFromIDE ${RLEImage-Test_LIBRARIES}) +add_executable(rleStats rleStats.cxx) +target_link_libraries(rleStats ${RLEImage-Test_LIBRARIES}) + add_executable( iteratorTests itkRegionOfInterestImageFilterTest.cxx diff --git a/Modules/Filtering/RLEImage/test/rleStats.cxx b/Modules/Filtering/RLEImage/test/rleStats.cxx new file mode 100644 index 00000000000..ea98f372ea9 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/rleStats.cxx @@ -0,0 +1,60 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include "itkTestDriverIncludeRequiredIOFactories.h" +#include "itkRLEImage.h" +#include "itkImageFileReader.h" +#include +#include + +int +main(int argc, char * argv[]) +{ + if (argc < 2) + { + std::cerr << "Usage: " << argv[0] << " inputImage" << std::endl; + return EXIT_FAILURE; + } + + typedef itk::Image ImageType; + typedef itk::RLEImage myRLEImage; + + typedef itk::ImageFileReader ReaderType; + typename ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); + + typedef itk::RegionOfInterestImageFilter inConverterType; + typename inConverterType::Pointer inConv = inConverterType::New(); + + try + { + RegisterRequiredFactories(); + reader->Update(); + inConv->SetInput(reader->GetOutput()); + inConv->SetRegionOfInterest(reader->GetOutput()->GetLargestPossibleRegion()); + inConv->Update(); + typename myRLEImage::Pointer test = inConv->GetOutput(); + std::cout << test; + } + catch (itk::ExceptionObject & error) + { + std::cerr << "Error: " << error << std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} From d3f21d5c028c5d672a36fa2398771d9dd3be1633 Mon Sep 17 00:00:00 2001 From: Dzenan Zukic Date: Tue, 3 Jan 2017 14:31:05 -0500 Subject: [PATCH 29/95] ENH: Using testing macros' TRY_EXPECT --- .../Filtering/RLEImage/test/CMakeLists.txt | 8 +-- .../RLEImage/test/itkRLEImageTest.cxx | 51 +++++++------------ 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index 66b19f5e828..a496f9e9be1 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -44,13 +44,11 @@ function(ReadWriteTest ImageName Ext) ) endfunction() -# RLEImage specific tests +# RLEImage specific tests - quick readwritetest(brainParc mha) readwritetest(vb-seg mha) readwritetest(ws nrrd) readwritetest(wb-crop nrrd) -readwritetest(wb-seg nrrd) -readwritetest(wb-seg32 nrrd) # Handcrafted tests for MorphologicalContourInterpolation readwritetest(Empty nrrd) @@ -83,3 +81,7 @@ readwritetest(64816L_amygdala_fin nii.gz) readwritetest(64816L_amygdala_int nii.gz) readwritetest(65239R_amygdala_fin nii.gz) readwritetest(65239R_amygdala_int nii.gz) + +# RLEImage specific tests - long +readwritetest(wb-seg nrrd) +readwritetest(wb-seg32 nrrd) diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index f94ed761665..7428f3096f6 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -19,6 +19,7 @@ #include "itkRLEImage.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" +#include "itkTestingMacros.h" #include #include @@ -120,7 +121,7 @@ roiTest(itk::SmartPointer -void +int doTest(std::string inFilename, std::string outFilename) { typedef itk::ImageFileReader ReaderType; @@ -140,32 +141,14 @@ doTest(std::string inFilename, std::string outFilename) itk::SizeValueType xSize = test->GetLargestPossibleRegion().GetSize(0); std::cout << "Running region of interest tests" << std::endl; - bool shouldHaveThrown = false; if (xSize > 127) { - std::cout << "\nThis test should fail because xSize>127" << std::endl; - shouldHaveThrown = true; - } - try - { - roiTest(test); - } - catch (itk::ExceptionObject & error) - { - std::cerr << error << std::endl; - if (shouldHaveThrown) - { - std::cout << "Exception caught successfully" << std::endl; - shouldHaveThrown = false; - } - else - { - throw error; - } + std::cout << "\n xSize>127 (CHAR_MAX)" << std::endl; + TRY_EXPECT_EXCEPTION(roiTest(test)); } - if (shouldHaveThrown) + else { - itkGenericExceptionMacro(<< "Exception was expected but none occurred (xSize>127)"); + TRY_EXPECT_NO_EXCEPTION(roiTest(test)); } typedef itk::RegionOfInterestImageFilter outConverterType; @@ -183,16 +166,20 @@ doTest(std::string inFilename, std::string outFilename) std::cout << "Writing " << outFilename << std::endl; writer->Update(); std::cout << "Test finished" << std::endl; + + return EXIT_SUCCESS; } void dimTest() { + typedef itk::RLEImage S2Type; // 2D + typedef itk::RLEImage S3Type; // 3D + S2Type::Pointer s2 = S2Type::New(); + S3Type::Pointer s3 = S3Type::New(); + // instantiation of "RoIType" is dissalowed due to different dimension // uncommenting the lines below should give a meaningful error message - - // typedef itk::RLEImage S2Type; //2D - // typedef itk::RLEImage S3Type; //2D // typedef itk::RegionOfInterestImageFilter RoIType; // typename RoIType::Pointer roi = RoIType::New(); } @@ -226,23 +213,19 @@ itkRLEImageTest(int argc, char * argv[]) // unused cases are not instantiated because they greatly increase compile time if (numDimensions == 2 && pixelType == itk::ImageIOBase::UCHAR) { - doTest>(inputImageFileName, outputImageFileName); - return EXIT_SUCCESS; + return doTest>(inputImageFileName, outputImageFileName); } if (numDimensions == 3 && (pixelType == itk::ImageIOBase::SHORT || pixelType == itk::ImageIOBase::USHORT)) { - doTest>(inputImageFileName, outputImageFileName); - return EXIT_SUCCESS; + return doTest>(inputImageFileName, outputImageFileName); } if (numDimensions == 3) // if not (u)short, then interpret as uint { - doTest>(inputImageFileName, outputImageFileName); - return EXIT_SUCCESS; + return doTest>(inputImageFileName, outputImageFileName); } if (numDimensions == 4 && pixelType == itk::ImageIOBase::UCHAR) { - doTest>(inputImageFileName, outputImageFileName); - return EXIT_SUCCESS; + return doTest>(inputImageFileName, outputImageFileName); } std::cerr << "Unsupported image type:\n Dimensions: " << numDimensions; From 4e26384e822bff3bead144f99afb6daea5e7e739 Mon Sep 17 00:00:00 2001 From: Francois Budin Date: Tue, 3 Jan 2017 15:38:00 -0500 Subject: [PATCH 30/95] ENH: Rename tests to all contain the name of the remote module All test names now start with the name of the module, RLEImage, which makes it easier to test the module. One can run the test with a command similar to: ctest -R RLEImage --- Modules/Filtering/RLEImage/test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index 66b19f5e828..e6332297a18 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -27,12 +27,12 @@ add_executable( iteratorTests.cxx ) target_link_libraries(iteratorTests "${RLEImage-Test_LIBRARIES}") -itk_add_test(NAME iteratorTests COMMAND iteratorTests) +itk_add_test(NAME RLEImageiteratorTests COMMAND iteratorTests) function(ReadWriteTest ImageName Ext) set(outImage "${ITK_TEST_OUTPUT_DIR}/${ImageName}.${Ext}") itk_add_test( - NAME ${ImageName} + NAME RLEImage${ImageName} COMMAND RLEImageTestDriver --compare From 753f54505c25f905915f919b5cbfc54930088f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 3 Jan 2017 14:37:32 -0500 Subject: [PATCH 31/95] BUG: Fixing warning: 'typename' occurs outside of a template --- Modules/Filtering/RLEImage/test/rleStats.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/rleStats.cxx b/Modules/Filtering/RLEImage/test/rleStats.cxx index ea98f372ea9..e5c24006f56 100644 --- a/Modules/Filtering/RLEImage/test/rleStats.cxx +++ b/Modules/Filtering/RLEImage/test/rleStats.cxx @@ -35,11 +35,11 @@ main(int argc, char * argv[]) typedef itk::RLEImage myRLEImage; typedef itk::ImageFileReader ReaderType; - typename ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); typedef itk::RegionOfInterestImageFilter inConverterType; - typename inConverterType::Pointer inConv = inConverterType::New(); + inConverterType::Pointer inConv = inConverterType::New(); try { @@ -48,7 +48,7 @@ main(int argc, char * argv[]) inConv->SetInput(reader->GetOutput()); inConv->SetRegionOfInterest(reader->GetOutput()->GetLargestPossibleRegion()); inConv->Update(); - typename myRLEImage::Pointer test = inConv->GetOutput(); + myRLEImage::Pointer test = inConv->GetOutput(); std::cout << test; } catch (itk::ExceptionObject & error) From d861de6c0fa8e33c0f4932cd09dacc563c99b7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 1 Nov 2017 12:43:16 -0400 Subject: [PATCH 32/95] ENH: testing long long --- .../test/itkImageIteratorWithIndexTest.cxx | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx index 56e808f8f36..908f88a5ee3 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx @@ -215,6 +215,36 @@ itkImageIteratorWithIndexTest(int, char *[]) testPassed = false; } + std::cout << "Testing with Image< long long, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterF(10); + if (TesterF.TestIterator() == false) + { + testPassed = false; + } + if (TesterF.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterF.TestReverseIteration() == false) + { + testPassed = false; + } + + std::cout << "Testing with Image< unsigned long long, 3 > " << std::endl; + itkImageIteratorWithIndexTestIteratorTester TesterUI(10); + if (TesterUI.TestIterator() == false) + { + testPassed = false; + } + if (TesterUI.TestConstIterator() == false) + { + testPassed = false; + } + if (TesterUI.TestReverseIteration() == false) + { + testPassed = false; + } + std::cout << "Testing with Image< float, 3 > " << std::endl; itkImageIteratorWithIndexTestIteratorTester TesterF(10.0); if (TesterF.TestIterator() == false) From 77fb0982c15c6573891b1f4c6db8a5e7e4a2e69f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 1 Nov 2017 14:40:11 -0400 Subject: [PATCH 33/95] COMP: fixing copy-pasted duplicate names --- .../test/itkImageIteratorWithIndexTest.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx index 908f88a5ee3..7dc32cd82d6 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx @@ -216,31 +216,31 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< long long, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterF(10); - if (TesterF.TestIterator() == false) + itkImageIteratorWithIndexTestIteratorTester TesterLL(10); + if (TesterLL.TestIterator() == false) { testPassed = false; } - if (TesterF.TestConstIterator() == false) + if (TesterLL.TestConstIterator() == false) { testPassed = false; } - if (TesterF.TestReverseIteration() == false) + if (TesterLL.TestReverseIteration() == false) { testPassed = false; } std::cout << "Testing with Image< unsigned long long, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterUI(10); - if (TesterUI.TestIterator() == false) + itkImageIteratorWithIndexTestIteratorTester TesterULL(10); + if (TesterULL.TestIterator() == false) { testPassed = false; } - if (TesterUI.TestConstIterator() == false) + if (TesterULL.TestConstIterator() == false) { testPassed = false; } - if (TesterUI.TestReverseIteration() == false) + if (TesterULL.TestReverseIteration() == false) { testPassed = false; } From 065099b171a0eb15d6ae9cd1340362a98f8c3043 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Fri, 19 Jan 2018 08:10:57 +0100 Subject: [PATCH 34/95] ENH: Require cmake minimum version to be 3.9.5. Require CMake minimum version to be 3.9.5 following ITKv5 requiring C++11: https://discourse.itk.org/t/minimum-cmake-version-update/585 --- Modules/Filtering/RLEImage/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/CMakeLists.txt b/Modules/Filtering/RLEImage/CMakeLists.txt index 0c9a7900532..d826bd45174 100644 --- a/Modules/Filtering/RLEImage/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 3.9.5) project(RLEImage) if(NOT ITK_SOURCE_DIR) From a3efd98abd9987bbf6e84a3e48dc8f52f8e6493d Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 16 Dec 2017 19:17:12 -0600 Subject: [PATCH 35/95] ENH: ITKv5 override consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Provide remove virtual and override Use clang-tidy to add ITK_OVERRIDE, and to remove redundant virtual on functions. cd ../ITK; clang-tidy -p ITK-clangtidy $find Modules/[A-J]* -name *.cxx |fgrep -v ThirdParty) -checks=-*,modernize-use-override -header-filter=.* -fix clang-tidy -p ITK-clangtidy $(find Modules/[K-Z]* -name *.cxx |fgrep -v ThirdParty) -checks=-*,modernize-use-override -header-filter=.* -fix https://stackoverflow.com/questions/39932391/virtual-override-or-both-c When you override a function you don't technically need to write either virtual or override. The original base class declaration needs the keyword virtual to mark it as virtual. In the derived class the function is virtual by way of having the ¹same type as the base class function. However, an override can help avoid bugs by producing a compilation error when the intended override isn't technically an override. E.g. that the function type isn't exactly like the base class function. Or that a maintenance of the base class changes that function's type, e.g. adding a defaulted argument. In the same way, a virtual keyword in the derived class can make such a bug more subtle, by ensuring that the function is still is virtual in further derived classes. So the general advice is, virtual for the base class function declaration. This is technically necessary. Use override (only) for a derived class' override. This helps with maintenance. --- .../Filtering/RLEImage/include/itkRLEImage.h | 32 ++++----- .../RLEImage/include/itkRLEImageIterator.h | 2 +- .../itkRLERegionOfInterestImageFilter.h | 72 +++++++++---------- 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 19e69049aac..11fac027a2b 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -128,13 +128,13 @@ class RLEImage : public itk::ImageBase /** Allocate the image memory. The size of the image must * already be set, e.g. by calling SetRegions(). * Pixel values are initialized using default constructor. */ - virtual void - Allocate(bool initialize = false); + void + Allocate(bool initialize = false) ITK_OVERRIDE; /** Restore the data object to its initial state. This means releasing * memory. */ - virtual void - Initialize() + void + Initialize() ITK_OVERRIDE { // Call the superclass which should initialize the BufferedRegion ivar. Superclass::Initialize(); @@ -147,15 +147,15 @@ class RLEImage : public itk::ImageBase void FillBuffer(const TPixel & value); - virtual void - SetLargestPossibleRegion(const RegionType & region) + void + SetLargestPossibleRegion(const RegionType & region) ITK_OVERRIDE { Superclass::SetLargestPossibleRegion(region); m_Buffer->SetLargestPossibleRegion(truncateRegion(region)); } - virtual void - SetBufferedRegion(const RegionType & region) + void + SetBufferedRegion(const RegionType & region) ITK_OVERRIDE { Superclass::SetBufferedRegion(region); m_Buffer->SetBufferedRegion(truncateRegion(region)); @@ -163,8 +163,8 @@ class RLEImage : public itk::ImageBase using ImageBase::SetRequestedRegion; - virtual void - SetRequestedRegion(const RegionType & region) + void + SetRequestedRegion(const RegionType & region) ITK_OVERRIDE { Superclass::SetRequestedRegion(region); m_Buffer->SetRequestedRegion(truncateRegion(region)); @@ -206,8 +206,8 @@ class RLEImage : public itk::ImageBase return this->GetPixel(index); } - virtual unsigned int - GetNumberOfComponentsPerPixel() const + unsigned int + GetNumberOfComponentsPerPixel() const ITK_OVERRIDE { // use the GetLength() method which works with variable length arrays, // to make it work with as much pixel types as possible @@ -284,16 +284,16 @@ class RLEImage : public itk::ImageBase } void - PrintSelf(std::ostream & os, itk::Indent indent) const; + PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE; - virtual ~RLEImage() {} + ~RLEImage() ITK_OVERRIDE {} /** Compute helper matrices used to transform Index coordinates to * PhysicalPoint coordinates and back. This method is virtual and will be * overloaded in derived classes in order to provide backward compatibility * behavior in classes that did not used to take image orientation into * account. */ - virtual void - ComputeIndexToPhysicalPointMatrices() + void + ComputeIndexToPhysicalPointMatrices() ITK_OVERRIDE { this->Superclass::ComputeIndexToPhysicalPointMatrices(); } diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 1151fbf8227..bc0e48a6393 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -62,7 +62,7 @@ class ImageIterator> * provide a copy constructor. */ ImageIterator() {} /** Default Destructor */ - ~ImageIterator() {} + ~ImageIterator() ITK_OVERRIDE {} /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageIterator(const Self & it) diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 7f81a6f6dad..c2bf4ab00d8 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -92,15 +92,15 @@ class RegionOfInterestImageFilter protected: RegionOfInterestImageFilter() {} - ~RegionOfInterestImageFilter() {} + ~RegionOfInterestImageFilter() ITK_OVERRIDE {} void - PrintSelf(std::ostream & os, Indent indent) const; + PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; - virtual void - GenerateInputRequestedRegion(); + void + GenerateInputRequestedRegion() ITK_OVERRIDE; - virtual void - EnlargeOutputRequestedRegion(DataObject * output); + void + EnlargeOutputRequestedRegion(DataObject * output) ITK_OVERRIDE; /** RegionOfInterestImageFilter can produce an image which is a different * size than its input image. As such, RegionOfInterestImageFilter @@ -110,8 +110,8 @@ class RegionOfInterestImageFilter * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void - GenerateOutputInformation(); + void + GenerateOutputInformation() ITK_OVERRIDE; /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -123,7 +123,7 @@ class RegionOfInterestImageFilter * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId); + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; private: RegionOfInterestImageFilter(const Self &); // purposely not implemented @@ -186,15 +186,15 @@ class RegionOfInterestImageFilter, RLEImage, RLEImage, RLEImage protected: RegionOfInterestImageFilter() {} - ~RegionOfInterestImageFilter() {} + ~RegionOfInterestImageFilter() ITK_OVERRIDE {} void - PrintSelf(std::ostream & os, Indent indent) const; + PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; - virtual void - GenerateInputRequestedRegion(); + void + GenerateInputRequestedRegion() ITK_OVERRIDE; - virtual void - EnlargeOutputRequestedRegion(DataObject * output); + void + EnlargeOutputRequestedRegion(DataObject * output) ITK_OVERRIDE; /** RegionOfInterestImageFilter can produce an image which is a different * size than its input image. As such, RegionOfInterestImageFilter @@ -397,8 +397,8 @@ class RegionOfInterestImageFilter * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void - GenerateOutputInformation(); + void + GenerateOutputInformation() ITK_OVERRIDE; /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -410,7 +410,7 @@ class RegionOfInterestImageFilter * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId); + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; private: RegionOfInterestImageFilter(const Self &); // purposely not implemented From 58944ef08400d4394da9438a8b023c47cdcdc064 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 16 Dec 2017 19:36:26 -0600 Subject: [PATCH 36/95] COMP: Use C++11 override directly git grep -l "ITK_OVERRIDE" | fgrep -v itk_compiler_detection.h | fgrep -v CMakeLists.txt |fgrep -v .cmake | xargs sed -i '' -e "s/ITK_OVERRIDE/override/g" --- .../Filtering/RLEImage/include/itkRLEImage.h | 18 +++---- .../RLEImage/include/itkRLEImageIterator.h | 2 +- .../itkRLERegionOfInterestImageFilter.h | 48 +++++++++---------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 11fac027a2b..5c713bfb442 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -129,12 +129,12 @@ class RLEImage : public itk::ImageBase * already be set, e.g. by calling SetRegions(). * Pixel values are initialized using default constructor. */ void - Allocate(bool initialize = false) ITK_OVERRIDE; + Allocate(bool initialize = false) override; /** Restore the data object to its initial state. This means releasing * memory. */ void - Initialize() ITK_OVERRIDE + Initialize() override { // Call the superclass which should initialize the BufferedRegion ivar. Superclass::Initialize(); @@ -148,14 +148,14 @@ class RLEImage : public itk::ImageBase FillBuffer(const TPixel & value); void - SetLargestPossibleRegion(const RegionType & region) ITK_OVERRIDE + SetLargestPossibleRegion(const RegionType & region) override { Superclass::SetLargestPossibleRegion(region); m_Buffer->SetLargestPossibleRegion(truncateRegion(region)); } void - SetBufferedRegion(const RegionType & region) ITK_OVERRIDE + SetBufferedRegion(const RegionType & region) override { Superclass::SetBufferedRegion(region); m_Buffer->SetBufferedRegion(truncateRegion(region)); @@ -164,7 +164,7 @@ class RLEImage : public itk::ImageBase using ImageBase::SetRequestedRegion; void - SetRequestedRegion(const RegionType & region) ITK_OVERRIDE + SetRequestedRegion(const RegionType & region) override { Superclass::SetRequestedRegion(region); m_Buffer->SetRequestedRegion(truncateRegion(region)); @@ -207,7 +207,7 @@ class RLEImage : public itk::ImageBase } unsigned int - GetNumberOfComponentsPerPixel() const ITK_OVERRIDE + GetNumberOfComponentsPerPixel() const override { // use the GetLength() method which works with variable length arrays, // to make it work with as much pixel types as possible @@ -284,16 +284,16 @@ class RLEImage : public itk::ImageBase } void - PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE; + PrintSelf(std::ostream & os, itk::Indent indent) const override; - ~RLEImage() ITK_OVERRIDE {} + ~RLEImage() override {} /** Compute helper matrices used to transform Index coordinates to * PhysicalPoint coordinates and back. This method is virtual and will be * overloaded in derived classes in order to provide backward compatibility * behavior in classes that did not used to take image orientation into * account. */ void - ComputeIndexToPhysicalPointMatrices() ITK_OVERRIDE + ComputeIndexToPhysicalPointMatrices() override { this->Superclass::ComputeIndexToPhysicalPointMatrices(); } diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index bc0e48a6393..92172063a3b 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -62,7 +62,7 @@ class ImageIterator> * provide a copy constructor. */ ImageIterator() {} /** Default Destructor */ - ~ImageIterator() ITK_OVERRIDE {} + ~ImageIterator() override {} /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageIterator(const Self & it) diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index c2bf4ab00d8..b1b98812e80 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -92,15 +92,15 @@ class RegionOfInterestImageFilter protected: RegionOfInterestImageFilter() {} - ~RegionOfInterestImageFilter() ITK_OVERRIDE {} + ~RegionOfInterestImageFilter() override {} void - PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + PrintSelf(std::ostream & os, Indent indent) const override; void - GenerateInputRequestedRegion() ITK_OVERRIDE; + GenerateInputRequestedRegion() override; void - EnlargeOutputRequestedRegion(DataObject * output) ITK_OVERRIDE; + EnlargeOutputRequestedRegion(DataObject * output) override; /** RegionOfInterestImageFilter can produce an image which is a different * size than its input image. As such, RegionOfInterestImageFilter @@ -111,7 +111,7 @@ class RegionOfInterestImageFilter * * \sa ProcessObject::GenerateOutputInformaton() */ void - GenerateOutputInformation() ITK_OVERRIDE; + GenerateOutputInformation() override; /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -123,7 +123,7 @@ class RegionOfInterestImageFilter * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) override; private: RegionOfInterestImageFilter(const Self &); // purposely not implemented @@ -186,15 +186,15 @@ class RegionOfInterestImageFilter, RLEImage, RLEImage, RLEImage protected: RegionOfInterestImageFilter() {} - ~RegionOfInterestImageFilter() ITK_OVERRIDE {} + ~RegionOfInterestImageFilter() override {} void - PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + PrintSelf(std::ostream & os, Indent indent) const override; void - GenerateInputRequestedRegion() ITK_OVERRIDE; + GenerateInputRequestedRegion() override; void - EnlargeOutputRequestedRegion(DataObject * output) ITK_OVERRIDE; + EnlargeOutputRequestedRegion(DataObject * output) override; /** RegionOfInterestImageFilter can produce an image which is a different * size than its input image. As such, RegionOfInterestImageFilter @@ -398,7 +398,7 @@ class RegionOfInterestImageFilter * * \sa ProcessObject::GenerateOutputInformaton() */ void - GenerateOutputInformation() ITK_OVERRIDE; + GenerateOutputInformation() override; /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -410,7 +410,7 @@ class RegionOfInterestImageFilter * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; + ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) override; private: RegionOfInterestImageFilter(const Self &); // purposely not implemented From 936be8161ac9efd64996bf065bf99c6af83cd389 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 16 Dec 2017 20:10:45 -0600 Subject: [PATCH 37/95] COMP: Use C++11 nullptr directly git grep -l "ITK_NULLPTR" | fgrep -v itk_compiler_detection.h | fgrep -v CMakeLists.txt |fgrep -v .cmake | xargs sed -i '' -e "s/ITK_NULLPTR/nullptr/g" --- Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 4648a617928..08e2ce3d11a 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -95,7 +95,7 @@ class ImageConstIterator> : m_RunLengthLine(0) , m_Buffer(0) { - m_Image = ITK_NULLPTR; + m_Image = nullptr; m_Index0 = 0; m_BeginIndex0 = 0; m_EndIndex0 = 0; From 59bc797c588ea3ed975fc9046f1f9767c79f3b2a Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 17 Dec 2017 08:22:48 -0600 Subject: [PATCH 38/95] COMP: Use nullptr instead of 0 or NULL The check converts the usage of null pointer constants (eg. NULL, 0) to use the new C++11 nullptr keyword. SRCDIR= #My local SRC BLDDIR= #My local BLD clang-tidy -p ${BLD} $(find Modules/[A-J]* -name "*.cxx" \|fgrep -v ThirdParty) -checks=-*,modernize-use-nullptr -header-filter=.* -fix clang-tidy -p ${BLD} $(find Modules/[K-Z]* -name "*.cxx" \|fgrep -v ThirdParty) -checks=-*,modernize-use-nullptr -header-filter=.* -fix --- Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 08e2ce3d11a..96a29554cb4 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -92,8 +92,8 @@ class ImageConstIterator> /** Default Constructor. Need to provide a default constructor since we * provide a copy constructor. */ ImageConstIterator() - : m_RunLengthLine(0) - , m_Buffer(0) + : m_RunLengthLine(nullptr) + , m_Buffer(nullptr) { m_Image = nullptr; m_Index0 = 0; From 51ce191b24febad0cd57dc75515da2c70ff9cbd5 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 14 Jan 2018 10:53:36 -0700 Subject: [PATCH 39/95] COMP: Use C++ headers over C header Some headers from C library were deprecated in C++ and are no longer welcome in C++ codebases. Some have no effect in C++. For more details refer to the C++ 14 Standard [depr.c.headers] section. This patch replaces C standard library headers with their C++ alternatives and removes redundant ones. --- Modules/Filtering/RLEImage/test/itkIteratorTests.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx index 12ff7475a3e..b40596153e6 100644 --- a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx @@ -21,7 +21,7 @@ #include "itkImage.h" #include "itkVector.h" #include "itkRLEImage.h" -#include +#include int itkIteratorTests(int, char *[]) From d5ed962e6fa96d2b6d6314baf5682a0812c97c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 7 Feb 2018 11:34:45 -0500 Subject: [PATCH 40/95] BUG: Prevent unintended propagation of region from input image --- Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 7428f3096f6..0d782c3493d 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -53,6 +53,7 @@ roiTest(itk::SmartPointerSetRegionOfInterest(orig->GetLargestPossibleRegion()); cConv->Update(); typename charRLEImage::Pointer cIn = cConv->GetOutput(); + cIn->DisconnectPipeline(); typedef itk::RLEImage ucharRLEImage; typedef itk::RegionOfInterestImageFilter ucharConverterType; @@ -61,6 +62,7 @@ roiTest(itk::SmartPointerSetRegionOfInterest(orig->GetLargestPossibleRegion()); ucConv->Update(); typename ucharRLEImage::Pointer ucIn = ucConv->GetOutput(); + ucIn->DisconnectPipeline(); std::cout << "Comparing direct conversions..."; compare(cIn, ucIn); From 71854c327103edd42a11e3b2ff64d8c6a86bef66 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 12 Feb 2018 21:04:54 -0600 Subject: [PATCH 41/95] STYLE: Replace itkStaticConstMacro with static constexpr Use static constexpr directly now that C++11 conformance is required by all compilers. :%s/itkStaticConstMacro *( *\([^,]*\),[ \_s]*\([^,]*\),\_s*\([^)]*\)) */static constexpr \2 \1 = \3/ge --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 2 +- .../RLEImage/include/itkRLEImageConstIterator.h | 2 +- .../RLEImage/include/itkRLEImageIterator.h | 2 +- .../include/itkRLEImageRegionConstIterator.h | 2 +- .../include/itkRLEImageScanlineConstIterator.h | 2 +- .../include/itkRLERegionOfInterestImageFilter.h | 16 ++++++++-------- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 5c713bfb442..8940ee2a4b1 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -93,7 +93,7 @@ class RLEImage : public itk::ImageBase * templated over image type (as opposed to being templated over pixel type * and dimension) when they need compile time access to the dimension of * the image. */ - itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension); + static constexpr unsigned int ImageDimension = VImageDimension; /** Index typedef support. An index is used to access pixel values. */ typedef typename Superclass::IndexType IndexType; diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 96a29554cb4..c310e0ed084 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -51,7 +51,7 @@ class ImageConstIterator> * functions that are templated over image iterator type (as opposed to * being templated over pixel type and dimension) can have compile time * access to the dimension of the image that the iterator walks. */ - itkStaticConstMacro(ImageIteratorDimension, unsigned int, VImageDimension); + static constexpr unsigned int ImageIteratorDimension = VImageDimension; /** Run-time type information (and related methods). */ itkTypeMacroNoParent(ImageConstIterator); diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 92172063a3b..01590b45660 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -44,7 +44,7 @@ class ImageIterator> * functions that are templated over image iterator type (as opposed to * being templated over pixel type and dimension) can have compile time * access to the dimension of the image that the iterator walks. */ - itkStaticConstMacro(ImageIteratorDimension, unsigned int, VImageDimension); + static constexpr unsigned int ImageIteratorDimension = VImageDimension; /** Define the superclass */ typedef ImageConstIterator> Superclass; diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index b5430692f0e..6bd326b4599 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -53,7 +53,7 @@ class ImageRegionConstIterator> * functions that are templated over image iterator type (as opposed to * being templated over pixel type and dimension) can have compile time * access to the dimension of the image that the iterator walks. */ - itkStaticConstMacro(ImageIteratorDimension, unsigned int, VImageDimension); + static constexpr unsigned int ImageIteratorDimension = VImageDimension; /** * Index typedef support. While these were already typdef'ed in the superclass, diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index ce06f03f454..ba82764daf5 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -43,7 +43,7 @@ class ImageScanlineConstIterator> * functions that are templated over image iterator type (as opposed to * being templated over pixel type and dimension) can have compile time * access to the dimension of the image that the iterator walks. */ - itkStaticConstMacro(ImageIteratorDimension, unsigned int, VImageDimension); + static constexpr unsigned int ImageIteratorDimension = VImageDimension; /** * Index typedef support. While these were already typdef'ed in the superclass, diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index b1b98812e80..cd5e1e1f702 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -80,8 +80,8 @@ class RegionOfInterestImageFilter itkGetConstMacro(RegionOfInterest, RegionType); /** ImageDimension enumeration */ - itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, VImageDimension); + static constexpr unsigned int ImageDimension = VImageDimension; + static constexpr unsigned int OutputImageDimension = VImageDimension; #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking @@ -174,8 +174,8 @@ class RegionOfInterestImageFilter, RLEImage itkGetConstMacro(RegionOfInterest, RegionType); /** ImageDimension enumeration */ - itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, VImageDimension); + static constexpr unsigned int ImageDimension = VImageDimension; + static constexpr unsigned int OutputImageDimension = VImageDimension; #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking From 28b7ff40fddca84a903f09abeefcfef43d086482 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 12 Feb 2018 23:30:55 -0600 Subject: [PATCH 42/95] STYLE: Prefer C++11 type alias over typedef == http://en.cppreference.com/w/cpp/language/type_alias == Type alias is a name that refers to a previously defined type (similar to typedef). A type alias declaration introduces a name which can be used as a synonym for the type denoted by type-id. It does not introduce a new type and it cannot change the meaning of an existing type name. There is no difference between a type alias declaration and typedef declaration. This declaration may appear in block scope, class scope, or namespace scope. == https://www.quora.com/Is-using-typedef-in-C++-considered-a-bad-practice == While typedef is still available for backward compatibility, the new Type Alias syntax 'using Alias = ExistingLongName;' is more consistent with the flow of C++ than the old typedef syntax 'typedef ExistingLongName Alias;', and it also works for templates (Type alias, alias template (since C++11)), so leftover 'typedef' aliases will differ in style from any alias templates. --- .../Filtering/RLEImage/include/itkRLEImage.h | 68 +++++------ .../include/itkRLEImageConstIterator.h | 50 ++++----- .../RLEImage/include/itkRLEImageIterator.h | 24 ++-- .../include/itkRLEImageRegionConstIterator.h | 30 ++--- .../include/itkRLEImageRegionIterator.h | 24 ++-- .../itkRLEImageScanlineConstIterator.h | 22 ++-- .../include/itkRLEImageScanlineIterator.h | 20 ++-- .../itkRLERegionOfInterestImageFilter.h | 106 +++++++++--------- .../Filtering/RLEImage/test/iteratorTests.cxx | 8 +- .../RLEImage/test/itkImageIteratorTest.cxx | 8 +- .../test/itkImageIteratorWithIndexTest.cxx | 40 +++---- .../itkImageIteratorsForwardBackwardTest.cxx | 6 +- ...geRegionConstIteratorWithOnlyIndexTest.cxx | 6 +- .../test/itkImageRegionIteratorTest.cxx | 4 +- .../test/itkImageScanlineIteratorTest1.cxx | 6 +- .../RLEImage/test/itkIteratorTests.cxx | 4 +- .../RLEImage/test/itkRLEImageTest.cxx | 54 ++++----- .../itkRegionOfInterestImageFilterTest.cxx | 18 +-- Modules/Filtering/RLEImage/test/rleStats.cxx | 12 +- 19 files changed, 255 insertions(+), 255 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 8940ee2a4b1..5cd14c41b4f 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -52,12 +52,12 @@ template { public: - /** Standard class typedefs */ - typedef RLEImage Self; - typedef itk::ImageBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - typedef itk::WeakPointer ConstWeakPointer; + /** Standard class type alias */ + using Self = RLEImage; + using Superclass = itk::ImageBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; + using ConstWeakPointer = itk::WeakPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -65,29 +65,29 @@ class RLEImage : public itk::ImageBase /** Run-time type information (and related methods). */ itkTypeMacro(RLEImage, ImageBase); - /** Pixel typedef support. Used to declare pixel type in filters + /** Pixel type alias support. Used to declare pixel type in filters * or other operations. */ - typedef TPixel PixelType; + using PixelType = TPixel; - typedef CounterType RLCounterType; + using RLCounterType = CounterType; /** Typedef alias for PixelType */ - typedef TPixel ValueType; + using ValueType = TPixel; /** First element is count of repetitions, * second element is the pixel value. */ - typedef std::pair RLSegment; + using RLSegment = std::pair; /** A Run-Length encoded line of pixels. */ - typedef std::vector RLLine; + using RLLine = std::vector; /** Internal Pixel representation. Used to maintain a uniform API * with Image Adaptors and allow to keep a particular internal * representation of data while showing a different external * representation. */ - typedef RLLine InternalPixelType; + using InternalPixelType = RLLine; - // typedef PixelType IOPixelType; + // using IOPixelType = PixelType; /** Dimension of the image. This constant is used by functions that are * templated over image type (as opposed to being templated over pixel type @@ -95,35 +95,35 @@ class RLEImage : public itk::ImageBase * the image. */ static constexpr unsigned int ImageDimension = VImageDimension; - /** Index typedef support. An index is used to access pixel values. */ - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::IndexValueType IndexValueType; + /** Index type alias support. An index is used to access pixel values. */ + using IndexType = typename Superclass::IndexType; + using IndexValueType = typename Superclass::IndexValueType; - /** Offset typedef support. An offset is used to access pixel values. */ - typedef typename Superclass::OffsetType OffsetType; + /** Offset type alias support. An offset is used to access pixel values. */ + using OffsetType = typename Superclass::OffsetType; - /** Size typedef support. A size is used to define region bounds. */ - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::SizeValueType SizeValueType; + /** Size type alias support. A size is used to define region bounds. */ + using SizeType = typename Superclass::SizeType; + using SizeValueType = typename Superclass::SizeValueType; - /** Direction typedef support. A matrix of direction cosines. */ - typedef typename Superclass::DirectionType DirectionType; + /** Direction type alias support. A matrix of direction cosines. */ + using DirectionType = typename Superclass::DirectionType; - /** Region typedef support. A region is used to specify a subset of an image. + /** Region type alias support. A region is used to specify a subset of an image. */ - typedef typename Superclass::RegionType RegionType; + using RegionType = typename Superclass::RegionType; - /** Spacing typedef support. Spacing holds the size of a pixel. The + /** Spacing type alias support. Spacing holds the size of a pixel. The * spacing is the geometric distance between image samples. */ - typedef typename Superclass::SpacingType SpacingType; - typedef typename Superclass::SpacingValueType SpacingValueType; + using SpacingType = typename Superclass::SpacingType; + using SpacingValueType = typename Superclass::SpacingValueType; - /** Origin typedef support. The origin is the geometric coordinates + /** Origin type alias support. The origin is the geometric coordinates * of the index (0,0). */ - typedef typename Superclass::PointType PointType; + using PointType = typename Superclass::PointType; - /** Offset typedef (relative position between indices) */ - typedef typename Superclass::OffsetValueType OffsetValueType; + /** Offset type alias (relative position between indices) */ + using OffsetValueType = typename Superclass::OffsetValueType; /** Allocate the image memory. The size of the image must * already be set, e.g. by calling SetRegions(). @@ -217,7 +217,7 @@ class RLEImage : public itk::ImageBase } /** Typedef for the internally used buffer. */ - typedef typename itk::Image BufferType; + using BufferType = typename itk::Image; /** We need to allow itk-style iterators to be constructed. */ typename BufferType::Pointer diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index c310e0ed084..92a12a80f96 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -44,8 +44,8 @@ class ImageConstIterator> friend class ::MultiLabelMeshPipeline; public: - /** Standard class typedefs. */ - typedef ImageConstIterator Self; + /** Standard class type alias. */ + using Self = ImageConstIterator; /** Dimension of the image the iterator walks. This constant is needed so * functions that are templated over image iterator type (as opposed to @@ -56,38 +56,38 @@ class ImageConstIterator> /** Run-time type information (and related methods). */ itkTypeMacroNoParent(ImageConstIterator); - /** Image typedef support. */ - typedef RLEImage ImageType; + /** Image type alias support. */ + using ImageType = RLEImage; /** Run-Length Line (we iterate along it). */ - typedef typename ImageType::RLLine RLLine; + using RLLine = typename ImageType::RLLine; /** Buffer Type used. */ - typedef typename ImageType::BufferType BufferType; + using BufferType = typename ImageType::BufferType; /** Type for the internal buffer iterator. */ - typedef ImageRegionIterator BufferIterator; + using BufferIterator = ImageRegionIterator; - /** Index typedef support. */ - typedef typename ImageType::IndexType IndexType; + /** Index type alias support. */ + using IndexType = typename ImageType::IndexType; - /** Index typedef support. */ - typedef typename ImageType::IndexValueType IndexValueType; + /** Index type alias support. */ + using IndexValueType = typename ImageType::IndexValueType; - /** Size typedef support. */ - typedef typename ImageType::SizeType SizeType; + /** Size type alias support. */ + using SizeType = typename ImageType::SizeType; - /** Offset typedef support. */ - typedef typename ImageType::OffsetType OffsetType; + /** Offset type alias support. */ + using OffsetType = typename ImageType::OffsetType; - /** Region typedef support. */ - typedef typename ImageType::RegionType RegionType; + /** Region type alias support. */ + using RegionType = typename ImageType::RegionType; /** Internal Pixel Type */ - typedef typename ImageType::InternalPixelType InternalPixelType; + using InternalPixelType = typename ImageType::InternalPixelType; /** External Pixel Type */ - typedef typename ImageType::PixelType PixelType; + using PixelType = typename ImageType::PixelType; /** Default Constructor. Need to provide a default constructor since we * provide a copy constructor. */ @@ -408,10 +408,10 @@ class ImageConstIteratorWithIndex // just inherit constructors public: - /** Image typedef support. */ - typedef RLEImage ImageType; + /** Image type alias support. */ + using ImageType = RLEImage; - typedef typename itk::ImageConstIterator>::RegionType RegionType; + using RegionType = typename itk::ImageConstIterator>::RegionType; void GoToReverseBegin() @@ -451,10 +451,10 @@ class ImageConstIteratorWithOnlyIndex ImageType; + /** Image type alias support. */ + using ImageType = RLEImage; - typedef typename itk::ImageConstIterator>::RegionType RegionType; + using RegionType = typename itk::ImageConstIterator>::RegionType; /** Default Constructor. Need to provide a default constructor since we * provide a copy constructor. */ diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 01590b45660..5746fa37596 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -37,8 +37,8 @@ class ImageIterator> : public ImageConstIterator> { public: - /** Standard class typedefs. */ - typedef ImageIterator Self; + /** Standard class type alias. */ + using Self = ImageIterator; /** Dimension of the image the iterator walks. This constant is needed so * functions that are templated over image iterator type (as opposed to @@ -47,16 +47,16 @@ class ImageIterator> static constexpr unsigned int ImageIteratorDimension = VImageDimension; /** Define the superclass */ - typedef ImageConstIterator> Superclass; + using Superclass = ImageConstIterator>; /** Inherit types from the superclass */ - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::OffsetType OffsetType; - typedef typename Superclass::RegionType RegionType; - typedef typename Superclass::ImageType ImageType; - typedef typename Superclass::InternalPixelType InternalPixelType; - typedef typename Superclass::PixelType PixelType; + using IndexType = typename Superclass::IndexType; + using SizeType = typename Superclass::SizeType; + using OffsetType = typename Superclass::OffsetType; + using RegionType = typename Superclass::RegionType; + using ImageType = typename Superclass::ImageType; + using InternalPixelType = typename Superclass::InternalPixelType; + using PixelType = typename Superclass::PixelType; /** Default Constructor. Need to provide a default constructor since we * provide a copy constructor. */ @@ -133,9 +133,9 @@ class ImageIteratorWithIndex> : public ImageConstIteratorWithIndex> { public: - typedef RLEImage ImageType; + using ImageType = RLEImage; - typedef typename itk::ImageConstIterator>::RegionType RegionType; + using RegionType = typename itk::ImageConstIterator>::RegionType; /** Default Constructor. Need to provide a default constructor since we * provide a copy constructor. */ diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index 6bd326b4599..ad7524256d6 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -45,9 +45,9 @@ class ImageRegionConstIterator> friend class ::MultiLabelMeshPipeline; public: - /** Standard class typedef. */ - typedef ImageRegionConstIterator> Self; - typedef ImageConstIterator> Superclass; + /** Standard class type alias. */ + using Self = ImageRegionConstIterator>; + using Superclass = ImageConstIterator>; /** Dimension of the image that the iterator walks. This constant is needed so * functions that are templated over image iterator type (as opposed to @@ -56,17 +56,17 @@ class ImageRegionConstIterator> static constexpr unsigned int ImageIteratorDimension = VImageDimension; /** - * Index typedef support. While these were already typdef'ed in the superclass, + * Index type alias support While these were already typdef'ed in the superclass, * they need to be redone here for this subclass to compile properly with gcc. */ /** Types inherited from the Superclass */ - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::OffsetType OffsetType; - typedef typename Superclass::RegionType RegionType; - typedef typename Superclass::ImageType ImageType; - typedef typename Superclass::InternalPixelType InternalPixelType; - typedef typename Superclass::PixelType PixelType; + using IndexType = typename Superclass::IndexType; + using SizeType = typename Superclass::SizeType; + using OffsetType = typename Superclass::OffsetType; + using RegionType = typename Superclass::RegionType; + using ImageType = typename Superclass::ImageType; + using InternalPixelType = typename Superclass::InternalPixelType; + using PixelType = typename Superclass::PixelType; /** Run-time type information (and related methods). */ itkTypeMacro(ImageRegionConstIterator, ImageConstIterator); @@ -171,9 +171,9 @@ class ImageRegionConstIteratorWithIndex> { public: - typedef RLEImage ImageType; + using ImageType = RLEImage; - typedef typename itk::ImageConstIterator>::RegionType RegionType; + using RegionType = typename itk::ImageConstIterator>::RegionType; /** Default constructor. Needed since we provide a cast constructor. */ ImageRegionConstIteratorWithIndex() @@ -220,9 +220,9 @@ class ImageRegionConstIteratorWithOnlyIndex ImageType; + using ImageType = RLEImage; - typedef typename itk::ImageConstIterator>::RegionType RegionType; + using RegionType = typename itk::ImageConstIterator>::RegionType; /** Default constructor. Needed since we provide a cast constructor. */ ImageRegionConstIteratorWithOnlyIndex() diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index dacd860885f..4107aa1b654 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -51,18 +51,18 @@ class ImageRegionIterator> : public ImageRegionConstIterator> { public: - /** Standard class typedefs. */ - typedef ImageRegionIterator Self; - typedef ImageRegionConstIterator> Superclass; + /** Standard class type alias. */ + using Self = ImageRegionIterator; + using Superclass = ImageRegionConstIterator>; /** Types inherited from the Superclass */ - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::OffsetType OffsetType; - typedef typename Superclass::RegionType RegionType; - typedef typename Superclass::ImageType ImageType; - typedef typename Superclass::InternalPixelType InternalPixelType; - typedef typename Superclass::PixelType PixelType; + using IndexType = typename Superclass::IndexType; + using SizeType = typename Superclass::SizeType; + using OffsetType = typename Superclass::OffsetType; + using RegionType = typename Superclass::RegionType; + using ImageType = typename Superclass::ImageType; + using InternalPixelType = typename Superclass::InternalPixelType; + using PixelType = typename Superclass::PixelType; /** Default constructor. Needed since we provide a cast constructor. */ ImageRegionIterator() @@ -112,9 +112,9 @@ class ImageRegionIteratorWithIndex> { public: - typedef RLEImage ImageType; + using ImageType = RLEImage; - typedef typename itk::ImageConstIterator>::RegionType RegionType; + using RegionType = typename itk::ImageConstIterator>::RegionType; /** Default constructor. Needed since we provide a cast constructor. */ ImageRegionIteratorWithIndex() diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index ba82764daf5..dd1a9a94a51 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -35,9 +35,9 @@ class ImageScanlineConstIterator> : public ImageRegionConstIterator> { public: - /** Standard class typedef. */ - typedef ImageScanlineConstIterator Self; - typedef ImageRegionConstIterator> Superclass; + /** Standard class type alias. */ + using Self = ImageScanlineConstIterator; + using Superclass = ImageRegionConstIterator>; /** Dimension of the image that the iterator walks. This constant is needed so * functions that are templated over image iterator type (as opposed to @@ -46,17 +46,17 @@ class ImageScanlineConstIterator> static constexpr unsigned int ImageIteratorDimension = VImageDimension; /** - * Index typedef support. While these were already typdef'ed in the superclass, + * Index type alias support While these were already typdef'ed in the superclass, * they need to be redone here for this subclass to compile properly with gcc. */ /** Types inherited from the Superclass */ - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::OffsetType OffsetType; - typedef typename Superclass::RegionType RegionType; - typedef typename Superclass::ImageType ImageType; - typedef typename Superclass::InternalPixelType InternalPixelType; - typedef typename Superclass::PixelType PixelType; + using IndexType = typename Superclass::IndexType; + using SizeType = typename Superclass::SizeType; + using OffsetType = typename Superclass::OffsetType; + using RegionType = typename Superclass::RegionType; + using ImageType = typename Superclass::ImageType; + using InternalPixelType = typename Superclass::InternalPixelType; + using PixelType = typename Superclass::PixelType; /** Run-time type information (and related methods). */ itkTypeMacro(ImageScanlineConstIterator, ImageRegionConstIterator); diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index af9b5a0d645..650e0f917d7 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -36,18 +36,18 @@ class ImageScanlineIterator> : public ImageScanlineConstIterator> { public: - /** Standard class typedefs. */ - typedef ImageScanlineIterator Self; - typedef ImageScanlineConstIterator> Superclass; + /** Standard class type alias. */ + using Self = ImageScanlineIterator; + using Superclass = ImageScanlineConstIterator>; /** Types inherited from the Superclass */ - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::OffsetType OffsetType; - typedef typename Superclass::RegionType RegionType; - typedef typename Superclass::ImageType ImageType; - typedef typename Superclass::InternalPixelType InternalPixelType; - typedef typename Superclass::PixelType PixelType; + using IndexType = typename Superclass::IndexType; + using SizeType = typename Superclass::SizeType; + using OffsetType = typename Superclass::OffsetType; + using RegionType = typename Superclass::RegionType; + using ImageType = typename Superclass::ImageType; + using InternalPixelType = typename Superclass::InternalPixelType; + using PixelType = typename Superclass::PixelType; /** Default constructor. Needed since we provide a cast constructor. */ ImageScanlineIterator() diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index cd5e1e1f702..d29e2d83e00 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -51,14 +51,14 @@ class RegionOfInterestImageFilter RLEImage> { public: - /** Standard class typedefs. */ - typedef RegionOfInterestImageFilter Self; - typedef RLEImage RLEImageType; - typedef RLEImageType ImageType; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; - typedef typename Superclass::InputImageRegionType InputImageRegionType; + /** Standard class type alias. */ + using Self = RegionOfInterestImageFilter; + using RLEImageType = RLEImage; + using ImageType = RLEImageType; + using Superclass = ImageToImageFilter; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; + using InputImageRegionType = typename Superclass::InputImageRegionType; /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -67,13 +67,13 @@ class RegionOfInterestImageFilter itkTypeMacro(RegionOfInterestImageFilter, ImageToImageFilter); /** Typedef to describe the input image region types. */ - typedef typename RLEImageType::RegionType RegionType; - typedef typename RLEImageType::IndexType IndexType; - typedef typename RLEImageType::SizeType SizeType; + using RegionType = typename RLEImageType::RegionType; + using IndexType = typename RLEImageType::IndexType; + using SizeType = typename RLEImageType::SizeType; /** Typedef to describe the type of pixel. */ - typedef typename RLEImageType::PixelType OutputImagePixelType; - typedef typename RLEImageType::PixelType InputImagePixelType; + using OutputImagePixelType = typename RLEImageType::PixelType; + using InputImagePixelType = typename RLEImageType::PixelType; /** Set/Get the output image region. */ itkSetMacro(RegionOfInterest, RegionType); @@ -144,15 +144,15 @@ class RegionOfInterestImageFilter> { public: - /** Standard class typedefs. */ - typedef RegionOfInterestImageFilter Self; - typedef RLEImage RLEImageTypeIn; - typedef RLEImage RLEImageTypeOut; - typedef RLEImageTypeOut ImageType; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; - typedef typename Superclass::InputImageRegionType InputImageRegionType; + /** Standard class type alias. */ + using Self = RegionOfInterestImageFilter; + using RLEImageTypeIn = RLEImage; + using RLEImageTypeOut = RLEImage; + using ImageType = RLEImageTypeOut; + using Superclass = ImageToImageFilter; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; + using InputImageRegionType = typename Superclass::InputImageRegionType; /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -161,13 +161,13 @@ class RegionOfInterestImageFilter, RLEImage, RLEImage> { public: - /** Standard class typedefs. */ - typedef RLEImage RLEImageType; + /** Standard class type alias. */ + using RLEImageType = RLEImage; - typedef RegionOfInterestImageFilter Self; - typedef Image ImageType; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; - typedef typename Superclass::InputImageRegionType InputImageRegionType; + using Self = RegionOfInterestImageFilter; + using ImageType = Image; + using Superclass = ImageToImageFilter; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; + using InputImageRegionType = typename Superclass::InputImageRegionType; /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -266,13 +266,13 @@ class RegionOfInterestImageFilter, RLEImage : public ImageToImageFilter, Image> { public: - /** Standard class typedefs. */ - typedef RLEImage RLEImageType; + /** Standard class type alias. */ + using RLEImageType = RLEImage; - typedef RegionOfInterestImageFilter Self; - typedef Image ImageType; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; - typedef typename Superclass::InputImageRegionType InputImageRegionType; + using Self = RegionOfInterestImageFilter; + using ImageType = Image; + using Superclass = ImageToImageFilter; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; + using InputImageRegionType = typename Superclass::InputImageRegionType; /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -354,13 +354,13 @@ class RegionOfInterestImageFilter itkTypeMacro(RegionOfInterestImageFilter, ImageToImageFilter); /** Typedef to describe the input image region types. */ - typedef typename RLEImageType::RegionType RegionType; - typedef typename RLEImageType::IndexType IndexType; - typedef typename RLEImageType::SizeType SizeType; + using RegionType = typename RLEImageType::RegionType; + using IndexType = typename RLEImageType::IndexType; + using SizeType = typename RLEImageType::SizeType; /** Typedef to describe the type of pixel. */ - typedef typename RLEImageType::PixelType OutputImagePixelType; - typedef typename RLEImageType::PixelType InputImagePixelType; + using OutputImagePixelType = typename RLEImageType::PixelType; + using InputImagePixelType = typename RLEImageType::PixelType; /** Set/Get the output image region. */ itkSetMacro(RegionOfInterest, RegionType); diff --git a/Modules/Filtering/RLEImage/test/iteratorTests.cxx b/Modules/Filtering/RLEImage/test/iteratorTests.cxx index 05a015841c1..a3d9b6b3b15 100644 --- a/Modules/Filtering/RLEImage/test/iteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/iteratorTests.cxx @@ -46,8 +46,8 @@ main(int argc, char * argv[]) itkImageIteratorWithIndexTest(argc, argv); itkImageRegionConstIteratorWithOnlyIndexTest(argc, argv); itkRegionOfInterestImageFilterTest(argc, argv); - typedef itk::RLEImage charred2dType; // test size 256 - charred2dType::Pointer t2 = charred2dType::New(); - typedef itk::RLEImage charred4dType; // test size 65536 - charred4dType::Pointer t4 = charred4dType::New(); + using charred2dType = itk::RLEImage; // test size 256 + charred2dType::Pointer t2 = charred2dType::New(); + using charred4dType = itk::RLEImage; // test size 65536 + charred4dType::Pointer t4 = charred4dType::New(); } diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx index e34f29ee027..4f313391ff6 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx @@ -85,11 +85,11 @@ itkImageIteratorTest(int, char *[]) (*o3).SetPixel(regionEndIndex3D, (*o3)[regionStartIndex3D]); TestConstPixelAccess(*o3, *o3); - typedef itk::Vector VectorPixelType; - typedef itk::RLEImage VectorImageType; + using VectorPixelType = itk::Vector; + using VectorImageType = itk::RLEImage; - typedef itk::ImageIterator VectorImageIterator; - typedef itk::ImageConstIterator VectorImageConstIterator; + using VectorImageIterator = itk::ImageIterator; + using VectorImageConstIterator = itk::ImageConstIterator; VectorImageIterator itr1(o3, region); VectorImageConstIterator itr2(o3, region); diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx index 7dc32cd82d6..6e1d4f226ed 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx @@ -27,13 +27,13 @@ class itkImageIteratorWithIndexTestIteratorTester { public: - typedef TPixelType PixelType; + using PixelType = TPixelType; - typedef itk::RLEImage ImageType; + using ImageType = itk::RLEImage; - typedef itk::ImageRegionIteratorWithIndex IteratorType; + using IteratorType = itk::ImageRegionIteratorWithIndex; - typedef itk::ImageRegionConstIteratorWithIndex ConstIteratorType; + using ConstIteratorType = itk::ImageRegionConstIteratorWithIndex; itkImageIteratorWithIndexTestIteratorTester(const PixelType & value) { @@ -276,8 +276,8 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; - typedef itk::Vector VC; - VC vc; + using VC = itk::Vector; + VC vc; vc.Fill(127); itkImageIteratorWithIndexTestIteratorTester TesterVC(vc); if (TesterVC.TestIterator() == false) @@ -294,8 +294,8 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; - typedef itk::Vector VUC; - VUC vuc; + using VUC = itk::Vector; + VUC vuc; vuc.Fill(10); itkImageIteratorWithIndexTestIteratorTester TesterVUC(vuc); if (TesterVUC.TestIterator() == false) @@ -312,8 +312,8 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; - typedef itk::Vector VS; - VS vs; + using VS = itk::Vector; + VS vs; vs.Fill(10); itkImageIteratorWithIndexTestIteratorTester TesterVS(vs); if (TesterVS.TestIterator() == false) @@ -330,8 +330,8 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; - typedef itk::Vector VUS; - VUS vus; + using VUS = itk::Vector; + VUS vus; vus.Fill(10); itkImageIteratorWithIndexTestIteratorTester TesterVUS(vus); if (TesterVUS.TestIterator() == false) @@ -348,8 +348,8 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; - typedef itk::Vector VI; - VI vi; + using VI = itk::Vector; + VI vi; vi.Fill(10); itkImageIteratorWithIndexTestIteratorTester TesterVI(vi); if (TesterVI.TestIterator() == false) @@ -366,8 +366,8 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; - typedef itk::Vector VUI; - VUI vui; + using VUI = itk::Vector; + VUI vui; vui.Fill(10); itkImageIteratorWithIndexTestIteratorTester TesterVUI(vui); if (TesterVUI.TestIterator() == false) @@ -384,8 +384,8 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; - typedef itk::Vector VF; - VF vf; + using VF = itk::Vector; + VF vf; vf.Fill(10); itkImageIteratorWithIndexTestIteratorTester TesterVF(vf); if (TesterVF.TestIterator() == false) @@ -402,8 +402,8 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< itk::Vector, 3 > " << std::endl; - typedef itk::Vector VD; - VD vd; + using VD = itk::Vector; + VD vd; vd.Fill(10); itkImageIteratorWithIndexTestIteratorTester TesterVD(vd); if (TesterVD.TestIterator() == false) diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx index 3a2fcedcc98..ef623d61ea4 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx @@ -25,7 +25,7 @@ itkImageIteratorsForwardBackwardTest(int, char *[]) { std::cout << "Creating an image" << std::endl; - typedef itk::RLEImage ImageType; + using ImageType = itk::RLEImage; ImageType::Pointer myImage = ImageType::New(); @@ -47,9 +47,9 @@ itkImageIteratorsForwardBackwardTest(int, char *[]) myImage->SetRequestedRegion(region); myImage->Allocate(); - typedef itk::ImageRegionIteratorWithIndex IteratorType; + using IteratorType = itk::ImageRegionIteratorWithIndex; - typedef itk::ImageRegionConstIteratorWithIndex ConstIteratorType; + using ConstIteratorType = itk::ImageRegionConstIteratorWithIndex; IteratorType it(myImage, region); diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx index 909d27dd947..c995c0ced86 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx @@ -25,10 +25,10 @@ class itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester { public: - typedef TImage ImageType; - typedef typename ImageType::IndexType IndexType; + using ImageType = TImage; + using IndexType = typename ImageType::IndexType; - typedef itk::ImageRegionConstIteratorWithOnlyIndex ConstIteratorType; + using ConstIteratorType = itk::ImageRegionConstIteratorWithOnlyIndex; itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester() { diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx index c688a6fa943..99f49484522 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx @@ -141,8 +141,8 @@ itkImageRegionIteratorTest(int, char *[]) // Iterate over a region, then change the region and iterate over the new region { // Create an image - typedef itk::RLEImage TestImageType; - TestImageType::IndexType imageCorner; + using TestImageType = itk::RLEImage; + TestImageType::IndexType imageCorner; imageCorner.Fill(0); TestImageType::SizeType imageSize; diff --git a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx index f3528e21e8f..acabe76b413 100644 --- a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx @@ -55,7 +55,7 @@ itkImageScanlineIteratorTest1(int, char *[]) float origin3D[3] = { 5.f, 2.1f, 8.1f }; float spacing3D[3] = { 1.5f, 2.1f, 1.f }; - typedef itk::RLEImage> ImageType; + using ImageType = itk::RLEImage>; ImageType::SizeType imageSize3D = { { 20, 40, 60 } }; ImageType::SizeType bufferSize3D = { { 20, 20, 14 } }; @@ -151,8 +151,8 @@ itkImageScanlineIteratorTest1(int, char *[]) // Iterate over a region, then change the region and iterate over the new region { // Create an image - typedef itk::Image TestImageType; - TestImageType::IndexType imageCorner; + using TestImageType = itk::Image; + TestImageType::IndexType imageCorner; imageCorner.Fill(0); TestImageType::SizeType imageSize; diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx index b40596153e6..4289ab97138 100644 --- a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx @@ -27,8 +27,8 @@ int itkIteratorTests(int, char *[]) { std::cout << "Creating an image" << std::endl; - typedef itk::RLEImage ScalarImage; - ScalarImage::Pointer o3 = ScalarImage::New(); + using ScalarImage = itk::RLEImage; + ScalarImage::Pointer o3 = ScalarImage::New(); double origin3D[3] = { 5, 2.1, 8.1 }; double spacing3D[3] = { 1.5, 2.1, 1 }; diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 0d782c3493d..afe8fd3412a 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -45,9 +45,9 @@ template void roiTest(itk::SmartPointer> orig) { - typedef itk::RLEImage myRLEImage; - typedef itk::RLEImage charRLEImage; - typedef itk::RegionOfInterestImageFilter charConverterType; + using myRLEImage = itk::RLEImage; + using charRLEImage = itk::RLEImage; + using charConverterType = itk::RegionOfInterestImageFilter; typename charConverterType::Pointer cConv = charConverterType::New(); cConv->SetInput(orig); cConv->SetRegionOfInterest(orig->GetLargestPossibleRegion()); @@ -55,8 +55,8 @@ roiTest(itk::SmartPointerGetOutput(); cIn->DisconnectPipeline(); - typedef itk::RLEImage ucharRLEImage; - typedef itk::RegionOfInterestImageFilter ucharConverterType; + using ucharRLEImage = itk::RLEImage; + using ucharConverterType = itk::RegionOfInterestImageFilter; typename ucharConverterType::Pointer ucConv = ucharConverterType::New(); ucConv->SetInput(orig); ucConv->SetRegionOfInterest(orig->GetLargestPossibleRegion()); @@ -89,23 +89,23 @@ roiTest(itk::SmartPointer myConverterType; - typename myConverterType::Pointer myConv = myConverterType::New(); + using myConverterType = itk::RegionOfInterestImageFilter; + typename myConverterType::Pointer myConv = myConverterType::New(); myConv->SetInput(orig); myConv->SetRegionOfInterest(reg); myConv->Update(); typename myRLEImage::Pointer myIn = myConv->GetOutput(); - typedef itk::RegionOfInterestImageFilter cRoIType; - typename cRoIType::Pointer cRoI = cRoIType::New(); + using cRoIType = itk::RegionOfInterestImageFilter; + typename cRoIType::Pointer cRoI = cRoIType::New(); cRoI->SetInput(cIn); cRoI->SetRegionOfInterest(rNeg); cRoI->Update(); cIn = cRoI->GetOutput(); cIn->DisconnectPipeline(); - typedef itk::RegionOfInterestImageFilter ucRoIType; - typename ucRoIType::Pointer ucRoI = ucRoIType::New(); + using ucRoIType = itk::RegionOfInterestImageFilter; + typename ucRoIType::Pointer ucRoI = ucRoIType::New(); ucRoI->SetInput(ucIn); ucRoI->SetRegionOfInterest(rNeg); ucRoI->Update(); @@ -126,15 +126,15 @@ template int doTest(std::string inFilename, std::string outFilename) { - typedef itk::ImageFileReader ReaderType; - typename ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = itk::ImageFileReader; + typename ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inFilename); std::cout << "Reading " << inFilename << std::endl; reader->Update(); - typedef itk::RLEImage myRLEImage; - typedef itk::RegionOfInterestImageFilter inConverterType; - typename inConverterType::Pointer inConv = inConverterType::New(); + using myRLEImage = itk::RLEImage; + using inConverterType = itk::RegionOfInterestImageFilter; + typename inConverterType::Pointer inConv = inConverterType::New(); inConv->SetInput(reader->GetOutput()); inConv->SetRegionOfInterest(reader->GetOutput()->GetLargestPossibleRegion()); std::cout << "Converting regular image to RLEImage" << std::endl; @@ -153,15 +153,15 @@ doTest(std::string inFilename, std::string outFilename) TRY_EXPECT_NO_EXCEPTION(roiTest(test)); } - typedef itk::RegionOfInterestImageFilter outConverterType; - typename outConverterType::Pointer outConv = outConverterType::New(); + using outConverterType = itk::RegionOfInterestImageFilter; + typename outConverterType::Pointer outConv = outConverterType::New(); outConv->SetInput(test); outConv->SetRegionOfInterest(test->GetLargestPossibleRegion()); std::cout << "Converting RLEImage to regular image" << std::endl; outConv->Update(); - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); + using WriterType = itk::ImageFileWriter; + typename WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outFilename); writer->SetInput(outConv->GetOutput()); writer->SetUseCompression(true); @@ -175,14 +175,14 @@ doTest(std::string inFilename, std::string outFilename) void dimTest() { - typedef itk::RLEImage S2Type; // 2D - typedef itk::RLEImage S3Type; // 3D - S2Type::Pointer s2 = S2Type::New(); - S3Type::Pointer s3 = S3Type::New(); + using S2Type = itk::RLEImage; // 2D + using S3Type = itk::RLEImage; // 3D + S2Type::Pointer s2 = S2Type::New(); + S3Type::Pointer s3 = S3Type::New(); // instantiation of "RoIType" is dissalowed due to different dimension // uncommenting the lines below should give a meaningful error message - // typedef itk::RegionOfInterestImageFilter RoIType; + // using RoIType = itk::RegionOfInterestImageFilter; // typename RoIType::Pointer roi = RoIType::New(); } @@ -197,8 +197,8 @@ itkRLEImageTest(int argc, char * argv[]) const char * inputImageFileName = argv[1]; const char * outputImageFileName = argv[2]; - typedef itk::ImageIOBase::IOComponentType ScalarPixelType; - itk::ImageIOBase::Pointer imageIO = + using ScalarPixelType = itk::ImageIOBase::IOComponentType; + itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(inputImageFileName, itk::ImageIOFactory::ReadMode); if (!imageIO) { diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx index 1a7f7575f68..a2c372ae6a7 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx @@ -24,20 +24,20 @@ int itkRegionOfInterestImageFilterTest(int, char *[]) { - const unsigned int Dimension = 3; - typedef itk::Index PixelType; + const unsigned int Dimension = 3; + using PixelType = itk::Index; - typedef itk::RLEImage ImageType; + using ImageType = itk::RLEImage; - typedef itk::RegionOfInterestImageFilter FilterType; + using FilterType = itk::RegionOfInterestImageFilter; - typedef ImageType::RegionType RegionType; - typedef ImageType::SizeType SizeType; - typedef ImageType::IndexType IndexType; - typedef ImageType::DirectionType DirectionType; + using RegionType = ImageType::RegionType; + using SizeType = ImageType::SizeType; + using IndexType = ImageType::IndexType; + using DirectionType = ImageType::DirectionType; - typedef itk::ImageRegionIterator IteratorType; + using IteratorType = itk::ImageRegionIterator; FilterType::Pointer filter = FilterType::New(); diff --git a/Modules/Filtering/RLEImage/test/rleStats.cxx b/Modules/Filtering/RLEImage/test/rleStats.cxx index e5c24006f56..d9fea33ec5d 100644 --- a/Modules/Filtering/RLEImage/test/rleStats.cxx +++ b/Modules/Filtering/RLEImage/test/rleStats.cxx @@ -31,15 +31,15 @@ main(int argc, char * argv[]) return EXIT_FAILURE; } - typedef itk::Image ImageType; - typedef itk::RLEImage myRLEImage; + using ImageType = itk::Image; + using myRLEImage = itk::RLEImage; - typedef itk::ImageFileReader ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = itk::ImageFileReader; + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); - typedef itk::RegionOfInterestImageFilter inConverterType; - inConverterType::Pointer inConv = inConverterType::New(); + using inConverterType = itk::RegionOfInterestImageFilter; + inConverterType::Pointer inConv = inConverterType::New(); try { From ac9bbd05b248ea64dcdb0213b6782c6ddc8d02ee Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Tue, 13 Feb 2018 08:25:19 -0600 Subject: [PATCH 43/95] STYLE: Prefer constexpr for const numeric literals Use constexpr for constant numeric literals. --- Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx | 2 +- .../RLEImage/test/itkRegionOfInterestImageFilterTest.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx index 4f313391ff6..fce5e1fe119 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx @@ -45,7 +45,7 @@ TestConstPixelAccess(const itk::RLEImage & in, itk::RLEImage & out) int itkImageIteratorTest(int, char *[]) { - const unsigned int ImageDimension = 3; + constexpr unsigned int ImageDimension = 3; std::cout << "Creating an image" << std::endl; itk::RLEImage>::Pointer o3 = itk::RLEImage>::New(); diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx index a2c372ae6a7..6e7a2c637e1 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx @@ -24,7 +24,7 @@ int itkRegionOfInterestImageFilterTest(int, char *[]) { - const unsigned int Dimension = 3; + constexpr unsigned int Dimension = 3; using PixelType = itk::Index; using ImageType = itk::RLEImage; From 0ee907ee4edccb6f19d7d9419c5c8f227879b8e3 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Sat, 14 Apr 2018 19:18:46 +0200 Subject: [PATCH 44/95] COMP: Move ITK_DISALLOW_COPY_AND_ASSIGN calls to public section. Move `ITK_DISALLOW_COPY_AND_ASSIGN` calls to public section following the discussion in https://discourse.itk.org/t/noncopyable If legacy (pre-macro) copy and assing methods existed, subsitute them for the `ITK_DISALLOW_COPY_AND_ASSIGN` macro. --- .../Filtering/RLEImage/include/itkRLEImage.h | 6 ++---- .../itkRLERegionOfInterestImageFilter.h | 18 ++++++------------ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 5cd14c41b4f..45138275b65 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -52,6 +52,8 @@ template { public: + ITK_DISALLOW_COPY_AND_ASSIGN(RLEImage); + /** Standard class type alias */ using Self = RLEImage; using Superclass = itk::ImageBase; @@ -305,10 +307,6 @@ class RLEImage : public itk::ImageBase private: bool m_OnTheFlyCleanup; // should same-valued segments be merged on the fly - RLEImage(const Self &); // purposely not implemented - void - operator=(const Self &); // purposely not implemented - /** Memory for the current buffer. */ mutable typename BufferType::Pointer m_Buffer; }; diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index d29e2d83e00..485273b1f33 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -51,6 +51,8 @@ class RegionOfInterestImageFilter RLEImage> { public: + ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter); + /** Standard class type alias. */ using Self = RegionOfInterestImageFilter; using RLEImageType = RLEImage; @@ -126,10 +128,6 @@ class RegionOfInterestImageFilter ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) override; private: - RegionOfInterestImageFilter(const Self &); // purposely not implemented - void - operator=(const Self &); // purposely not implemented - RegionType m_RegionOfInterest; }; @@ -249,6 +247,8 @@ class RegionOfInterestImageFilter, RLEImage, RLEImage> { public: + ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter); + /** Standard class type alias. */ using RLEImageType = RLEImage; @@ -325,10 +325,6 @@ class RegionOfInterestImageFilter, RLEImage : public ImageToImageFilter, Image> { public: + ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter); + /** Standard class type alias. */ using RLEImageType = RLEImage; @@ -413,10 +411,6 @@ class RegionOfInterestImageFilter ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) override; private: - RegionOfInterestImageFilter(const Self &); // purposely not implemented - void - operator=(const Self &); // purposely not implemented - RegionType m_RegionOfInterest; }; } // end namespace itk From c9b5566469049c8a5fc3e86a31789aced0cc4826 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Sat, 5 May 2018 12:31:33 +0200 Subject: [PATCH 45/95] COMP: Set the minimum required CMake version to 3.10.2. As agreed in: https://discourse.itk.org/t/cmake-update/870/ Set the `cmake_minimum_required` to version **3.10.2**. --- Modules/Filtering/RLEImage/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/CMakeLists.txt b/Modules/Filtering/RLEImage/CMakeLists.txt index d826bd45174..c053e1ed0e1 100644 --- a/Modules/Filtering/RLEImage/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9.5) +cmake_minimum_required(VERSION 3.10.2) project(RLEImage) if(NOT ITK_SOURCE_DIR) From 3aee2f1d73adf9e88858f46a22a4a56179790fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 15 May 2018 17:29:49 -0400 Subject: [PATCH 46/95] STYLE: aligning header comments, removing comments from implementation file --- .../Filtering/RLEImage/include/itkRLEImage.h | 1 - .../itkRLERegionOfInterestImageFilter.hxx | 91 ++----------------- 2 files changed, 7 insertions(+), 85 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 45138275b65..58a9aca8571 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -281,7 +281,6 @@ class RLEImage : public itk::ImageBase : itk::ImageBase() , m_OnTheFlyCleanup(true) { - // m_OnTheFlyCleanup = true; m_Buffer = BufferType::New(); } diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index f84325754d0..1978771f99b 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -136,15 +136,7 @@ RegionOfInterestImageFilter, output->SetRequestedRegionToLargestPossibleRegion(); } -/** - * RegionOfInterestImageFilter can produce an image which is a different size - * than its input image. As such, RegionOfInterestImageFilter needs to provide an - * implementation for GenerateOutputInformation() in order to inform - * the pipeline execution model. The original documentation of this - * method is below. - * - * \sa ProcessObject::GenerateOutputInformaton() - */ + template void RegionOfInterestImageFilter, @@ -183,18 +175,7 @@ RegionOfInterestImageFilter, outputPtr->SetOrigin(outputOrigin); } // >::GenerateOutputInformation -/** - * RegionOfInterestImageFilter can be implemented as a multithreaded filter. - * Therefore, this implementation provides a ThreadedGenerateData() - * routine which is called for each processing thread. The output - * image data is allocated automatically by the superclass prior to - * calling ThreadedGenerateData(). ThreadedGenerateData can only - * write to the portion of the output image specified by the - * parameter "outputRegionForThread" - * - * \sa ImageToImageFilter::ThreadedGenerateData(), - * ImageToImageFilter::GenerateData() - */ + template void RegionOfInterestImageFilter< @@ -297,15 +278,7 @@ RegionOfInterestImageFilter< output->SetRequestedRegionToLargestPossibleRegion(); } -/** - * RegionOfInterestImageFilter can produce an image which is a different size - * than its input image. As such, RegionOfInterestImageFilter needs to provide an - * implementation for GenerateOutputInformation() in order to inform - * the pipeline execution model. The original documentation of this - * method is below. - * - * \sa ProcessObject::GenerateOutputInformaton() - */ + template , outputPtr->SetOrigin(outputOrigin); } // >::GenerateOutputInformation -/** - * RegionOfInterestImageFilter can be implemented as a multithreaded filter. - * Therefore, this implementation provides a ThreadedGenerateData() - * routine which is called for each processing thread. The output - * image data is allocated automatically by the superclass prior to - * calling ThreadedGenerateData(). ThreadedGenerateData can only - * write to the portion of the output image specified by the - * parameter "outputRegionForThread" - * - * \sa ImageToImageFilter::ThreadedGenerateData(), - * ImageToImageFilter::GenerateData() - */ + template , RLEImageSetRequestedRegionToLargestPossibleRegion(); } -/** - * RegionOfInterestImageFilter can produce an image which is a different size - * than its input image. As such, RegionOfInterestImageFilter needs to provide an - * implementation for GenerateOutputInformation() in order to inform - * the pipeline execution model. The original documentation of this - * method is below. - * - * \sa ProcessObject::GenerateOutputInformaton() - */ + template void RegionOfInterestImageFilter, @@ -486,18 +440,7 @@ RegionOfInterestImageFilter, outputPtr->SetOrigin(outputOrigin); } // >::GenerateOutputInformation -/** - * RegionOfInterestImageFilter can be implemented as a multithreaded filter. - * Therefore, this implementation provides a ThreadedGenerateData() - * routine which is called for each processing thread. The output - * image data is allocated automatically by the superclass prior to - * calling ThreadedGenerateData(). ThreadedGenerateData can only - * write to the portion of the output image specified by the - * parameter "outputRegionForThread" - * - * \sa ImageToImageFilter::ThreadedGenerateData(), - * ImageToImageFilter::GenerateData() - */ + template void RegionOfInterestImageFilter, RLEImage>:: @@ -592,15 +535,7 @@ RegionOfInterestImageFilter, output->SetRequestedRegionToLargestPossibleRegion(); } -/** - * RegionOfInterestImageFilter can produce an image which is a different size - * than its input image. As such, RegionOfInterestImageFilter needs to provide an - * implementation for GenerateOutputInformation() in order to inform - * the pipeline execution model. The original documentation of this - * method is below. - * - * \sa ProcessObject::GenerateOutputInformaton() - */ + template void RegionOfInterestImageFilter, @@ -639,18 +574,6 @@ RegionOfInterestImageFilter, outputPtr->SetOrigin(outputOrigin); } // >::GenerateOutputInformation -/** - * RegionOfInterestImageFilter can be implemented as a multithreaded filter. - * Therefore, this implementation provides a ThreadedGenerateData() - * routine which is called for each processing thread. The output - * image data is allocated automatically by the superclass prior to - * calling ThreadedGenerateData(). ThreadedGenerateData can only - * write to the portion of the output image specified by the - * parameter "outputRegionForThread" - * - * \sa ImageToImageFilter::ThreadedGenerateData(), - * ImageToImageFilter::GenerateData() - */ template void RegionOfInterestImageFilter, Image>:: From 33c5d34cc6b0468ad4138e4d23d901a2d63dc564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 15 May 2018 17:30:46 -0400 Subject: [PATCH 47/95] ENH: adding a small test image to aid debugging, updating Dockerfile --- Modules/Filtering/RLEImage/test/CMakeLists.txt | 1 + Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 | 1 + 2 files changed, 2 insertions(+) create mode 100644 Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index fb748d55cb2..3bf1b1169dd 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -45,6 +45,7 @@ function(ReadWriteTest ImageName Ext) endfunction() # RLEImage specific tests - quick +readwritetest(Small2D png) readwritetest(brainParc mha) readwritetest(vb-seg mha) readwritetest(ws nrrd) diff --git a/Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 b/Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 new file mode 100644 index 00000000000..f68234ba3cc --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 @@ -0,0 +1 @@ +7dced0d036fb021f5c061ade92cc100a From 92b63a71d425ad1c76ed3ed511bda7f84da3fcdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 15 May 2018 17:33:25 -0400 Subject: [PATCH 48/95] ENH: using the new multi-threading mechanism Also fixing bugs caused by region pieces not always containing whole run-length lines, which appear frequently with TBB multi-threader. --- .../itkRLERegionOfInterestImageFilter.h | 24 ++--- .../itkRLERegionOfInterestImageFilter.hxx | 89 +++++++++++++------ 2 files changed, 75 insertions(+), 38 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 485273b1f33..713ec56572c 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -116,16 +116,16 @@ class RegionOfInterestImageFilter GenerateOutputInformation() override; /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. - * Therefore, this implementation provides a ThreadedGenerateData() + * Therefore, this implementation provides a DynamicThreadedGenerateData() * routine which is called for each processing thread. The output * image data is allocated automatically by the superclass prior to - * calling ThreadedGenerateData(). ThreadedGenerateData can only + * calling DynamicThreadedGenerateData(). DynamicThreadedGenerateData can only * write to the portion of the output image specified by the * parameter "outputRegionForThread" * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) override; + DynamicThreadedGenerateData(const RegionType & outputRegionForThread) override; private: RegionType m_RegionOfInterest; @@ -206,16 +206,16 @@ class RegionOfInterestImageFilter, RLEImage GenerateOutputInformation() override; /** RegionOfInterestImageFilter can be implemented as a multithreaded filter. - * Therefore, this implementation provides a ThreadedGenerateData() + * Therefore, this implementation provides a DynamicThreadedGenerateData() * routine which is called for each processing thread. The output * image data is allocated automatically by the superclass prior to - * calling ThreadedGenerateData(). ThreadedGenerateData can only + * calling DynamicThreadedGenerateData(). DynamicThreadedGenerateData can only * write to the portion of the output image specified by the * parameter "outputRegionForThread" * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) override; + DynamicThreadedGenerateData(const RegionType & outputRegionForThread) override; private: RegionType m_RegionOfInterest; diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 1978771f99b..5301d7e9063 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -180,30 +180,42 @@ template void RegionOfInterestImageFilter< RLEImage, - RLEImage>::ThreadedGenerateData(const RegionType & outputRegionForThread, - ThreadIdType itkNotUsed(threadId)) + RLEImage>::DynamicThreadedGenerateData(const RegionType & outputRegionForThread) { // Get the input and output pointers const RLEImageType * in = this->GetInput(); RLEImageType * out = this->GetOutput(); + // Concurrent writing to RLLine is not supported, + // so we ignore all the output regions which do not start + // at the beginning of a line. + // But the regions which do start at the beginning of a line + // must process the whole line + RegionType reqRegion = out->GetRequestedRegion(); + if (reqRegion.GetIndex(0) != outputRegionForThread.GetIndex(0)) + { + return; // another thread will process this + } + RegionType outRegion = outputRegionForThread; + outRegion.SetSize(0, reqRegion.GetSize(0)); + // Define the portion of the input to walk for this thread InputImageRegionType inputRegionForThread; - inputRegionForThread.SetSize(outputRegionForThread.GetSize()); + inputRegionForThread.SetSize(outRegion.GetSize()); IndexType start, end; IndexType roiStart(m_RegionOfInterest.GetIndex()); - IndexType threadStart(outputRegionForThread.GetIndex()); + IndexType threadStart(outRegion.GetIndex()); for (unsigned int i = 0; i < VImageDimension; i++) { start[i] = roiStart[i] + threadStart[i]; - end[i] = roiStart[i] + threadStart[i] + outputRegionForThread.GetSize(i); + end[i] = roiStart[i] + threadStart[i] + outRegion.GetSize(i); } inputRegionForThread.SetIndex(start); - bool copyLines = (in->GetLargestPossibleRegion().GetSize(0) == outputRegionForThread.GetSize(0)); - typename ImageType::BufferType::RegionType oReg = ImageType::truncateRegion(outputRegionForThread); + bool copyLines = (in->GetLargestPossibleRegion().GetSize(0) == outRegion.GetSize(0)); + typename ImageType::BufferType::RegionType oReg = ImageType::truncateRegion(outRegion); typename ImageType::BufferType::RegionType iReg = ImageType::truncateRegion(inputRegionForThread); ImageRegionConstIterator iIt(in->GetBuffer(), iReg); ImageRegionIterator oIt(out->GetBuffer(), oReg); @@ -222,7 +234,7 @@ RegionOfInterestImageFilter< { copyImagePortion(iIt, oIt, start[0], end[0]); } -} // >::ThreadedGenerateData +} // DynamicThreadedGenerateData template void -RegionOfInterestImageFilter< - RLEImage, - RLEImage>::ThreadedGenerateData(const RegionType & outputRegionForThread, - ThreadIdType itkNotUsed(threadId)) +RegionOfInterestImageFilter, + RLEImage>:: + DynamicThreadedGenerateData(const RegionType & outputRegionForThread) { // Get the input and output pointers const RLEImageTypeIn * in = this->GetInput(); RLEImageTypeOut * out = this->GetOutput(); + // Concurrent writing to RLLine is not supported, + // so we ignore all the output regions which do not start + // at the beginning of a line. + // But the regions which do start at the beginning of a line + // must process the whole line + RegionType reqRegion = out->GetRequestedRegion(); + if (reqRegion.GetIndex(0) != outputRegionForThread.GetIndex(0)) + { + return; // another thread will process this + } + RegionType outRegion = outputRegionForThread; + outRegion.SetSize(0, reqRegion.GetSize(0)); + // Define the portion of the input to walk for this thread InputImageRegionType inputRegionForThread; - inputRegionForThread.SetSize(outputRegionForThread.GetSize()); + inputRegionForThread.SetSize(outRegion.GetSize()); IndexType start, end; IndexType roiStart(m_RegionOfInterest.GetIndex()); - IndexType threadStart(outputRegionForThread.GetIndex()); + IndexType threadStart(outRegion.GetIndex()); for (unsigned int i = 0; i < VImageDimension; i++) { start[i] = roiStart[i] + threadStart[i]; - end[i] = roiStart[i] + threadStart[i] + outputRegionForThread.GetSize(i); + end[i] = roiStart[i] + threadStart[i] + outRegion.GetSize(i); } inputRegionForThread.SetIndex(start); typename RLEImageTypeIn::BufferType::RegionType iReg = RLEImageTypeIn::truncateRegion(inputRegionForThread); - typename RLEImageTypeOut::BufferType::RegionType oReg = RLEImageTypeOut::truncateRegion(outputRegionForThread); + typename RLEImageTypeOut::BufferType::RegionType oReg = RLEImageTypeOut::truncateRegion(outRegion); ImageRegionConstIterator iIt(in->GetBuffer(), iReg); ImageRegionIterator oIt(out->GetBuffer(), oReg); copyImagePortion(iIt, oIt, start[0], end[0]); -} // >::ThreadedGenerateData +} // DynamicThreadedGenerateData template void @@ -444,31 +468,44 @@ RegionOfInterestImageFilter, template void RegionOfInterestImageFilter, RLEImage>:: - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType itkNotUsed(threadId)) + DynamicThreadedGenerateData(const RegionType & outputRegionForThread) { // Get the input and output pointers const ImageType * in = this->GetInput(); RLEImageType * out = this->GetOutput(); + // Concurrent writing to RLLine is not supported, + // so we ignore all the output regions which do not start + // at the beginning of a line. + // But the regions which do start at the beginning of a line + // must process the whole line + RegionType reqRegion = out->GetRequestedRegion(); + if (reqRegion.GetIndex(0) != outputRegionForThread.GetIndex(0)) + { + return; // another thread will process this + } + RegionType outRegion = outputRegionForThread; + outRegion.SetSize(0, reqRegion.GetSize(0)); + // Define the portion of the input to walk for this thread InputImageRegionType inputRegionForThread; - inputRegionForThread.SetSize(outputRegionForThread.GetSize()); + inputRegionForThread.SetSize(outRegion.GetSize()); IndexType start, end; IndexType roiStart(m_RegionOfInterest.GetIndex()); - IndexType threadStart(outputRegionForThread.GetIndex()); + IndexType threadStart(outRegion.GetIndex()); for (unsigned int i = 0; i < VImageDimension; i++) { start[i] = roiStart[i] + threadStart[i]; - end[i] = roiStart[i] + threadStart[i] + outputRegionForThread.GetSize(i); + end[i] = roiStart[i] + threadStart[i] + outRegion.GetSize(i); } inputRegionForThread.SetIndex(start); - typename RLEImageType::BufferType::RegionType oReg = RLEImageType::truncateRegion(outputRegionForThread); + typename RLEImageType::BufferType::RegionType oReg = RLEImageType::truncateRegion(outRegion); ImageRegionConstIterator iIt(in, inputRegionForThread); ImageRegionIterator oIt(out->GetBuffer(), oReg); - SizeValueType size0 = outputRegionForThread.GetSize(0); + SizeValueType size0 = outRegion.GetSize(0); typename RLEImageType::RLLine temp; temp.reserve(size0); // pessimistically preallocate buffer, otherwise reallocations can occur @@ -492,7 +529,7 @@ RegionOfInterestImageFilter, RLEImage::ThreadedGenerateData +} // DynamicThreadedGenerateData template void @@ -577,7 +614,7 @@ RegionOfInterestImageFilter, template void RegionOfInterestImageFilter, Image>:: - ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType itkNotUsed(threadId)) + DynamicThreadedGenerateData(const RegionType & outputRegionForThread) { // Get the input and output pointers const RLEImageType * in = this->GetInput(); @@ -656,7 +693,7 @@ RegionOfInterestImageFilter, Imag } ++iIt; } -} // >::ThreadedGenerateData +} // DynamicThreadedGenerateData } // end namespace itk #endif // itkRLERegionOfInterestImageFilter_hxx From 44eb911ad6f2ff2e0ed4db3be56510bb38f15c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 16 May 2018 13:22:57 -0400 Subject: [PATCH 49/95] ENH: simplifying code by using Region::Slice() --- .../Filtering/RLEImage/include/itkRLEImage.h | 14 +++--------- .../RLEImage/include/itkRLEImage.hxx | 22 ------------------- .../include/itkRLEImageConstIterator.h | 2 +- .../itkRLERegionOfInterestImageFilter.hxx | 12 +++++----- 4 files changed, 10 insertions(+), 40 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 58a9aca8571..13d66d87a44 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -153,14 +153,14 @@ class RLEImage : public itk::ImageBase SetLargestPossibleRegion(const RegionType & region) override { Superclass::SetLargestPossibleRegion(region); - m_Buffer->SetLargestPossibleRegion(truncateRegion(region)); + m_Buffer->SetLargestPossibleRegion(region.Slice(0)); } void SetBufferedRegion(const RegionType & region) override { Superclass::SetBufferedRegion(region); - m_Buffer->SetBufferedRegion(truncateRegion(region)); + m_Buffer->SetBufferedRegion(region.Slice(0)); } using ImageBase::SetRequestedRegion; @@ -169,7 +169,7 @@ class RLEImage : public itk::ImageBase SetRequestedRegion(const RegionType & region) override { Superclass::SetRequestedRegion(region); - m_Buffer->SetRequestedRegion(truncateRegion(region)); + m_Buffer->SetRequestedRegion(region.Slice(0)); } /** \brief Set a pixel value. @@ -239,14 +239,6 @@ class RLEImage : public itk::ImageBase static inline typename BufferType::IndexType truncateIndex(const IndexType & index); - /** Returns N-1-dimensional size, the remainder after 0-size is removed. */ - static inline typename BufferType::SizeType - truncateSize(const SizeType & size); - - /** Returns N-1-dimensional region, the remainder after 0-index and size are removed. */ - static typename BufferType::RegionType - truncateRegion(const RegionType & region); - /** Merges adjacent segments with duplicate values. * Automatically called when turning on OnTheFlyCleanup. */ void diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index 563bf6984cf..51834b71e5c 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -41,28 +41,6 @@ RLEImage::truncateIndex(const IndexType & return result; } -template -inline typename RLEImage::BufferType::SizeType -RLEImage::truncateSize(const SizeType & size) -{ - typename BufferType::SizeType result; - for (IndexValueType i = 0; i < VImageDimension - 1; i++) - { - result[i] = size[i + 1]; - } - return result; -} - -template -typename RLEImage::BufferType::RegionType -RLEImage::truncateRegion(const RegionType & region) -{ - typename BufferType::RegionType result; - result.SetIndex(truncateIndex(region.GetIndex())); - result.SetSize(truncateSize(region.GetSize())); - return result; -} - template void RLEImage::Allocate(bool itkNotUsed(initialize)) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 92a12a80f96..5623536019e 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -164,7 +164,7 @@ class ImageConstIterator> "Region " << region << " is outside of buffered region " << bufferedRegion); } - m_BI = BufferIterator(m_Buffer, ImageType::truncateRegion(region)); + m_BI = BufferIterator(m_Buffer, region.Slice(0)); m_Index0 = region.GetIndex(0); m_BeginIndex0 = m_Index0 - m_Image->GetBufferedRegion().GetIndex(0); m_EndIndex0 = m_BeginIndex0 + region.GetSize(0); diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 5301d7e9063..74fa5cee54c 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -215,8 +215,8 @@ RegionOfInterestImageFilter< inputRegionForThread.SetIndex(start); bool copyLines = (in->GetLargestPossibleRegion().GetSize(0) == outRegion.GetSize(0)); - typename ImageType::BufferType::RegionType oReg = ImageType::truncateRegion(outRegion); - typename ImageType::BufferType::RegionType iReg = ImageType::truncateRegion(inputRegionForThread); + typename ImageType::BufferType::RegionType oReg = outRegion.Slice(0); + typename ImageType::BufferType::RegionType iReg = inputRegionForThread.Slice(0); ImageRegionConstIterator iIt(in->GetBuffer(), iReg); ImageRegionIterator oIt(out->GetBuffer(), oReg); @@ -376,8 +376,8 @@ RegionOfInterestImageFilter, } inputRegionForThread.SetIndex(start); - typename RLEImageTypeIn::BufferType::RegionType iReg = RLEImageTypeIn::truncateRegion(inputRegionForThread); - typename RLEImageTypeOut::BufferType::RegionType oReg = RLEImageTypeOut::truncateRegion(outRegion); + typename RLEImageTypeIn::BufferType::RegionType iReg = inputRegionForThread.Slice(0); + typename RLEImageTypeOut::BufferType::RegionType oReg = outRegion.Slice(0); ImageRegionConstIterator iIt(in->GetBuffer(), iReg); ImageRegionIterator oIt(out->GetBuffer(), oReg); @@ -502,7 +502,7 @@ RegionOfInterestImageFilter, RLEImage iIt(in, inputRegionForThread); ImageRegionIterator oIt(out->GetBuffer(), oReg); SizeValueType size0 = outRegion.GetSize(0); @@ -635,7 +635,7 @@ RegionOfInterestImageFilter, Imag } inputRegionForThread.SetIndex(start); - typename RLEImageType::BufferType::RegionType iReg = RLEImageType::truncateRegion(inputRegionForThread); + typename RLEImageType::BufferType::RegionType iReg = inputRegionForThread.Slice(0); ImageRegionConstIterator iIt(in->GetBuffer(), iReg); ImageRegionIterator oIt(out, outputRegionForThread); From a5050043c806673c3caf4915b9fbe5a14f3c3ba3 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Mon, 21 May 2018 19:00:36 +0200 Subject: [PATCH 50/95] BUG: Fix test errors steming from the new multi-threading mechanism. Fix errors steming from the use of the new `itk::PoolMultiThreader` class for multi-threading. The errors stemmed when this gerrit topic got merged: http://review.source.kitware.com/#/c/23175/ And were later related to the following gerrit-topic: http://review.source.kitware.com/#/c/23434/ The solution adopted in this patch set was based on the proposal in: http://review.source.kitware.com/#/c/23439/ --- .../include/itkRLERegionOfInterestImageFilter.h | 10 +++++----- .../include/itkRLERegionOfInterestImageFilter.hxx | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 713ec56572c..05499494267 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -93,7 +93,7 @@ class RegionOfInterestImageFilter #endif protected: - RegionOfInterestImageFilter() {} + RegionOfInterestImageFilter() { m_DynamicMultiThreading = true; } ~RegionOfInterestImageFilter() override {} void PrintSelf(std::ostream & os, Indent indent) const override; @@ -122,7 +122,7 @@ class RegionOfInterestImageFilter * calling DynamicThreadedGenerateData(). DynamicThreadedGenerateData can only * write to the portion of the output image specified by the * parameter "outputRegionForThread" - * \sa ImageToImageFilter::ThreadedGenerateData(), + * \sa ImageToImageFilter::DynamicThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void DynamicThreadedGenerateData(const RegionType & outputRegionForThread) override; @@ -183,7 +183,7 @@ class RegionOfInterestImageFilter, RLEImage #endif protected: - RegionOfInterestImageFilter() {} + RegionOfInterestImageFilter() { m_DynamicMultiThreading = true; } ~RegionOfInterestImageFilter() override {} void PrintSelf(std::ostream & os, Indent indent) const override; diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 74fa5cee54c..0fc3dc4b0de 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -23,7 +23,6 @@ #include "itkImage.h" #include "itkImageAlgorithm.h" #include "itkObjectFactory.h" -#include "itkProgressReporter.h" #include "itkRegionOfInterestImageFilter.h" #include From 35986e02c3139b7783fa30a468455b76a43efc07 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Mon, 28 May 2018 09:10:33 +0200 Subject: [PATCH 51/95] ENH: Prefer boolean macro call to initialize dynamic multi-threading ivar. Prefer the boolean macro function call to initialize the dynamic multi-threading ivar for the reasons stated here: http://review.source.kitware.com/#/c/23434/ --- .../RLEImage/include/itkRLERegionOfInterestImageFilter.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 05499494267..9d22c04ac11 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -93,7 +93,7 @@ class RegionOfInterestImageFilter #endif protected: - RegionOfInterestImageFilter() { m_DynamicMultiThreading = true; } + RegionOfInterestImageFilter() { this->DynamicMultiThreadingOn(); } ~RegionOfInterestImageFilter() override {} void PrintSelf(std::ostream & os, Indent indent) const override; @@ -183,7 +183,7 @@ class RegionOfInterestImageFilterDynamicMultiThreadingOn(); } ~RegionOfInterestImageFilter() override {} void PrintSelf(std::ostream & os, Indent indent) const override; @@ -290,7 +290,7 @@ class RegionOfInterestImageFilter, RLEImageDynamicMultiThreadingOn(); } ~RegionOfInterestImageFilter() override {} void PrintSelf(std::ostream & os, Indent indent) const override; @@ -376,7 +376,7 @@ class RegionOfInterestImageFilter #endif protected: - RegionOfInterestImageFilter() { m_DynamicMultiThreading = true; } + RegionOfInterestImageFilter() { this->DynamicMultiThreadingOn(); } ~RegionOfInterestImageFilter() override {} void PrintSelf(std::ostream & os, Indent indent) const override; From bdad1a6f8adf1f15aa8762f7f3a0dcadc7805317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 15 Oct 2018 14:55:35 -0400 Subject: [PATCH 52/95] ENH: Replacing MD5 hashes by SHA512 hashes in test data --- Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 | 1 - Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 | 1 - Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/2D.png.md5 | 1 - Modules/Filtering/RLEImage/test/Input/2D.png.sha512 | 1 + .../Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 | 1 - .../RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 | 1 + .../Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 | 1 - .../RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 | 1 + .../Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 | 1 - .../RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 | 1 + .../Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 | 1 - .../RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 | 1 + .../RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 | 1 - .../RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 | 1 + .../RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 | 1 - .../RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 | 1 + .../RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 | 1 - .../RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 | 1 - .../Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 | 1 - Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 | 1 + .../RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 | 1 - .../RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 | 1 + .../RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 | 1 - .../RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/brainParc.mha.md5 | 1 - Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 | 1 - Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 | 1 + Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 | 1 - Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 | 1 + 70 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/2D.png.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/2D.png.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/brainParc.mha.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 delete mode 100644 Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 create mode 100644 Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 diff --git a/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 deleted file mode 100644 index cdcfca6fe01..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.md5 +++ /dev/null @@ -1 +0,0 @@ -073f5da3d2dbf24104a0dbd3c9699bb2 diff --git a/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 new file mode 100644 index 00000000000..3cb5c81a584 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 @@ -0,0 +1 @@ +7cefdfdfd161a469e021b86a109f5fe18c3a5d5ffbf554be8be8f22d24717821cf7d996bac4320f2ad931689fb93f87086ca52d0f64d75f1235d1a1b60ca9322 diff --git a/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 deleted file mode 100644 index aad5e9b5a00..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.md5 +++ /dev/null @@ -1 +0,0 @@ -512b41f6690b535b9b27de9832c1529b diff --git a/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 new file mode 100644 index 00000000000..a6fe73535d9 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 @@ -0,0 +1 @@ +ae40c8904a248d25b26dfd3c65db3a51de0c06c65f4a618e86b7e2e8c3f6c8cdd1eac1ca7c238e619def2ec6819ab16ddcaac7be4e15866a9992a7cde6a9d07d diff --git a/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 deleted file mode 100644 index 341bb86c6fa..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -566aff5e7f160fbf730d8e64bfbdd379 diff --git a/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 new file mode 100644 index 00000000000..f12d0a311c9 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 @@ -0,0 +1 @@ +a6cdab87ada9ad338cb309ee28abae8c7598a44d28796285b85f1af6b0e5bc82c116499eeedb8d88ad638dcce19024958e3a657f17bc63f052b09c27c401be55 diff --git a/Modules/Filtering/RLEImage/test/Input/2D.png.md5 b/Modules/Filtering/RLEImage/test/Input/2D.png.md5 deleted file mode 100644 index 66c3fddbad2..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/2D.png.md5 +++ /dev/null @@ -1 +0,0 @@ -e2bb9d7b5efaf7c04b4d8e005f5985f9 diff --git a/Modules/Filtering/RLEImage/test/Input/2D.png.sha512 b/Modules/Filtering/RLEImage/test/Input/2D.png.sha512 new file mode 100644 index 00000000000..7b1b1989fcd --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/2D.png.sha512 @@ -0,0 +1 @@ +9ce98c80c2be824d3a9f221c45f6a887184abdc048f2f342a83f49f71c1350d31e9e63e08d60d97fe96ec65e1449811537f16fbb26605e8aaf9dcb02a8f8d482 diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 deleted file mode 100644 index d79cfcf7e99..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.md5 +++ /dev/null @@ -1 +0,0 @@ -2ff042b68ae1f44127776e8e546223b7 diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 new file mode 100644 index 00000000000..712a57e3f0d --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 @@ -0,0 +1 @@ +71d58e5c95d483f6d0007aa34625f0101f0750dcbc0f806b8d83b731913eafb67c842796ab1d09fcaf935df463f0a8c5f81764175c52b4a9fc51aec803d8388e diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 deleted file mode 100644 index 563c4d416b2..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.md5 +++ /dev/null @@ -1 +0,0 @@ -863f38492ccfd2fdec93508f0e454e63 diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 new file mode 100644 index 00000000000..0a3e7e57c21 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 @@ -0,0 +1 @@ +8268d5ebf4dbba9b52fa6a375a70194cf323b122f230606707f7f5122b32cd088d9657266da2124233eb9703ffcc535f7c2d97ceb767f56105b0cb0801c4c83f diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 deleted file mode 100644 index 052244d0860..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.md5 +++ /dev/null @@ -1 +0,0 @@ -cdacd7d72edfafe4b920228533549a30 diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 new file mode 100644 index 00000000000..18fbf5c2c7a --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 @@ -0,0 +1 @@ +dba160f3cabdc646e7c144a5a65803774ca55394ddeb549c0fc02f2e211b04ef88ab27bd7bcf8ad1aff792bb58f6b6515edd90b3fa1e3a6630975a885afe322a diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 deleted file mode 100644 index 61bea75264e..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.md5 +++ /dev/null @@ -1 +0,0 @@ -e7931fc584d6277a8bc80f50b302338a diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 new file mode 100644 index 00000000000..8055e226d07 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 @@ -0,0 +1 @@ +c4806e3d999fd910de86e85624d1058894d89e770a589a876149da1c218f57703790105d98743ae8d7001f0f26ed635868e24ac25b902d234d160bc8fe4301f9 diff --git a/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 deleted file mode 100644 index 504084e627f..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -73e68c28d7777bccdd3eb0373c5c0ab1 diff --git a/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 new file mode 100644 index 00000000000..c8af2ca8a72 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 @@ -0,0 +1 @@ +fef524960f673e47b605985aa6af485b28f6baeb885ae8b3d23dfaff2f0f284b285f50bbdb59c657a6225dbaf5e98aad384de249e44fc25c167c6c69750914ac diff --git a/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 deleted file mode 100644 index 0dbfe86827a..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -bc5c266afb4048e06c742ab869cfe800 diff --git a/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 new file mode 100644 index 00000000000..241b1411f26 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 @@ -0,0 +1 @@ +01a84b44df11cc8271f3d5e4af12666c38fc3d5ed274faf06e081a5513b8d7282ec2398211a22fd87f192371d9b86bfc7602d17e11bfe2fa5b20b96acba47798 diff --git a/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 deleted file mode 100644 index 6b0412ff1ca..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -28e953e50f8fde195723a2872b223b3f diff --git a/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 new file mode 100644 index 00000000000..d5c665f9280 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 @@ -0,0 +1 @@ +ed20871dbab0a1fc903209af89b49a5809ccd88fe2db52ac71bf1f57cf4f72a73988a392d554c8b073f053e14b6c2d700acf1193658df601e23634cdc0f99f30 diff --git a/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 deleted file mode 100644 index 5a012f49c11..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -58e993ac9915bb149cb73e553a895036 diff --git a/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 new file mode 100644 index 00000000000..985a0f0d871 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 @@ -0,0 +1 @@ +f2d1e3df34b57c456a67a347d2a53d5cf096a0bcb2c8a20092cc3f3e86643d23836b0052b59bf64bac95f93bdba6adb380adec91166bd9ad9ead0435df9544d7 diff --git a/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 deleted file mode 100644 index a20ef2267b6..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -196177de83960d892f79b6c4cbb1dd84 diff --git a/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 new file mode 100644 index 00000000000..2ccc4445dd3 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 @@ -0,0 +1 @@ +263cb6d853d551700abe53dfc73e451cb50f9095ad20ecdbb8565fc2b0f2fd4863f97669f4f6bdb802b99001ee82d46a441363cb49ac9171d62552001f3a8567 diff --git a/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 deleted file mode 100644 index 735046e484b..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -4d599d3dd9071bd7609ad725e7b53a4b diff --git a/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 new file mode 100644 index 00000000000..d39b18da1b1 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 @@ -0,0 +1 @@ +d01b9b1430eb30f1cf0f82e331687f396193e0ae1d7ab3cb63e27a456a7152503d45e3eca39e9ede949977e03dde732cd330d0a5fd8768f362255a79e642ca60 diff --git a/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 deleted file mode 100644 index 1e3f2152d5d..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -3ca36e1bdd48bb2d33a13b21b4b8716a diff --git a/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 new file mode 100644 index 00000000000..2523d199536 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 @@ -0,0 +1 @@ +5e81a4959b9150d8ddbcb7d1f097a14fb00ac614c633a8617356607bc5c25a2aad48ab8001773db5b7a4f75a62b0df501a9af3848d1128fdf50150db595aef2c diff --git a/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 deleted file mode 100644 index c2bc0ee6d79..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -c7018805c6dad7dcb76f51897ded3486 diff --git a/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 new file mode 100644 index 00000000000..f575e60c2d0 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 @@ -0,0 +1 @@ +b3fadf72aa928b0e9acd55d910d4bcf60d031b2e84dabace9069c6891670f6db61dabad43bd2da6efa57af49bfe13288c300ab2c9cdd11b516c80f82bce08d23 diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 deleted file mode 100644 index 96ddaea9ed5..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -f24e655673e0a28406a2e7e03984900a diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 new file mode 100644 index 00000000000..acead814258 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 @@ -0,0 +1 @@ +edfd6a4aaf43eb940e998bbcd73aadb6b1a7ce1d4f27e069f82da36601d94970173112d72e4f02ae935f80857619020d600b5bed2576f479fc9255082fafb107 diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 deleted file mode 100644 index 74e5d869159..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -1a63151e851eb79de8718b6b8ffa03cc diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 new file mode 100644 index 00000000000..5d33e0136ae --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 @@ -0,0 +1 @@ +b32b370cced6144a9c892ffca54a94bf4dd64404ce700416d09067bef52779501a7b772aedc9d2f585721272e53c79871184d78b971e819758afc6c0da967d6e diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 deleted file mode 100644 index 12728cb1474..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -0f73a7f34b25e607c638cfde9c29cbe2 diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 new file mode 100644 index 00000000000..efa17bd0bd5 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 @@ -0,0 +1 @@ +00f367a8488c9456e78f04063062f4556a641e15f4366eb325c2cbaa19dce12ea43306238648ce1b2c0aedd7acf8e0d1484cbcf80e7bca36e9a425d8209202ca diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 deleted file mode 100644 index d43992fcd20..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -d9c0e6d796a439794019f78b6ae23c3e diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 new file mode 100644 index 00000000000..039ce9c236f --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 @@ -0,0 +1 @@ +2fc1b61001121bbb61b3ffe34e1cb8b1c38e109e4869f5aca0a505f47a8f5120cc8a595454f350f69d783b4e53563c1a59b16c9d1565781ab7dfaf11fcda78e0 diff --git a/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 deleted file mode 100644 index 695e97a3b4c..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -efdefd9a493158532651fd4e84728ad4 diff --git a/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 new file mode 100644 index 00000000000..0fac2d55fe4 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 @@ -0,0 +1 @@ +938cff2303a30070fea1356ea9c3a28d01c712285054c385823f9efc8aa8b01b01cd59371b292fe66e208933cfcaea8248290b0d90ea3ffbb1bca0a7d54b4522 diff --git a/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 deleted file mode 100644 index 057a80daaf7..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -e3fd590af475e356fb45bdb647141335 diff --git a/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 new file mode 100644 index 00000000000..54608d1343c --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 @@ -0,0 +1 @@ +d44bfe1f7246ea43a3769bafd98151ade7797de64002ee8f0ce783064ab3580301d8126d1b14f39ab8da04e12627d836fe5bb623e82363d76fb3ba757ccc2294 diff --git a/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 deleted file mode 100644 index 7a857e4268c..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -df56e390fb449ed184d949946f496f73 diff --git a/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 new file mode 100644 index 00000000000..39461ebfd97 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 @@ -0,0 +1 @@ +7eaef1ea728368426f38b7bd567bc5f64a923ed56e8f4c30d06e81ebca16029bd35d801363cb20ead0e5cadaae866dee2c1209c768737e8ca00acf341f4349cc diff --git a/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 deleted file mode 100644 index 9417fbcbed0..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -5f0a2ce8efe94f27c1cb79d74320b3b2 diff --git a/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 new file mode 100644 index 00000000000..7d35cc982d0 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 @@ -0,0 +1 @@ +456ffae61e9e051cff87835221e334ddb54c42a52143ed6813cf710355d5678ee15c3100ec5547adacf772bd7600d177f14f45e4d94e7a0bb4b0438c46dda588 diff --git a/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 deleted file mode 100644 index eddc86babe5..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -7bdb6e5a06f302035e20d57c9c44755f diff --git a/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 new file mode 100644 index 00000000000..3ad61f7f32c --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 @@ -0,0 +1 @@ +14e1dd4f285e1ac76a4c17e8e1b39dfff73b55f05093d1040895e6903728341c2e49e92d1f99d0865ac7e746c23aa6caab14a279a6c1aba5f04aece703f695af diff --git a/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 deleted file mode 100644 index a9f35a70d4f..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -74db7779b7c24ac84bc7cc5d6bdadf36 diff --git a/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 new file mode 100644 index 00000000000..83a6b5d8046 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 @@ -0,0 +1 @@ +b2b45f85ea93b5a529dd77477fb27431e67623d14d4cadf04e59961df7e9ef60643fab53245a102ebd9e8c1df831dd7e95b74cecf84ad11fad57ac50c1ec89f0 diff --git a/Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 b/Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 deleted file mode 100644 index f68234ba3cc..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/Small2D.png.md5 +++ /dev/null @@ -1 +0,0 @@ -7dced0d036fb021f5c061ade92cc100a diff --git a/Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 b/Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 new file mode 100644 index 00000000000..52e376a0097 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 @@ -0,0 +1 @@ +81e4b54baeaf99e5c13d25397851d06b6e091cd21e15a211825e3909ef937aae2ba827bfe3c5edc3629af1fa5db6a9f59b6725f5646a50e8404e287eccb3a954 diff --git a/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 deleted file mode 100644 index 6556e621abd..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -76726944bf4261b5098ce6d47c695353 diff --git a/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 new file mode 100644 index 00000000000..2331f997c70 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 @@ -0,0 +1 @@ +d271897514ea2129ca0d12b48f7037f0fe223b2e354f812998bf0df549b3c0c820b6b941ceb78ebb13de658bf6c8b6a96f2bc9503274c7e6d006c11bf71eba84 diff --git a/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 deleted file mode 100644 index 4a34b999e98..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -c7fc0c04bf25a032adf3a626d7e11da5 diff --git a/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 new file mode 100644 index 00000000000..d55cce878d0 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 @@ -0,0 +1 @@ +1310fc4e2cdca6bbba95a4ce10bfe3a7219e1d795d5e5ecd757a2d9e68911a13426053a6915309ddc6527b45199809bcb0098114a7ed4c677b448d75b4fd1b44 diff --git a/Modules/Filtering/RLEImage/test/Input/brainParc.mha.md5 b/Modules/Filtering/RLEImage/test/Input/brainParc.mha.md5 deleted file mode 100644 index be61e4db0f4..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/brainParc.mha.md5 +++ /dev/null @@ -1 +0,0 @@ -00b63181ddcf7a188b8d56317778ca8e diff --git a/Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 b/Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 new file mode 100644 index 00000000000..9b7128cfcf8 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 @@ -0,0 +1 @@ +f6a4fa4eef68fa83a012afa0a947573a45249cf8b13428dc1b5472fb256b1053aa9d9e091510737eb37c38b3b85e1442834c3b88ba02365244652628f88fcb2d diff --git a/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 b/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 deleted file mode 100644 index c6bbae2bb8d..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.md5 +++ /dev/null @@ -1 +0,0 @@ -2b7dc9466c4b72915eddbe1623958b28 diff --git a/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 b/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 new file mode 100644 index 00000000000..cc973f75cf7 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 @@ -0,0 +1 @@ +e3f372362fb6fa1ef18cfb09f852e3463febff6ed86a6061e065e2b67a98116d40502e806d971ac53b8bd7d56713bda002245cd78f9338c2e86e150036fa2f24 diff --git a/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 deleted file mode 100644 index f792bfb9242..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -76d18476a7d4b202c4fa06cd7d23cca3 diff --git a/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 new file mode 100644 index 00000000000..5bf91604f80 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 @@ -0,0 +1 @@ +0b6dad04a7d2d54c56899a4c620a89f7c83d1713ac55cb4f8327f8a81c93e506b2cf2761c60e54b10c0221b620cc458b6901c158c9070480cfe5dc7d601ee6cb diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 deleted file mode 100644 index 2931c4383e6..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -0a7a975f6f0506d639e69df057cf8aef diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 new file mode 100644 index 00000000000..2cf0b38edd6 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 @@ -0,0 +1 @@ +8b358858e5a31c39ce77ddc387398ae0fbd73669cb5450dbd144bf646b1bf11157d7533d63bfd8d7f5aa6dea32928ab661b51873c208e4ac109a344eb24034f7 diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 deleted file mode 100644 index 965bed64a39..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -e0cc36e9f1db3f7b23207914b10e112d diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 new file mode 100644 index 00000000000..c5ba205c43e --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 @@ -0,0 +1 @@ +b04d9e9caf63f26ecf3fa2187b70fec5057c74ffde01ef175ce0365dfd5121679926a9639d1495954d53ae30c4ce327595623ba39179f38e2017a5c43556a485 diff --git a/Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 b/Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 deleted file mode 100644 index 861be820b86..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ws.nrrd.md5 +++ /dev/null @@ -1 +0,0 @@ -17c66c3683cd20442f81ee2ea1a3aad9 diff --git a/Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 new file mode 100644 index 00000000000..8132505498d --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 @@ -0,0 +1 @@ +67e9f82b93799a2dc7c213a13f0e1653326d80beef4875f781a3d047ef81d712c8b7de70c3514ba8a11e378c12365c3e9faa0e0d8a09fe66c744c39aaacf0d58 From f4ef4d6450d25d33803e0e035fcbcbbd5f91edcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sun, 11 Nov 2018 12:31:12 -0500 Subject: [PATCH 53/95] DOC: Improve the `itk-module.cmake` documentation, Improve the `itk-module.cmake` file documentation: - Re-use the `README.rst` documentation to increase consistency. - Add comments. --- Modules/Filtering/RLEImage/itk-module.cmake | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Modules/Filtering/RLEImage/itk-module.cmake b/Modules/Filtering/RLEImage/itk-module.cmake index df13c98f547..c22a99ac186 100644 --- a/Modules/Filtering/RLEImage/itk-module.cmake +++ b/Modules/Filtering/RLEImage/itk-module.cmake @@ -1,11 +1,14 @@ -set( - DOCUMENTATION - "The module provides run-length encoded storage for -image content, iterators for efficient reading and writing, and a -specialization of region of interest filter which can also be used to -convert to and from regular itk::Image." -) +# the top-level README is used for describing this module, just +# re-used it for documentation here +get_filename_component(MY_CURENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(READ "${MY_CURENT_DIR}/README.md" DOCUMENTATION) + +# itk_module() defines the module dependencies in RLEImage +# The testing module in RLEImage depends on ITKTestKernel +# By convention those modules outside of ITK are not prefixed with +# ITK +# define the dependencies of the include module and the tests itk_module( RLEImage DEPENDS From adc83f4138fa0fb96d7c5bdd47c3317369743b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sat, 10 Nov 2018 14:54:53 -0500 Subject: [PATCH 54/95] ENH: Improve CI. Improve the module's CI: - Add Travis and AppVeyor CI configuration `*.yml` files. - Rename and move the Circle CI `*.yml` file to the `.circleci` folder to conform to the `ITKModuleTemplate` skeleton. - Add the Python setup `setup.py` file - Add the Python wrapping `*.wrap` files. - Add the CI badges to the `README.rst` file. - Take advantage of the commit to improve the `README.rst` file. --- Modules/Filtering/RLEImage/wrapping/CMakeLists.txt | 10 ++++++++++ Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap | 7 +++++++ .../wrapping/itkRLEImageConstIterator.notwrapped | 1 + .../RLEImage/wrapping/itkRLEImageIterator.notwrapped | 1 + .../wrapping/itkRLEImageRegionConstIterator.notwrapped | 1 + .../wrapping/itkRLEImageRegionIterator.notwrapped | 1 + .../itkRLEImageScanlineConstIterator.notwrapped | 1 + .../wrapping/itkRLEImageScanlineIterator.notwrapped | 1 + .../wrapping/itkRLERegionOfInterestImageFilter.wrap | 3 +++ 9 files changed, 26 insertions(+) create mode 100644 Modules/Filtering/RLEImage/wrapping/CMakeLists.txt create mode 100644 Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap create mode 100644 Modules/Filtering/RLEImage/wrapping/itkRLEImageConstIterator.notwrapped create mode 100644 Modules/Filtering/RLEImage/wrapping/itkRLEImageIterator.notwrapped create mode 100644 Modules/Filtering/RLEImage/wrapping/itkRLEImageRegionConstIterator.notwrapped create mode 100644 Modules/Filtering/RLEImage/wrapping/itkRLEImageRegionIterator.notwrapped create mode 100644 Modules/Filtering/RLEImage/wrapping/itkRLEImageScanlineConstIterator.notwrapped create mode 100644 Modules/Filtering/RLEImage/wrapping/itkRLEImageScanlineIterator.notwrapped create mode 100644 Modules/Filtering/RLEImage/wrapping/itkRLERegionOfInterestImageFilter.wrap diff --git a/Modules/Filtering/RLEImage/wrapping/CMakeLists.txt b/Modules/Filtering/RLEImage/wrapping/CMakeLists.txt new file mode 100644 index 00000000000..98d3bb8ebdc --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/CMakeLists.txt @@ -0,0 +1,10 @@ +itk_wrap_module(RLEImage) + +set( + WRAPPER_SUBMODULE_ORDER + itkRLEImage + itkRLERegionOfInterestImageFilter +) + +itk_auto_load_submodules() +itk_end_wrap_module() diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap b/Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap new file mode 100644 index 00000000000..57c33fa72a6 --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap @@ -0,0 +1,7 @@ +itk_wrap_class("itk::RLEImage" POINTER) +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${WRAP_ITK_REAL}) + itk_wrap_template("${ITKM_${t}}${d}${ITKM_PD${d}}" "${ITKT_${t}},${d},${ITKT_PD${d}}") + endforeach() +endforeach() +itk_end_wrap_class() diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLEImageConstIterator.notwrapped b/Modules/Filtering/RLEImage/wrapping/itkRLEImageConstIterator.notwrapped new file mode 100644 index 00000000000..9951d9cd29a --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/itkRLEImageConstIterator.notwrapped @@ -0,0 +1 @@ +message(FATAL_ERROR "Iterators are not efficient when wrapped.") diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLEImageIterator.notwrapped b/Modules/Filtering/RLEImage/wrapping/itkRLEImageIterator.notwrapped new file mode 100644 index 00000000000..9951d9cd29a --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/itkRLEImageIterator.notwrapped @@ -0,0 +1 @@ +message(FATAL_ERROR "Iterators are not efficient when wrapped.") diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLEImageRegionConstIterator.notwrapped b/Modules/Filtering/RLEImage/wrapping/itkRLEImageRegionConstIterator.notwrapped new file mode 100644 index 00000000000..9951d9cd29a --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/itkRLEImageRegionConstIterator.notwrapped @@ -0,0 +1 @@ +message(FATAL_ERROR "Iterators are not efficient when wrapped.") diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLEImageRegionIterator.notwrapped b/Modules/Filtering/RLEImage/wrapping/itkRLEImageRegionIterator.notwrapped new file mode 100644 index 00000000000..9951d9cd29a --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/itkRLEImageRegionIterator.notwrapped @@ -0,0 +1 @@ +message(FATAL_ERROR "Iterators are not efficient when wrapped.") diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLEImageScanlineConstIterator.notwrapped b/Modules/Filtering/RLEImage/wrapping/itkRLEImageScanlineConstIterator.notwrapped new file mode 100644 index 00000000000..9951d9cd29a --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/itkRLEImageScanlineConstIterator.notwrapped @@ -0,0 +1 @@ +message(FATAL_ERROR "Iterators are not efficient when wrapped.") diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLEImageScanlineIterator.notwrapped b/Modules/Filtering/RLEImage/wrapping/itkRLEImageScanlineIterator.notwrapped new file mode 100644 index 00000000000..9951d9cd29a --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/itkRLEImageScanlineIterator.notwrapped @@ -0,0 +1 @@ +message(FATAL_ERROR "Iterators are not efficient when wrapped.") diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLERegionOfInterestImageFilter.wrap b/Modules/Filtering/RLEImage/wrapping/itkRLERegionOfInterestImageFilter.wrap new file mode 100644 index 00000000000..4dc53cfe042 --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/itkRLERegionOfInterestImageFilter.wrap @@ -0,0 +1,3 @@ +itk_wrap_class("itk::RegionOfInterestImageFilter" POINTER) +itk_wrap_image_filter_combinations("${WRAP_ITK_COV_VECTOR_REAL}" "${WRAP_ITK_SCALAR}") +itk_end_wrap_class() From 5ac25ab5c325c00b739d5e0f6dd9b94532d5fe21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 12 Apr 2019 15:30:37 -0400 Subject: [PATCH 55/95] ENH: run memory-intensive tests serially --- .../Filtering/RLEImage/test/CMakeLists.txt | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index 3bf1b1169dd..302129830a7 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -29,7 +29,7 @@ add_executable( target_link_libraries(iteratorTests "${RLEImage-Test_LIBRARIES}") itk_add_test(NAME RLEImageiteratorTests COMMAND iteratorTests) -function(ReadWriteTest ImageName Ext) +function(ReadWriteTest ImageName Ext) # optional: big set(outImage "${ITK_TEST_OUTPUT_DIR}/${ImageName}.${Ext}") itk_add_test( NAME RLEImage${ImageName} @@ -42,6 +42,24 @@ function(ReadWriteTest ImageName Ext) DATA{Input/${ImageName}.${Ext}} ${outImage} ) + if("${ARGN}" STREQUAL "big") + set_property( + TEST + RLEImage${ImageName} + APPEND + PROPERTY + LABELS + RUNS_LONG + ) + set_property( + TEST + RLEImage${ImageName} + APPEND + PROPERTY + RUN_SERIAL + True + ) + endif() endfunction() # RLEImage specific tests - quick @@ -84,5 +102,5 @@ readwritetest(65239R_amygdala_fin nii.gz) readwritetest(65239R_amygdala_int nii.gz) # RLEImage specific tests - long -readwritetest(wb-seg nrrd) -readwritetest(wb-seg32 nrrd) +readwritetest(wb-seg nrrd big) +readwritetest(wb-seg32 nrrd big) From e21ba8bebccbf411018a6e6d943f2ca9043597ea Mon Sep 17 00:00:00 2001 From: "Mathew J. Seng" Date: Tue, 20 Aug 2019 11:45:54 -0500 Subject: [PATCH 56/95] ENH: Change to enum to new enum class definitions Changed to reference enum class: FileModeType Located in namespace ITK --- Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index afe8fd3412a..c92ce3f8816 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -199,7 +199,7 @@ itkRLEImageTest(int argc, char * argv[]) using ScalarPixelType = itk::ImageIOBase::IOComponentType; itk::ImageIOBase::Pointer imageIO = - itk::ImageIOFactory::CreateImageIO(inputImageFileName, itk::ImageIOFactory::ReadMode); + itk::ImageIOFactory::CreateImageIO(inputImageFileName, itk::ImageIOFactory::FileModeType::ReadMode); if (!imageIO) { std::cerr << "Could not CreateImageIO for: " << inputImageFileName << std::endl; From 95e0a9174e60e6471c5d9fb0853293dd436d3078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Fri, 14 Jun 2019 20:29:01 -0400 Subject: [PATCH 57/95] STYLE: Add ITK prefix to testing macros --- Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index c92ce3f8816..556b1e79bf6 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -146,11 +146,11 @@ doTest(std::string inFilename, std::string outFilename) if (xSize > 127) { std::cout << "\n xSize>127 (CHAR_MAX)" << std::endl; - TRY_EXPECT_EXCEPTION(roiTest(test)); + ITK_TRY_EXPECT_EXCEPTION(roiTest(test)); } else { - TRY_EXPECT_NO_EXCEPTION(roiTest(test)); + ITK_TRY_EXPECT_NO_EXCEPTION(roiTest(test)); } using outConverterType = itk::RegionOfInterestImageFilter; From cde619f3c93f1e494e6e582d01e22fdb7b36902d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 11 Dec 2019 15:07:23 -0500 Subject: [PATCH 58/95] STYLE: remove void keyword used instead of formal parameters --- .../Filtering/RLEImage/include/itkRLEImageConstIterator.h | 8 ++++---- Modules/Filtering/RLEImage/include/itkRLEImageIterator.h | 2 +- .../RLEImage/include/itkRLEImageScanlineConstIterator.h | 8 ++++---- .../RLEImage/include/itkRLEImageScanlineIterator.h | 2 +- .../RLEImage/test/itkRegionOfInterestImageFilterTest.cxx | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 5623536019e..77c5a2e810e 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -313,7 +313,7 @@ class ImageConstIterator> /** Get the pixel value */ PixelType - Get(void) const + Get() const { return Value(); } @@ -322,7 +322,7 @@ class ImageConstIterator> * This method will provide the fastest access to pixel * data, but it will NOT support ImageAdaptors. */ const PixelType & - Value(void) const + Value() const { RLLine & line = const_cast(this)->m_BI.Value(); @@ -350,7 +350,7 @@ class ImageConstIterator> /** Is the iterator at the beginning of the region? "Begin" is defined * as the first pixel in the region. */ bool - IsAtBegin(void) const + IsAtBegin() const { return m_Index0 == m_BeginIndex0 && m_BI.IsAtBegin(); } @@ -358,7 +358,7 @@ class ImageConstIterator> /** Is the iterator at the end of the region? "End" is defined as one * pixel past the last pixel of the region. */ bool - IsAtEnd(void) const + IsAtEnd() const { return m_Index0 == m_BeginIndex0 && m_BI.IsAtEnd(); } diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 5746fa37596..16d5a60dc35 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -100,7 +100,7 @@ class ImageIterator> // * Setting this value would change value of the whole run-length segment. // * If we wanted to safely enable it, // * we would isolate this pixel into its own segment. */ - // PixelType & Value(void) + // PixelType & Value() // { // return m_Buffer[m_Index[2]][m_Index[1]][m_RealIndex].second; // } diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index dd1a9a94a51..915b49252c5 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -95,7 +95,7 @@ class ImageScanlineConstIterator> /** Go to the beginning pixel of the current line. */ void - GoToBeginOfLine(void) + GoToBeginOfLine() { this->m_Index0 = this->m_BeginIndex0; this->m_RealIndex = 0; @@ -104,7 +104,7 @@ class ImageScanlineConstIterator> /** Go to the past end pixel of the current line. */ void - GoToEndOfLine(void) + GoToEndOfLine() { this->m_Index0 = this->m_EndIndex0; this->m_RealIndex = this->m_RunLengthLine->size() - 1; @@ -113,14 +113,14 @@ class ImageScanlineConstIterator> /** Test if the index is at the end of line. */ inline bool - IsAtEndOfLine(void) + IsAtEndOfLine() { return this->m_Index0 == this->m_EndIndex0; } /** Go to the next line. */ inline void - NextLine(void) + NextLine() { ++(this->m_BI); if (!this->m_BI.IsAtEnd()) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index 650e0f917d7..77a4158fa10 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -84,7 +84,7 @@ class ImageScanlineIterator> ///** Return a reference to the pixel // * This method will provide the fastest access to pixel // * data, but it will NOT support ImageAdaptors. */ - // PixelType & Value(void) + // PixelType & Value() // { // return m_Buffer[m_Index[2]][m_Index[1]][m_RealIndex].second; // } diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx index 6e7a2c637e1..f677de369cf 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx @@ -98,7 +98,7 @@ itkRegionOfInterestImageFilterTest(int, char *[]) // itk::SimpleFilterWatcher watcher(filter); filter->SetRegionOfInterest(regionOfInterest); - // filter->SetNumberOfThreads(1); + // filter->SetNumberOfWorkUnits(1); filter->Update(); filter->GetOutput()->Print(std::cout); From cc3aff78331d4a793f7d5aeb8a8e32e6c384e204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Sat, 14 Dec 2019 14:30:40 -0500 Subject: [PATCH 59/95] COMP: follow rename of ImageIOFactory FileModeType into FileModeEnum --- Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 556b1e79bf6..8d2d80de12a 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -199,7 +199,7 @@ itkRLEImageTest(int argc, char * argv[]) using ScalarPixelType = itk::ImageIOBase::IOComponentType; itk::ImageIOBase::Pointer imageIO = - itk::ImageIOFactory::CreateImageIO(inputImageFileName, itk::ImageIOFactory::FileModeType::ReadMode); + itk::ImageIOFactory::CreateImageIO(inputImageFileName, itk::ImageIOFactory::FileModeEnum::ReadMode); if (!imageIO) { std::cerr << "Could not CreateImageIO for: " << inputImageFileName << std::endl; From aeb7cdd80e3dcd76944c2058254fec81c4c51a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 16 Dec 2019 10:53:05 -0500 Subject: [PATCH 60/95] ENH: run the big tests only if the test machine has 16GB or more --- .../Filtering/RLEImage/test/CMakeLists.txt | 68 ++++++++++++------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index 302129830a7..a7e6af2daf0 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -31,33 +31,49 @@ itk_add_test(NAME RLEImageiteratorTests COMMAND iteratorTests) function(ReadWriteTest ImageName Ext) # optional: big set(outImage "${ITK_TEST_OUTPUT_DIR}/${ImageName}.${Ext}") - itk_add_test( - NAME RLEImage${ImageName} - COMMAND - RLEImageTestDriver - --compare - DATA{Input/${ImageName}.${Ext}} - ${outImage} - itkRLEImageTest - DATA{Input/${ImageName}.${Ext}} - ${outImage} - ) if("${ARGN}" STREQUAL "big") - set_property( - TEST - RLEImage${ImageName} - APPEND - PROPERTY - LABELS - RUNS_LONG - ) - set_property( - TEST - RLEImage${ImageName} - APPEND - PROPERTY - RUN_SERIAL - True + if(DEFINED ITK_COMPUTER_MEMORY_SIZE) + if(${ITK_COMPUTER_MEMORY_SIZE} GREATER_EQUAL 16) + itk_add_test( + NAME RLEImage${ImageName} + COMMAND + RLEImageTestDriver + --compare + DATA{Input/${ImageName}.${Ext}} + ${outImage} + itkRLEImageTest + DATA{Input/${ImageName}.${Ext}} + ${outImage} + ) + set_property( + TEST + RLEImage${ImageName} + APPEND + PROPERTY + LABELS + RUNS_LONG + ) + set_property( + TEST + RLEImage${ImageName} + APPEND + PROPERTY + RUN_SERIAL + True + ) + endif() + endif() + else() + itk_add_test( + NAME RLEImage${ImageName} + COMMAND + RLEImageTestDriver + --compare + DATA{Input/${ImageName}.${Ext}} + ${outImage} + itkRLEImageTest + DATA{Input/${ImageName}.${Ext}} + ${outImage} ) endif() endfunction() From f69811df1b684c8f4f041e10024e6cdef337ecf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 17 Feb 2020 18:07:03 -0500 Subject: [PATCH 61/95] ENH: update enums to match recent changes in ITK --- Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 8d2d80de12a..86f393a1175 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -197,9 +197,9 @@ itkRLEImageTest(int argc, char * argv[]) const char * inputImageFileName = argv[1]; const char * outputImageFileName = argv[2]; - using ScalarPixelType = itk::ImageIOBase::IOComponentType; + using ScalarPixelType = itk::CommonEnums::IOComponent; itk::ImageIOBase::Pointer imageIO = - itk::ImageIOFactory::CreateImageIO(inputImageFileName, itk::ImageIOFactory::FileModeEnum::ReadMode); + itk::ImageIOFactory::CreateImageIO(inputImageFileName, itk::CommonEnums::IOFileMode::ReadMode); if (!imageIO) { std::cerr << "Could not CreateImageIO for: " << inputImageFileName << std::endl; @@ -213,11 +213,12 @@ itkRLEImageTest(int argc, char * argv[]) try { // unused cases are not instantiated because they greatly increase compile time - if (numDimensions == 2 && pixelType == itk::ImageIOBase::UCHAR) + if (numDimensions == 2 && pixelType == itk::CommonEnums::IOComponent::UCHAR) { return doTest>(inputImageFileName, outputImageFileName); } - if (numDimensions == 3 && (pixelType == itk::ImageIOBase::SHORT || pixelType == itk::ImageIOBase::USHORT)) + if (numDimensions == 3 && + (pixelType == itk::CommonEnums::IOComponent::SHORT || pixelType == itk::CommonEnums::IOComponent::USHORT)) { return doTest>(inputImageFileName, outputImageFileName); } @@ -225,7 +226,7 @@ itkRLEImageTest(int argc, char * argv[]) { return doTest>(inputImageFileName, outputImageFileName); } - if (numDimensions == 4 && pixelType == itk::ImageIOBase::UCHAR) + if (numDimensions == 4 && pixelType == itk::CommonEnums::IOComponent::UCHAR) { return doTest>(inputImageFileName, outputImageFileName); } From 2ee4419f9548e2a68e01cac6ef9a0ee898bda58d Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Wed, 19 Feb 2020 14:37:55 -0600 Subject: [PATCH 62/95] ENH: Add .gitattributes to allow running ITK clang-formatting scripts ``` git filter-branch -f \ --tree-filter "~/ITK/Utilities/Maintenance/clang-format.bash --clang-format ~/Dashboard/src/ITK-clang11/clang-format-Linux --tracked" \ master.. ``` --- Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx | 2 +- .../RLEImage/test/itkImageIteratorWithIndexTest.cxx | 4 +--- .../RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx | 1 - .../test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx | 1 - Modules/Filtering/RLEImage/test/itkIteratorTests.cxx | 2 +- .../RLEImage/test/itkRegionOfInterestImageFilterTest.cxx | 3 +-- Modules/Filtering/RLEImage/test/rleStats.cxx | 6 +++--- 7 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx index fce5e1fe119..6a4fd9f9051 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx @@ -16,8 +16,8 @@ * *=========================================================================*/ -#include #include "itkRLEImage.h" +#include // This routine is used to make sure that we call the "const" version diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx index 6e1d4f226ed..0e72956d0f9 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx @@ -18,14 +18,13 @@ #include -#include "itkRLEImage.h" #include "itkNumericTraits.h" +#include "itkRLEImage.h" template class itkImageIteratorWithIndexTestIteratorTester { - public: using PixelType = TPixelType; @@ -118,7 +117,6 @@ class itkImageIteratorWithIndexTestIteratorTester int itkImageIteratorWithIndexTest(int, char *[]) { - bool testPassed = true; // let's be optimistic // Instantiate image of various types and diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx index ef623d61ea4..10e080609d6 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx @@ -23,7 +23,6 @@ int itkImageIteratorsForwardBackwardTest(int, char *[]) { - std::cout << "Creating an image" << std::endl; using ImageType = itk::RLEImage; diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx index c995c0ced86..0e50c102408 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx @@ -23,7 +23,6 @@ template class itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester { - public: using ImageType = TImage; using IndexType = typename ImageType::IndexType; diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx index 4289ab97138..fdd016bead4 100644 --- a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx @@ -19,8 +19,8 @@ #include #include "itkImage.h" -#include "itkVector.h" #include "itkRLEImage.h" +#include "itkVector.h" #include int diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx index f677de369cf..15a68142e7f 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx @@ -16,14 +16,13 @@ * *=========================================================================*/ -#include #include "itkRLEImage.h" #include "itkSimpleFilterWatcher.h" +#include int itkRegionOfInterestImageFilterTest(int, char *[]) { - constexpr unsigned int Dimension = 3; using PixelType = itk::Index; diff --git a/Modules/Filtering/RLEImage/test/rleStats.cxx b/Modules/Filtering/RLEImage/test/rleStats.cxx index d9fea33ec5d..c55c652c04a 100644 --- a/Modules/Filtering/RLEImage/test/rleStats.cxx +++ b/Modules/Filtering/RLEImage/test/rleStats.cxx @@ -16,11 +16,11 @@ * *=========================================================================*/ -#include "itkTestDriverIncludeRequiredIOFactories.h" -#include "itkRLEImage.h" #include "itkImageFileReader.h" -#include +#include "itkRLEImage.h" +#include "itkTestDriverIncludeRequiredIOFactories.h" #include +#include int main(int argc, char * argv[]) From 06a140b0f639cd4e70ab860736592674c26da9a9 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 17 Feb 2020 14:20:50 -0600 Subject: [PATCH 63/95] STYLE: Prefer = delete to explicitly trivial implementations This check replaces undefined special member functions with = delete;. The explicitly deleted function declarations enable more opportunities in optimization, because the compiler might treat explicitly delted functions as noops. Additionally, the C++11 use of = delete more clearly expreses the intent for the special member functions. --- .../RLEImage/include/itkRLERegionOfInterestImageFilter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 9d22c04ac11..7ab3b32ae9b 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -218,9 +218,9 @@ class RegionOfInterestImageFilter Date: Mon, 17 Feb 2020 14:30:05 -0600 Subject: [PATCH 64/95] STYLE: Prefer = default to explicitly trivial implementations This check replaces default bodies of special member functions with = default;. The explicitly defaulted function declarations enable more opportunities in optimization, because the compiler might treat explicitly defaulted functions as trivial. Additionally, the C++11 use of = default more clearly expreses the intent for the special member functions. --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 2 +- .../Filtering/RLEImage/include/itkRLEImageConstIterator.h | 2 +- Modules/Filtering/RLEImage/include/itkRLEImageIterator.h | 4 ++-- .../RLEImage/include/itkRLERegionOfInterestImageFilter.h | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 13d66d87a44..4f2c83ba543 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -279,7 +279,7 @@ class RLEImage : public itk::ImageBase void PrintSelf(std::ostream & os, itk::Indent indent) const override; - ~RLEImage() override {} + ~RLEImage() override = default; /** Compute helper matrices used to transform Index coordinates to * PhysicalPoint coordinates and back. This method is virtual and will be * overloaded in derived classes in order to provide backward compatibility diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 77c5a2e810e..2ae31c29a1d 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -104,7 +104,7 @@ class ImageConstIterator> } /** Default Destructor. */ - virtual ~ImageConstIterator() {} + virtual ~ImageConstIterator() = default; /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageConstIterator(const Self & it) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 16d5a60dc35..4d3b639640d 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -60,9 +60,9 @@ class ImageIterator> /** Default Constructor. Need to provide a default constructor since we * provide a copy constructor. */ - ImageIterator() {} + ImageIterator() = default; /** Default Destructor */ - ~ImageIterator() override {} + ~ImageIterator() override = default; /** Copy Constructor. The copy constructor is provided to make sure the * handle to the image is properly reference counted. */ ImageIterator(const Self & it) diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 7ab3b32ae9b..6abf3b780a7 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -94,7 +94,7 @@ class RegionOfInterestImageFilter protected: RegionOfInterestImageFilter() { this->DynamicMultiThreadingOn(); } - ~RegionOfInterestImageFilter() override {} + ~RegionOfInterestImageFilter() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; @@ -184,7 +184,7 @@ class RegionOfInterestImageFilterDynamicMultiThreadingOn(); } - ~RegionOfInterestImageFilter() override {} + ~RegionOfInterestImageFilter() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; @@ -291,7 +291,7 @@ class RegionOfInterestImageFilter, RLEImageDynamicMultiThreadingOn(); } - ~RegionOfInterestImageFilter() override {} + ~RegionOfInterestImageFilter() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; @@ -377,7 +377,7 @@ class RegionOfInterestImageFilter protected: RegionOfInterestImageFilter() { this->DynamicMultiThreadingOn(); } - ~RegionOfInterestImageFilter() override {} + ~RegionOfInterestImageFilter() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; From 21f4e9f02824a17f5640a32e05b518adeb098a03 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 17 Feb 2020 15:50:27 -0600 Subject: [PATCH 65/95] STYLE: Use default member initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Converts a default constructor’s member initializers into the new default member initializers in C++11. Other member initializers that match the default member initializer are removed. This can reduce repeated code or allow use of ‘= default’. --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 4f2c83ba543..5cb25148488 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -271,7 +271,7 @@ class RLEImage : public itk::ImageBase protected: RLEImage() : itk::ImageBase() - , m_OnTheFlyCleanup(true) + { m_Buffer = BufferType::New(); } @@ -296,7 +296,7 @@ class RLEImage : public itk::ImageBase CleanUpLine(RLLine & line) const; private: - bool m_OnTheFlyCleanup; // should same-valued segments be merged on the fly + bool m_OnTheFlyCleanup{ true }; // should same-valued segments be merged on the fly /** Memory for the current buffer. */ mutable typename BufferType::Pointer m_Buffer; From 7d147d4480401abe7ea73875293186a88e2d9691 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Wed, 19 Feb 2020 10:45:26 -0600 Subject: [PATCH 66/95] DOC: Update copyright assignment to NumFOCUS The mission of NumFOCUS is to promote open practices in research, data, and scientific computing. https://numfocus.org --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 2 +- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 2 +- Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h | 2 +- Modules/Filtering/RLEImage/include/itkRLEImageIterator.h | 2 +- .../Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h | 2 +- Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h | 2 +- .../RLEImage/include/itkRLEImageScanlineConstIterator.h | 2 +- .../Filtering/RLEImage/include/itkRLEImageScanlineIterator.h | 2 +- .../RLEImage/include/itkRLERegionOfInterestImageFilter.h | 2 +- .../RLEImage/include/itkRLERegionOfInterestImageFilter.hxx | 2 +- Modules/Filtering/RLEImage/test/iteratorTests.cxx | 2 +- Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx | 2 +- .../Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx | 2 +- .../RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx | 2 +- .../test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx | 2 +- Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx | 2 +- .../Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx | 2 +- Modules/Filtering/RLEImage/test/itkIteratorTests.cxx | 2 +- Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 2 +- .../RLEImage/test/itkRegionOfInterestImageFilterTest.cxx | 2 +- Modules/Filtering/RLEImage/test/manualTest.cxx | 2 +- Modules/Filtering/RLEImage/test/rleStats.cxx | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 5cb25148488..99fdfeb7d42 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index 51834b71e5c..7826a08a688 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index 2ae31c29a1d..df3880a8f2d 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 4d3b639640d..3e4abcf0dff 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index ad7524256d6..678b38e00dc 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index 4107aa1b654..27e5f5d21d3 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index 915b49252c5..aa5a450b3aa 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index 77a4158fa10..f5c7deb9874 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 6abf3b780a7..44bc3c8f2f8 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 0fc3dc4b0de..11cd3ed5015 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/iteratorTests.cxx b/Modules/Filtering/RLEImage/test/iteratorTests.cxx index a3d9b6b3b15..d0a88c70dbe 100644 --- a/Modules/Filtering/RLEImage/test/iteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/iteratorTests.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx index 6a4fd9f9051..074bd308cd4 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx index 0e72956d0f9..3fff05eb316 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx index 10e080609d6..9188eb6f3cd 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx index 0e50c102408..1ceb197b17e 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx index 99f49484522..f00881e216f 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx index acabe76b413..d6af76fb672 100644 --- a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx +++ b/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx index fdd016bead4..c8acd39b154 100644 --- a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 86f393a1175..2705e5eb37c 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx index 15a68142e7f..1cba36e627a 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/manualTest.cxx b/Modules/Filtering/RLEImage/test/manualTest.cxx index 79c2fffdfed..7c6586c77c3 100644 --- a/Modules/Filtering/RLEImage/test/manualTest.cxx +++ b/Modules/Filtering/RLEImage/test/manualTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Modules/Filtering/RLEImage/test/rleStats.cxx b/Modules/Filtering/RLEImage/test/rleStats.cxx index c55c652c04a..8a3f711653c 100644 --- a/Modules/Filtering/RLEImage/test/rleStats.cxx +++ b/Modules/Filtering/RLEImage/test/rleStats.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From fefb87aa96723ca640c06c78c034d5c367fe13d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Thu, 20 Feb 2020 22:49:15 +0100 Subject: [PATCH 67/95] COMP: Use and move ITK_DISALLOW_COPY_AND_ASSIGN call to public section Use the `ITK_DISALLOW_COPY_AND_ASSIGN` macro to enhance consistency across the the toolkit when disallowing the copy constructor and the assign operator. Move the `ITK_DISALLOW_COPY_AND_ASSIGN` calls to public section following the discussion in https://discourse.itk.org/t/itk-disallow-copy-and-assign/648 --- .../RLEImage/include/itkRLERegionOfInterestImageFilter.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index 44bc3c8f2f8..a3c276dbc5d 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -142,6 +142,8 @@ class RegionOfInterestImageFilter> { public: + ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter); + /** Standard class type alias. */ using Self = RegionOfInterestImageFilter; using RLEImageTypeIn = RLEImage; @@ -218,10 +220,6 @@ class RegionOfInterestImageFilter Date: Mon, 13 Apr 2020 22:33:49 -0500 Subject: [PATCH 68/95] BUG: Fix 'test not run' error thrown when built as ITK remote. When ITK builds ITKRLEImage as an interal remote module, and BUILD_SHARED_LIBS = OFF, a 'test not run' error is thrown. Changing the names of tests and adding them to the TestDriver allows them to run with BUILD_SHARED_LIB = OFF and not throw any sort of error. Changing the names of tests is required due to similar tests having the same definitions in source ITK. --- .../Filtering/RLEImage/test/CMakeLists.txt | 74 +++++++++++++++---- .../Filtering/RLEImage/test/iteratorTests.cxx | 53 ------------- ...ts.cxx => itkIteratorTestsForRLEImage.cxx} | 2 +- ...orTest.cxx => itkRLEImageIteratorTest.cxx} | 2 +- ...x => itkRLEImageIteratorWithIndexTest.cxx} | 42 +++++------ ...kRLEImageIteratorsForwardBackwardTest.cxx} | 2 +- ...eRegionConstIteratorWithOnlyIndexTest.cxx} | 12 +-- ....cxx => itkRLEImageRegionIteratorTest.cxx} | 2 +- ...x => itkRLEImageScanlineIteratorTest1.cxx} | 2 +- ...itkRegionOfInterestRLEImageFilterTest.cxx} | 2 +- 10 files changed, 93 insertions(+), 100 deletions(-) delete mode 100644 Modules/Filtering/RLEImage/test/iteratorTests.cxx rename Modules/Filtering/RLEImage/test/{itkIteratorTests.cxx => itkIteratorTestsForRLEImage.cxx} (98%) rename Modules/Filtering/RLEImage/test/{itkImageIteratorTest.cxx => itkRLEImageIteratorTest.cxx} (99%) rename Modules/Filtering/RLEImage/test/{itkImageIteratorWithIndexTest.cxx => itkRLEImageIteratorWithIndexTest.cxx} (86%) rename Modules/Filtering/RLEImage/test/{itkImageIteratorsForwardBackwardTest.cxx => itkRLEImageIteratorsForwardBackwardTest.cxx} (98%) rename Modules/Filtering/RLEImage/test/{itkImageRegionConstIteratorWithOnlyIndexTest.cxx => itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx} (92%) rename Modules/Filtering/RLEImage/test/{itkImageRegionIteratorTest.cxx => itkRLEImageRegionIteratorTest.cxx} (99%) rename Modules/Filtering/RLEImage/test/{itkImageScanlineIteratorTest1.cxx => itkRLEImageScanlineIteratorTest1.cxx} (99%) rename Modules/Filtering/RLEImage/test/{itkRegionOfInterestImageFilterTest.cxx => itkRegionOfInterestRLEImageFilterTest.cxx} (98%) diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index a7e6af2daf0..d7ff6cbfd64 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -1,6 +1,17 @@ itk_module_test() -set(RLEImageTests itkRLEImageTest.cxx) +set( + RLEImageTests + itkRLEImageTest.cxx + itkRegionOfInterestRLEImageFilterTest.cxx + itkIteratorTestsForRLEImage.cxx + itkRLEImageIteratorsForwardBackwardTest.cxx + itkRLEImageIteratorTest.cxx + itkRLEImageIteratorWithIndexTest.cxx + itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx + itkRLEImageRegionIteratorTest.cxx + itkRLEImageScanlineIteratorTest1.cxx +) createtestdriver( RLEImage "${RLEImage-Test_LIBRARIES}" "${RLEImageTests}" ) @@ -14,20 +25,55 @@ target_link_libraries(runFromIDE ${RLEImage-Test_LIBRARIES}) add_executable(rleStats rleStats.cxx) target_link_libraries(rleStats ${RLEImage-Test_LIBRARIES}) -add_executable( - iteratorTests - itkRegionOfInterestImageFilterTest.cxx - itkIteratorTests.cxx - itkImageIteratorsForwardBackwardTest.cxx - itkImageIteratorTest.cxx - itkImageIteratorWithIndexTest.cxx - itkImageRegionConstIteratorWithOnlyIndexTest.cxx - itkImageRegionIteratorTest.cxx - itkImageScanlineIteratorTest1.cxx - iteratorTests.cxx +itk_add_test( + NAME itkIteratorTestsForRLEImage + COMMAND + RLEImageTestDriver + itkIteratorTestsForRLEImage +) +itk_add_test( + NAME itkRegionOfInterestRLEImageFilterTest + COMMAND + RLEImageTestDriver + itkRegionOfInterestRLEImageFilterTest +) +itk_add_test( + NAME itkRLEImageIteratorsForwardBackwardTest + COMMAND + RLEImageTestDriver + itkRLEImageIteratorsForwardBackwardTest +) +itk_add_test( + NAME itkRLEImageIteratorTest + COMMAND + RLEImageTestDriver + itkRLEImageIteratorTest + itkRLEImageIteratorWithIndexTest +) +itk_add_test( + NAME itkRLEImageIteratorWithIndexTest + COMMAND + RLEImageTestDriver + itkRLEImageIteratorWithIndexTest +) +itk_add_test( + NAME itkRLEImageRegionConstIteratorWithOnlyIndexTest + COMMAND + RLEImageTestDriver + itkRLEImageRegionConstIteratorWithOnlyIndexTest +) +itk_add_test( + NAME itkRLEImageRegionIteratorTest + COMMAND + RLEImageTestDriver + itkRLEImageRegionIteratorTest +) +itk_add_test( + NAME itkRLEImageScanlineIteratorTest1 + COMMAND + RLEImageTestDriver + itkRLEImageScanlineIteratorTest1 ) -target_link_libraries(iteratorTests "${RLEImage-Test_LIBRARIES}") -itk_add_test(NAME RLEImageiteratorTests COMMAND iteratorTests) function(ReadWriteTest ImageName Ext) # optional: big set(outImage "${ITK_TEST_OUTPUT_DIR}/${ImageName}.${Ext}") diff --git a/Modules/Filtering/RLEImage/test/iteratorTests.cxx b/Modules/Filtering/RLEImage/test/iteratorTests.cxx deleted file mode 100644 index d0a88c70dbe..00000000000 --- a/Modules/Filtering/RLEImage/test/iteratorTests.cxx +++ /dev/null @@ -1,53 +0,0 @@ -/*========================================================================= - * - * Copyright NumFOCUS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#include "itkRLEImage.h" - -extern int -itkImageScanlineIteratorTest1(int argc, char * argv[]); -extern int -itkIteratorTests(int argc, char * argv[]); -extern int -itkImageIteratorTest(int argc, char * argv[]); -extern int -itkImageIteratorsForwardBackwardTest(int argc, char * argv[]); -extern int -itkImageIteratorWithIndexTest(int argc, char * argv[]); -extern int -itkImageRegionConstIteratorWithOnlyIndexTest(int argc, char * argv[]); -extern int -itkImageRegionIteratorTest(int argc, char * argv[]); -extern int -itkRegionOfInterestImageFilterTest(int argc, char * argv[]); - -int -main(int argc, char * argv[]) -{ - itkImageRegionIteratorTest(argc, argv); - itkImageScanlineIteratorTest1(argc, argv); - itkIteratorTests(argc, argv); - itkImageIteratorTest(argc, argv); - itkImageIteratorsForwardBackwardTest(argc, argv); - itkImageIteratorWithIndexTest(argc, argv); - itkImageRegionConstIteratorWithOnlyIndexTest(argc, argv); - itkRegionOfInterestImageFilterTest(argc, argv); - using charred2dType = itk::RLEImage; // test size 256 - charred2dType::Pointer t2 = charred2dType::New(); - using charred4dType = itk::RLEImage; // test size 65536 - charred4dType::Pointer t4 = charred4dType::New(); -} diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTestsForRLEImage.cxx similarity index 98% rename from Modules/Filtering/RLEImage/test/itkIteratorTests.cxx rename to Modules/Filtering/RLEImage/test/itkIteratorTestsForRLEImage.cxx index c8acd39b154..066d7666042 100644 --- a/Modules/Filtering/RLEImage/test/itkIteratorTests.cxx +++ b/Modules/Filtering/RLEImage/test/itkIteratorTestsForRLEImage.cxx @@ -24,7 +24,7 @@ #include int -itkIteratorTests(int, char *[]) +itkIteratorTestsForRLEImage(int, char *[]) { std::cout << "Creating an image" << std::endl; using ScalarImage = itk::RLEImage; diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorTest.cxx similarity index 99% rename from Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx rename to Modules/Filtering/RLEImage/test/itkRLEImageIteratorTest.cxx index 074bd308cd4..617ea0ab7f5 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorTest.cxx @@ -43,7 +43,7 @@ TestConstPixelAccess(const itk::RLEImage & in, itk::RLEImage & out) int -itkImageIteratorTest(int, char *[]) +itkRLEImageIteratorTest(int, char *[]) { constexpr unsigned int ImageDimension = 3; diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorWithIndexTest.cxx similarity index 86% rename from Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx rename to Modules/Filtering/RLEImage/test/itkRLEImageIteratorWithIndexTest.cxx index 3fff05eb316..117e74e60d6 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorWithIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorWithIndexTest.cxx @@ -23,7 +23,7 @@ template -class itkImageIteratorWithIndexTestIteratorTester +class itkRLEImageIteratorWithIndexTestIteratorTester { public: using PixelType = TPixelType; @@ -34,7 +34,7 @@ class itkImageIteratorWithIndexTestIteratorTester using ConstIteratorType = itk::ImageRegionConstIteratorWithIndex; - itkImageIteratorWithIndexTestIteratorTester(const PixelType & value) + itkRLEImageIteratorWithIndexTestIteratorTester(const PixelType & value) { m_Image = ImageType::New(); @@ -115,7 +115,7 @@ class itkImageIteratorWithIndexTestIteratorTester }; int -itkImageIteratorWithIndexTest(int, char *[]) +itkRLEImageIteratorWithIndexTest(int, char *[]) { bool testPassed = true; // let's be optimistic @@ -123,7 +123,7 @@ itkImageIteratorWithIndexTest(int, char *[]) // test the iterators on them std::cout << "Testing with Image< char, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterC(10); + itkRLEImageIteratorWithIndexTestIteratorTester TesterC(10); if (TesterC.TestIterator() == false) { testPassed = false; @@ -139,7 +139,7 @@ itkImageIteratorWithIndexTest(int, char *[]) std::cout << "Testing with Image< unsigned char, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterUC(10); + itkRLEImageIteratorWithIndexTestIteratorTester TesterUC(10); if (TesterUC.TestIterator() == false) { testPassed = false; @@ -154,7 +154,7 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< short, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterS(10); + itkRLEImageIteratorWithIndexTestIteratorTester TesterS(10); if (TesterS.TestIterator() == false) { testPassed = false; @@ -169,7 +169,7 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< unsigned short, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterUS(10); + itkRLEImageIteratorWithIndexTestIteratorTester TesterUS(10); if (TesterUS.TestIterator() == false) { testPassed = false; @@ -184,7 +184,7 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< int, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterI(10); + itkRLEImageIteratorWithIndexTestIteratorTester TesterI(10); if (TesterI.TestIterator() == false) { testPassed = false; @@ -199,7 +199,7 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< unsigned int, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterUI(10); + itkRLEImageIteratorWithIndexTestIteratorTester TesterUI(10); if (TesterUI.TestIterator() == false) { testPassed = false; @@ -214,7 +214,7 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< long long, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterLL(10); + itkRLEImageIteratorWithIndexTestIteratorTester TesterLL(10); if (TesterLL.TestIterator() == false) { testPassed = false; @@ -229,7 +229,7 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< unsigned long long, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterULL(10); + itkRLEImageIteratorWithIndexTestIteratorTester TesterULL(10); if (TesterULL.TestIterator() == false) { testPassed = false; @@ -244,7 +244,7 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< float, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterF(10.0); + itkRLEImageIteratorWithIndexTestIteratorTester TesterF(10.0); if (TesterF.TestIterator() == false) { testPassed = false; @@ -259,7 +259,7 @@ itkImageIteratorWithIndexTest(int, char *[]) } std::cout << "Testing with Image< double, 3 > " << std::endl; - itkImageIteratorWithIndexTestIteratorTester TesterD(10.0); + itkRLEImageIteratorWithIndexTestIteratorTester TesterD(10.0); if (TesterD.TestIterator() == false) { testPassed = false; @@ -277,7 +277,7 @@ itkImageIteratorWithIndexTest(int, char *[]) using VC = itk::Vector; VC vc; vc.Fill(127); - itkImageIteratorWithIndexTestIteratorTester TesterVC(vc); + itkRLEImageIteratorWithIndexTestIteratorTester TesterVC(vc); if (TesterVC.TestIterator() == false) { testPassed = false; @@ -295,7 +295,7 @@ itkImageIteratorWithIndexTest(int, char *[]) using VUC = itk::Vector; VUC vuc; vuc.Fill(10); - itkImageIteratorWithIndexTestIteratorTester TesterVUC(vuc); + itkRLEImageIteratorWithIndexTestIteratorTester TesterVUC(vuc); if (TesterVUC.TestIterator() == false) { testPassed = false; @@ -313,7 +313,7 @@ itkImageIteratorWithIndexTest(int, char *[]) using VS = itk::Vector; VS vs; vs.Fill(10); - itkImageIteratorWithIndexTestIteratorTester TesterVS(vs); + itkRLEImageIteratorWithIndexTestIteratorTester TesterVS(vs); if (TesterVS.TestIterator() == false) { testPassed = false; @@ -331,7 +331,7 @@ itkImageIteratorWithIndexTest(int, char *[]) using VUS = itk::Vector; VUS vus; vus.Fill(10); - itkImageIteratorWithIndexTestIteratorTester TesterVUS(vus); + itkRLEImageIteratorWithIndexTestIteratorTester TesterVUS(vus); if (TesterVUS.TestIterator() == false) { testPassed = false; @@ -349,7 +349,7 @@ itkImageIteratorWithIndexTest(int, char *[]) using VI = itk::Vector; VI vi; vi.Fill(10); - itkImageIteratorWithIndexTestIteratorTester TesterVI(vi); + itkRLEImageIteratorWithIndexTestIteratorTester TesterVI(vi); if (TesterVI.TestIterator() == false) { testPassed = false; @@ -367,7 +367,7 @@ itkImageIteratorWithIndexTest(int, char *[]) using VUI = itk::Vector; VUI vui; vui.Fill(10); - itkImageIteratorWithIndexTestIteratorTester TesterVUI(vui); + itkRLEImageIteratorWithIndexTestIteratorTester TesterVUI(vui); if (TesterVUI.TestIterator() == false) { testPassed = false; @@ -385,7 +385,7 @@ itkImageIteratorWithIndexTest(int, char *[]) using VF = itk::Vector; VF vf; vf.Fill(10); - itkImageIteratorWithIndexTestIteratorTester TesterVF(vf); + itkRLEImageIteratorWithIndexTestIteratorTester TesterVF(vf); if (TesterVF.TestIterator() == false) { testPassed = false; @@ -403,7 +403,7 @@ itkImageIteratorWithIndexTest(int, char *[]) using VD = itk::Vector; VD vd; vd.Fill(10); - itkImageIteratorWithIndexTestIteratorTester TesterVD(vd); + itkRLEImageIteratorWithIndexTestIteratorTester TesterVD(vd); if (TesterVD.TestIterator() == false) { testPassed = false; diff --git a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorsForwardBackwardTest.cxx similarity index 98% rename from Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx rename to Modules/Filtering/RLEImage/test/itkRLEImageIteratorsForwardBackwardTest.cxx index 9188eb6f3cd..681464fdc4d 100644 --- a/Modules/Filtering/RLEImage/test/itkImageIteratorsForwardBackwardTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorsForwardBackwardTest.cxx @@ -21,7 +21,7 @@ #include "itkRLEImage.h" int -itkImageIteratorsForwardBackwardTest(int, char *[]) +itkRLEImageIteratorsForwardBackwardTest(int, char *[]) { std::cout << "Creating an image" << std::endl; using ImageType = itk::RLEImage; diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx similarity index 92% rename from Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx rename to Modules/Filtering/RLEImage/test/itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx index 1ceb197b17e..5a53957c4b0 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionConstIteratorWithOnlyIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx @@ -21,7 +21,7 @@ #include "itkRLEImage.h" template -class itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester +class itkRLEImageRegionConstIteratorWithOnlyIndexTestIteratorTester { public: using ImageType = TImage; @@ -29,7 +29,7 @@ class itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester using ConstIteratorType = itk::ImageRegionConstIteratorWithOnlyIndex; - itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester() + itkRLEImageRegionConstIteratorWithOnlyIndexTestIteratorTester() { m_Image = ImageType::New(); @@ -185,7 +185,7 @@ class itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester }; int -itkImageRegionConstIteratorWithOnlyIndexTest(int, char *[]) +itkRLEImageRegionConstIteratorWithOnlyIndexTest(int, char *[]) { bool testPassed = true; // let's be optimistic @@ -194,7 +194,7 @@ itkImageRegionConstIteratorWithOnlyIndexTest(int, char *[]) { std::cout << "Testing with Image< char, 3 >... " << std::endl; - itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; + itkRLEImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; if (Tester.TestConstIterator() == false) { testPassed = false; @@ -203,7 +203,7 @@ itkImageRegionConstIteratorWithOnlyIndexTest(int, char *[]) { std::cout << "Testing with ImageBase< 2 >... " << std::endl; - itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; + itkRLEImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; if (Tester.TestConstIterator() == false) { testPassed = false; @@ -212,7 +212,7 @@ itkImageRegionConstIteratorWithOnlyIndexTest(int, char *[]) { std::cout << "Testing with ImageBase< 3 >... " << std::endl; - itkImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; + itkRLEImageRegionConstIteratorWithOnlyIndexTestIteratorTester> Tester; if (Tester.TestConstIterator() == false) { testPassed = false; diff --git a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageRegionIteratorTest.cxx similarity index 99% rename from Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx rename to Modules/Filtering/RLEImage/test/itkRLEImageRegionIteratorTest.cxx index f00881e216f..d4ba3876c18 100644 --- a/Modules/Filtering/RLEImage/test/itkImageRegionIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageRegionIteratorTest.cxx @@ -46,7 +46,7 @@ TestConstPixelAccess(const itk::RLEImage & in, itk::RLEImage & out) int -itkImageRegionIteratorTest(int, char *[]) +itkRLEImageRegionIteratorTest(int, char *[]) { std::cout << "Creating an image" << std::endl; itk::RLEImage>::Pointer o3 = itk::RLEImage>::New(); diff --git a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageScanlineIteratorTest1.cxx similarity index 99% rename from Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx rename to Modules/Filtering/RLEImage/test/itkRLEImageScanlineIteratorTest1.cxx index d6af76fb672..0569f26b8c5 100644 --- a/Modules/Filtering/RLEImage/test/itkImageScanlineIteratorTest1.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageScanlineIteratorTest1.cxx @@ -46,7 +46,7 @@ TestConstPixelAccess(const itk::RLEImage & int -itkImageScanlineIteratorTest1(int, char *[]) +itkRLEImageScanlineIteratorTest1(int, char *[]) { itk::RLEImage>::Pointer o3 = itk::RLEImage>::New(); diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestRLEImageFilterTest.cxx similarity index 98% rename from Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx rename to Modules/Filtering/RLEImage/test/itkRegionOfInterestRLEImageFilterTest.cxx index 1cba36e627a..5ff15dce5b9 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestRLEImageFilterTest.cxx @@ -21,7 +21,7 @@ #include int -itkRegionOfInterestImageFilterTest(int, char *[]) +itkRegionOfInterestRLEImageFilterTest(int, char *[]) { constexpr unsigned int Dimension = 3; using PixelType = itk::Index; From c12733c52f476dfe977835a46c228ba1dd20c093 Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Wed, 14 Oct 2020 12:07:16 -0500 Subject: [PATCH 69/95] STYLE: Rename ITK_DISALLOW_COPY_AND_ASSIGN to ITK_DISALLOW_COPY_AND_MOVE Fixes changes made in #2053. ITK_DISALLOW_COPY_AND_ASSIGN will be used if ITK_FUTURE_LEGACY_REMOVE=OFF. --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 2 +- .../RLEImage/include/itkRLERegionOfInterestImageFilter.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 99fdfeb7d42..5f34d41a496 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -52,7 +52,7 @@ template { public: - ITK_DISALLOW_COPY_AND_ASSIGN(RLEImage); + ITK_DISALLOW_COPY_AND_MOVE(RLEImage); /** Standard class type alias */ using Self = RLEImage; diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index a3c276dbc5d..eef11e17c2a 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -51,7 +51,7 @@ class RegionOfInterestImageFilter RLEImage> { public: - ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter); + ITK_DISALLOW_COPY_AND_MOVE(RegionOfInterestImageFilter); /** Standard class type alias. */ using Self = RegionOfInterestImageFilter; @@ -142,7 +142,7 @@ class RegionOfInterestImageFilter> { public: - ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter); + ITK_DISALLOW_COPY_AND_MOVE(RegionOfInterestImageFilter); /** Standard class type alias. */ using Self = RegionOfInterestImageFilter; @@ -245,7 +245,7 @@ class RegionOfInterestImageFilter, RLEImage, RLEImage> { public: - ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter); + ITK_DISALLOW_COPY_AND_MOVE(RegionOfInterestImageFilter); /** Standard class type alias. */ using RLEImageType = RLEImage; @@ -331,7 +331,7 @@ class RegionOfInterestImageFilter : public ImageToImageFilter, Image> { public: - ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter); + ITK_DISALLOW_COPY_AND_MOVE(RegionOfInterestImageFilter); /** Standard class type alias. */ using RLEImageType = RLEImage; From 9c022255a0bc772e990f988cfacdbf3d5b5ecc34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 25 Jan 2021 16:55:50 -0500 Subject: [PATCH 70/95] BUG: CleanUp did not compile Fixed that, and called it from rleStats to make sure it compiles in the future. --- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 13 +++++-------- Modules/Filtering/RLEImage/test/rleStats.cxx | 3 +++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index 7826a08a688..2a298feee8e 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -103,15 +103,12 @@ RLEImage::CleanUp() const { return; } -#ifndef __GNUC__ -# pragma omp parallel for -#endif - for (CounterType z = 0; z < m_Buffer.size(); z++) + + itk::ImageRegionConstIterator it(m_Buffer, m_Buffer->GetBufferedRegion()); + while (!it.IsAtEnd()) { - for (CounterType y = 0; y < m_Buffer[0].size(); y++) - { - CleanUpLine(m_Buffer[z][y]); - } + CleanUpLine(it.Get()); + ++it; } } diff --git a/Modules/Filtering/RLEImage/test/rleStats.cxx b/Modules/Filtering/RLEImage/test/rleStats.cxx index 8a3f711653c..c62a0ba3a8e 100644 --- a/Modules/Filtering/RLEImage/test/rleStats.cxx +++ b/Modules/Filtering/RLEImage/test/rleStats.cxx @@ -50,6 +50,9 @@ main(int argc, char * argv[]) inConv->Update(); myRLEImage::Pointer test = inConv->GetOutput(); std::cout << test; + std::cout << "Invoking CleanUp() method\n"; + test->CleanUp(); + std::cout << test; } catch (itk::ExceptionObject & error) { From 4fba5afce443fa3c1e5b49d373d18e4cb5553375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 25 Jan 2021 16:54:42 -0500 Subject: [PATCH 71/95] COMP: fix wrapping of RLEImage Counter type must be an integral type, and wrapping was instantiated with a Point. This changes it to unsigned short. --- Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap b/Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap index 57c33fa72a6..393de322c94 100644 --- a/Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap +++ b/Modules/Filtering/RLEImage/wrapping/itkRLEImage.wrap @@ -1,7 +1,7 @@ itk_wrap_class("itk::RLEImage" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) - foreach(t ${WRAP_ITK_REAL}) - itk_wrap_template("${ITKM_${t}}${d}${ITKM_PD${d}}" "${ITKT_${t}},${d},${ITKT_PD${d}}") + foreach(t ${WRAP_ITK_SCALAR}) + itk_wrap_template("${ITKM_${t}}${d}US" "${ITKT_${t}},${d},unsigned short") endforeach() endforeach() itk_end_wrap_class() From a51e8b77fc2d21af306b00f512f4754947d568d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 25 Jan 2021 17:04:35 -0500 Subject: [PATCH 72/95] ENH: proper wrapping of ROI filter for RLEImage --- .../itkRLERegionOfInterestImageFilter.wrap | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/wrapping/itkRLERegionOfInterestImageFilter.wrap b/Modules/Filtering/RLEImage/wrapping/itkRLERegionOfInterestImageFilter.wrap index 4dc53cfe042..bdb01cd5f1a 100644 --- a/Modules/Filtering/RLEImage/wrapping/itkRLERegionOfInterestImageFilter.wrap +++ b/Modules/Filtering/RLEImage/wrapping/itkRLERegionOfInterestImageFilter.wrap @@ -1,3 +1,58 @@ +set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) + +itk_wrap_include("itkRLEImage.h") +itk_wrap_include("itkRLERegionOfInterestImageFilter.h") + +# first wrap the ImageSource (first templated class in inheritance hierarchy) +itk_wrap_class("itk::ImageSource" POINTER) +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${WRAP_ITK_SCALAR}) + # ImageSource only has output. Do it only for RLEImage, as regular image is wrapped elsewhere. + itk_wrap_template("RLEImage${ITKM_${t}}${d}US" "itk::RLEImage<${ITKT_${t}},${d},unsigned short>") + endforeach() +endforeach() +itk_end_wrap_class() + +# now wrap the base class: ImageToImageFilter +itk_wrap_class("itk::ImageToImageFilter" POINTER) +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${WRAP_ITK_SCALAR}) + # RLEImage to RLEImage + itk_wrap_template("RLEImage${ITKM_${t}}${d}USRLEImage${ITKM_${t}}${d}US" + "itk::RLEImage<${ITKT_${t}},${d},unsigned short>,itk::RLEImage<${ITKT_${t}},${d},unsigned short>" + ) + + # RLEImage to itk::Image + itk_wrap_template("RLEImage${ITKM_${t}}${d}USI${ITKM_${t}}${d}" + "itk::RLEImage<${ITKT_${t}},${d},unsigned short>,itk::Image<${ITKT_${t}},${d}>" + ) + + # itk::Image to RLEImage + itk_wrap_template("I${ITKM_${t}}${d}RLEImage${ITKM_${t}}${d}US" + "itk::Image<${ITKT_${t}},${d}>,itk::RLEImage<${ITKT_${t}},${d},unsigned short>" + ) + endforeach() +endforeach() +itk_end_wrap_class() + +# now we can wrap the class of interest with our custom type (RLEImage) itk_wrap_class("itk::RegionOfInterestImageFilter" POINTER) -itk_wrap_image_filter_combinations("${WRAP_ITK_COV_VECTOR_REAL}" "${WRAP_ITK_SCALAR}") +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${WRAP_ITK_SCALAR}) + # RLEImage to RLEImage + itk_wrap_template("RLEImage${ITKM_${t}}${d}USRLEImage${ITKM_${t}}${d}US" + "itk::RLEImage<${ITKT_${t}},${d},unsigned short>,itk::RLEImage<${ITKT_${t}},${d},unsigned short>" + ) + + # RLEImage to itk::Image + itk_wrap_template("RLEImage${ITKM_${t}}${d}USI${ITKM_${t}}${d}" + "itk::RLEImage<${ITKT_${t}},${d},unsigned short>,itk::Image<${ITKT_${t}},${d}>" + ) + + # itk::Image to RLEImage + itk_wrap_template("I${ITKM_${t}}${d}RLEImage${ITKM_${t}}${d}US" + "itk::Image<${ITKT_${t}},${d}>,itk::RLEImage<${ITKT_${t}},${d},unsigned short>" + ) + endforeach() +endforeach() itk_end_wrap_class() From 9912e786b1f834acfb395a997d78bf8b4aa75013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 25 Jan 2021 18:08:03 -0500 Subject: [PATCH 73/95] ENH: add testing of Python instantiation of ROI filter for RLEImage --- .../Filtering/RLEImage/wrapping/test/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt diff --git a/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt b/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt new file mode 100644 index 00000000000..51167e023ce --- /dev/null +++ b/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt @@ -0,0 +1,11 @@ +# test regular image to RLE conversion +itk_python_expression_add_test(NAME itkRegionOfInterestImageFilterISS2RLEImageSS2USPythonTest + EXPRESSION "instance = itk.RegionOfInterestImageFilterISS2RLEImageSS2US.New()") + +# test RLE to regular image conversion +itk_python_expression_add_test(NAME itkRegionOfInterestImageFilterRLEImageSS2USISS2PythonTest + EXPRESSION "instance = itk.RegionOfInterestImageFilterRLEImageSS2USISS2.New()") + +# test RLE to RLE (plain RoI operation) +itk_python_expression_add_test(NAME itkRegionOfInterestImageFilterRLEImageSS2USRLEImageSS2USPythonTest + EXPRESSION "instance = itk.RegionOfInterestImageFilterRLEImageSS2USRLEImageSS2US.New()") From e4923e78bce50ed5a2e4be530e30c8830180dd1b Mon Sep 17 00:00:00 2001 From: Dzenan Zukic Date: Mon, 25 Jan 2021 20:37:54 -0500 Subject: [PATCH 74/95] COMP: fix Linux compile error --- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index 2a298feee8e..a42c8bb7031 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -18,7 +18,7 @@ #ifndef itkRLEImage_hxx #define itkRLEImage_hxx -#include "itkImageRegionConstIterator.h" // for underlying buffer +#include "itkImageRegionIterator.h" // for underlying buffer #include "itkRLEImage.h" // include all specializations of iterators and filters @@ -104,10 +104,10 @@ RLEImage::CleanUp() const return; } - itk::ImageRegionConstIterator it(m_Buffer, m_Buffer->GetBufferedRegion()); + itk::ImageRegionIterator it(m_Buffer, m_Buffer->GetBufferedRegion()); while (!it.IsAtEnd()) { - CleanUpLine(it.Get()); + CleanUpLine(it.Value()); ++it; } } From 4e401dfbb57cf43599a9bb9e272f6e10bd71d90b Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Fri, 17 Dec 2021 09:41:24 -0600 Subject: [PATCH 75/95] COMP: Remove inclusion of .hxx files as headers The ability to include either .h or .hxx files as header files required recursively reading the .h files twice. The added complexity is unnecessary, costly, and can confuse static analysis tools that monitor header guardes (due to reaching the maximum depth of recursion limits for nested #ifdefs in checking). --- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 2 -- .../RLEImage/include/itkRLERegionOfInterestImageFilter.hxx | 1 - 2 files changed, 3 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index a42c8bb7031..e5779044d21 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -19,10 +19,8 @@ #define itkRLEImage_hxx #include "itkImageRegionIterator.h" // for underlying buffer -#include "itkRLEImage.h" // include all specializations of iterators and filters -// so only #include is needed in user code #include "itkRLEImageRegionIterator.h" #include "itkRLEImageScanlineIterator.h" #include "itkRLERegionOfInterestImageFilter.h" diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index 11cd3ed5015..e90b25216b8 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -18,7 +18,6 @@ #ifndef itkRLERegionOfInterestImageFilter_hxx #define itkRLERegionOfInterestImageFilter_hxx -#include "itkRLERegionOfInterestImageFilter.h" #include "itkImage.h" #include "itkImageAlgorithm.h" From 0b0116960c10af9230a9920fdd1e77009897c882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 16 Feb 2022 16:00:32 -0500 Subject: [PATCH 76/95] COMP: Fix assertion condition. It failed to compile in Debug mode. --- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index e5779044d21..686b20eca4d 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -96,7 +96,7 @@ template void RLEImage::CleanUp() const { - assert(!m_Buffer.empty()); + assert(m_Buffer->GetBufferedRegion().GetNumberOfPixels() > 0); if (this->GetLargestPossibleRegion().GetSize(0) == 0) { return; From 1015fe30cd03fb7633571efc0a279eee53ff213f Mon Sep 17 00:00:00 2001 From: Tom Birdsong Date: Tue, 31 May 2022 13:24:37 -0400 Subject: [PATCH 77/95] ENH: Bump ITK and change http to https --- Modules/Filtering/RLEImage/LICENSE | 4 ++-- Modules/Filtering/RLEImage/include/itkRLEImage.h | 2 +- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 2 +- Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h | 2 +- Modules/Filtering/RLEImage/include/itkRLEImageIterator.h | 2 +- .../RLEImage/include/itkRLEImageRegionConstIterator.h | 2 +- .../Filtering/RLEImage/include/itkRLEImageRegionIterator.h | 2 +- .../RLEImage/include/itkRLEImageScanlineConstIterator.h | 2 +- .../Filtering/RLEImage/include/itkRLEImageScanlineIterator.h | 2 +- .../RLEImage/include/itkRLERegionOfInterestImageFilter.h | 2 +- .../RLEImage/include/itkRLERegionOfInterestImageFilter.hxx | 2 +- .../Filtering/RLEImage/test/itkIteratorTestsForRLEImage.cxx | 2 +- Modules/Filtering/RLEImage/test/itkRLEImageIteratorTest.cxx | 2 +- .../RLEImage/test/itkRLEImageIteratorWithIndexTest.cxx | 2 +- .../RLEImage/test/itkRLEImageIteratorsForwardBackwardTest.cxx | 2 +- .../test/itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx | 2 +- .../Filtering/RLEImage/test/itkRLEImageRegionIteratorTest.cxx | 2 +- .../RLEImage/test/itkRLEImageScanlineIteratorTest1.cxx | 2 +- Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx | 2 +- .../RLEImage/test/itkRegionOfInterestRLEImageFilterTest.cxx | 2 +- Modules/Filtering/RLEImage/test/manualTest.cxx | 2 +- Modules/Filtering/RLEImage/test/rleStats.cxx | 2 +- 22 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Modules/Filtering/RLEImage/LICENSE b/Modules/Filtering/RLEImage/LICENSE index 8dada3edaf5..9b259bdfcf9 100644 --- a/Modules/Filtering/RLEImage/LICENSE +++ b/Modules/Filtering/RLEImage/LICENSE @@ -1,6 +1,6 @@ Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -192,7 +192,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index 5f34d41a496..e93c7322d69 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index 686b20eca4d..e291306f8cc 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index df3880a8f2d..b4d03bb2672 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h index 3e4abcf0dff..b1bfbcbfb37 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageIterator.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index 678b38e00dc..8c53f9232ac 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index 27e5f5d21d3..2d29ace886e 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index aa5a450b3aa..20b801640d0 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index f5c7deb9874..68dca6e40fc 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index eef11e17c2a..cce1521b624 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx index e90b25216b8..c3fe392c486 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.hxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/itkIteratorTestsForRLEImage.cxx b/Modules/Filtering/RLEImage/test/itkIteratorTestsForRLEImage.cxx index 066d7666042..e819b8aead6 100644 --- a/Modules/Filtering/RLEImage/test/itkIteratorTestsForRLEImage.cxx +++ b/Modules/Filtering/RLEImage/test/itkIteratorTestsForRLEImage.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorTest.cxx index 617ea0ab7f5..f6ddc2ee42d 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageIteratorWithIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorWithIndexTest.cxx index 117e74e60d6..04528da7e06 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageIteratorWithIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorWithIndexTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageIteratorsForwardBackwardTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorsForwardBackwardTest.cxx index 681464fdc4d..25e380481c5 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageIteratorsForwardBackwardTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageIteratorsForwardBackwardTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx index 5a53957c4b0..e946ab7d9bf 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageRegionIteratorTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageRegionIteratorTest.cxx index d4ba3876c18..20be82e4ec6 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageRegionIteratorTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageRegionIteratorTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageScanlineIteratorTest1.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageScanlineIteratorTest1.cxx index 0569f26b8c5..f6e7add8fe3 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageScanlineIteratorTest1.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageScanlineIteratorTest1.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx index 2705e5eb37c..ced43bbbb87 100644 --- a/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRLEImageTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/itkRegionOfInterestRLEImageFilterTest.cxx b/Modules/Filtering/RLEImage/test/itkRegionOfInterestRLEImageFilterTest.cxx index 5ff15dce5b9..43ded2911f7 100644 --- a/Modules/Filtering/RLEImage/test/itkRegionOfInterestRLEImageFilterTest.cxx +++ b/Modules/Filtering/RLEImage/test/itkRegionOfInterestRLEImageFilterTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/manualTest.cxx b/Modules/Filtering/RLEImage/test/manualTest.cxx index 7c6586c77c3..5be6d44734a 100644 --- a/Modules/Filtering/RLEImage/test/manualTest.cxx +++ b/Modules/Filtering/RLEImage/test/manualTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/RLEImage/test/rleStats.cxx b/Modules/Filtering/RLEImage/test/rleStats.cxx index c62a0ba3a8e..e7ca3e64816 100644 --- a/Modules/Filtering/RLEImage/test/rleStats.cxx +++ b/Modules/Filtering/RLEImage/test/rleStats.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, From 3aded4c54825daa93dd7eaf541e83e9d6d28f1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 26 Apr 2023 16:01:14 -0400 Subject: [PATCH 78/95] STYLE: Use trailing return type instead of typename + dependent type --- Modules/Filtering/RLEImage/CMakeLists.txt | 4 ++-- Modules/Filtering/RLEImage/include/itkRLEImage.hxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/Filtering/RLEImage/CMakeLists.txt b/Modules/Filtering/RLEImage/CMakeLists.txt index c053e1ed0e1..3c666a05ffc 100644 --- a/Modules/Filtering/RLEImage/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.16.3) project(RLEImage) if(NOT ITK_SOURCE_DIR) - find_package(ITK 4.9 REQUIRED) + find_package(ITK 5.3 REQUIRED) list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) include(ITKModuleExternal) else() diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx index e291306f8cc..b70cca5870b 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.hxx +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.hxx @@ -28,8 +28,8 @@ namespace itk { template -inline typename RLEImage::BufferType::IndexType -RLEImage::truncateIndex(const IndexType & index) +inline auto +RLEImage::truncateIndex(const IndexType & index) -> typename BufferType::IndexType { typename BufferType::IndexType result; for (IndexValueType i = 0; i < VImageDimension - 1; i++) From c258328bdaa76fd38347cf0c911d1c4a3af923f5 Mon Sep 17 00:00:00 2001 From: "Stephen R. Aylward" Date: Sun, 17 Dec 2023 11:21:35 -0500 Subject: [PATCH 79/95] ENH: Bump to ITKv5.4rc02. This includes enabling shared libraries in itk-module.cmake, updating setup.py as well as CI scripts, and addressing CMP0135 warning. --- Modules/Filtering/RLEImage/CMakeLists.txt | 6 +++++- Modules/Filtering/RLEImage/itk-module.cmake | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/CMakeLists.txt b/Modules/Filtering/RLEImage/CMakeLists.txt index 3c666a05ffc..8ce8a9ad9d7 100644 --- a/Modules/Filtering/RLEImage/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/CMakeLists.txt @@ -1,8 +1,12 @@ cmake_minimum_required(VERSION 3.16.3) project(RLEImage) +if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) +endif() + if(NOT ITK_SOURCE_DIR) - find_package(ITK 5.3 REQUIRED) + find_package(ITK REQUIRED) list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) include(ITKModuleExternal) else() diff --git a/Modules/Filtering/RLEImage/itk-module.cmake b/Modules/Filtering/RLEImage/itk-module.cmake index c22a99ac186..a4741942f2a 100644 --- a/Modules/Filtering/RLEImage/itk-module.cmake +++ b/Modules/Filtering/RLEImage/itk-module.cmake @@ -11,6 +11,7 @@ file(READ "${MY_CURENT_DIR}/README.md" DOCUMENTATION) # define the dependencies of the include module and the tests itk_module( RLEImage + ENABLE_SHARED DEPENDS ITKImageGrid TEST_DEPENDS From d3e538fd204bd125b60781b231032501ee90520c Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 1 Apr 2024 14:22:49 -0400 Subject: [PATCH 80/95] COMP: Uninitialized in GetNumberOfComponentsPerPixel Addresses: ``` In file included from /Users/matt.mccormick/src/ITK/Modules/External/ITKRLEImage/test/itkRLEImageTest.cxx:19: /Users/matt.mccormick/src/ITK/Modules/External/ITKRLEImage/include/itkRLEImage.h:214:53: warning: variable 'p' is uninitialized when passed as a const reference argument here [-Wuninitialized-const-reference] return itk::NumericTraits::GetLength(p); ``` on macOS clang. --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index e93c7322d69..f817d10e1d5 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -213,9 +213,7 @@ class RLEImage : public itk::ImageBase { // use the GetLength() method which works with variable length arrays, // to make it work with as much pixel types as possible - PixelType p; - - return itk::NumericTraits::GetLength(p); + return itk::NumericTraits::GetLength({}); } /** Typedef for the internally used buffer. */ From e54d6d48637cea66bcb36f3442529a0f7bbe20df Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 1 Apr 2024 17:51:10 -0400 Subject: [PATCH 81/95] COMP: Add compiler deduction guides RLEImage ImageScanlineConstIterator This addresses https://github.com/InsightSoftwareConsortium/ITK/issues/4537 In addition to SmartPointer arguments, we need a raw const pointer version. Suggested-by: Niels Dekker --- .../include/itkRLEImageScanlineConstIterator.h | 12 ++++++++++++ .../RLEImage/include/itkRLEImageScanlineIterator.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index 20b801640d0..90310340366 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -178,6 +178,18 @@ class ImageScanlineConstIterator> return *this; } }; + +// Deduction guide for class template argument deduction (CTAD). +template +ImageScanlineConstIterator(SmartPointer>, + const typename RLEImage::RegionType &) + -> ImageScanlineConstIterator>; + +template +ImageScanlineConstIterator(const RLEImage *, + const typename RLEImage::RegionType &) + -> ImageScanlineConstIterator>; + } // end namespace itk #endif // itkRLEImageScanlineConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index 68dca6e40fc..6e2a5a8bdf4 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -102,6 +102,13 @@ class ImageScanlineIterator> return *this; } }; + +// Deduction guide for class template argument deduction (CTAD). +template +ImageScanlineIterator(SmartPointer>, + const typename RLEImage::RegionType &) + -> ImageScanlineIterator>; + } // end namespace itk #endif // itkRLEImageScanlineIterator_h From f98d6803557bec1d923097bb2db92a27e3bb5617 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 19 Jun 2024 16:32:02 -0400 Subject: [PATCH 82/95] BUG: Fix Python test expression Add missing period before the type. --- Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt b/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt index 51167e023ce..475cf496ae9 100644 --- a/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt @@ -1,11 +1,11 @@ # test regular image to RLE conversion itk_python_expression_add_test(NAME itkRegionOfInterestImageFilterISS2RLEImageSS2USPythonTest - EXPRESSION "instance = itk.RegionOfInterestImageFilterISS2RLEImageSS2US.New()") + EXPRESSION "instance = itk.RegionOfInterestImageFilter.ISS2RLEImageSS2US.New()") # test RLE to regular image conversion itk_python_expression_add_test(NAME itkRegionOfInterestImageFilterRLEImageSS2USISS2PythonTest - EXPRESSION "instance = itk.RegionOfInterestImageFilterRLEImageSS2USISS2.New()") + EXPRESSION "instance = itk.RegionOfInterestImageFilter.RLEImageSS2USISS2.New()") # test RLE to RLE (plain RoI operation) itk_python_expression_add_test(NAME itkRegionOfInterestImageFilterRLEImageSS2USRLEImageSS2USPythonTest - EXPRESSION "instance = itk.RegionOfInterestImageFilterRLEImageSS2USRLEImageSS2US.New()") + EXPRESSION "instance = itk.RegionOfInterestImageFilter.RLEImageSS2USRLEImageSS2US.New()") From be3b584c9af556c63c0f2be588fc9092fe69696f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Mon, 6 Jan 2025 09:10:17 -0500 Subject: [PATCH 83/95] COMP: Fix clang compile error in MCI TestWithRLEImage.cxx The error message was: [658/2516] Building CXX object Modules/Remote/MorphologicalContourInterpolation/test/CMakeFiles/MorphologicalContourInterpolationTestDriver.dir/itkMorphologicalContourInterpolationTestWithRLEImage.cxx.o FAILED: Modules/Remote/MorphologicalContourInterpolation/test/CMakeFiles/MorphologicalContourInterpolationTestDriver.dir/itkMorphologicalContourInterpolationTestWithRLEImage.cxx.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DEIGEN_MPL2_ONLY -IModules/ThirdParty/Eigen3/src -IModules/ThirdParty/KWSys/src -I/.../ITK/Modules/ThirdParty/VNL/src/vxl/v3p/netlib -I/.../ITK/Modules/ThirdParty/VNL/src/vxl/vcl -I/.../ITK/Modules/ThirdParty/VNL/src/vxl/core -IModules/ThirdParty/VNL/src/vxl/v3p/netlib -IModules/ThirdParty/VNL/src/vxl/vcl -IModules/ThirdParty/VNL/src/vxl/core -IModules/Core/Common -I/.../ITK/Modules/Core/Common/include -I/.../ITK/Modules/ThirdParty/DoubleConversion/src -IModules/ThirdParty/DoubleConversion/src/double-conversion -IModules/IO/ImageBase -I/.../ITK/Modules/IO/ImageBase/include -I/.../ITK/Modules/Core/TestKernel/include -I/.../ITK/Modules/Core/ImageAdaptors/include -IModules/ThirdParty/Netlib -I/.../ITK/Modules/Numerics/Statistics/include -I/.../ITK/Modules/Filtering/ImageFilterBase/include -I/.../ITK/Modules/Core/Transform/include -I/.../ITK/Modules/Core/ImageFunction/include -I/.../ITK/Modules/Filtering/ImageGrid/include -I/.../ITK/Modules/Filtering/ImageCompose/include -IModules/ThirdParty/ZLIB/src -IModules/ThirdParty/ZLIB/src/itkzlib-ng -I/.../ITK/Modules/ThirdParty/ZLIB/src -IModules/ThirdParty/MetaIO/src/MetaIO/src -I/.../ITK/Modules/ThirdParty/MetaIO/src/MetaIO/src -I/.../ITK/Modules/Core/SpatialObjects/include -I/.../ITK/Modules/Filtering/ImageStatistics/include -I/.../ITK/Modules/Filtering/Path/include -I/.../ITK/Modules/Filtering/ImageIntensity/include -I/.../ITK/Modules/Filtering/ImageLabel/include -I/.../ITK/Modules/Filtering/LabelMap/include -I/.../ITK/Modules/Filtering/Thresholding/include -I/.../ITK/Modules/Segmentation/ConnectedComponents/include -I/.../ITK/Modules/Filtering/MathematicalMorphology/include -I/.../ITK/Modules/Filtering/BinaryMathematicalMorphology/include -I/.../ITK/Modules/Core/FiniteDifference/include -I/.../ITK/Modules/Filtering/CurvatureFlow/include -I/.../ITK/Modules/Numerics/NarrowBand/include -I/.../ITK/Modules/Filtering/DistanceMap/include -I/.../ITK/Modules/Remote/MorphologicalContourInterpolation/include -I/.../ITK/Modules/Remote/RLEImage/include -I/.../ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo -I/.../ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl -IModules/ThirdParty/VNL/src/vxl/core/vnl -isystem /.../ITK/Modules/ThirdParty/Eigen3/src/itkeigen/.. -mtune=generic -march=corei7 -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Wno-undefined-var-template -Woverloaded-virtual -Wctad-maybe-unsupported -O3 -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -fPIE -std=c++17 -MD -MT Modules/Remote/MorphologicalContourInterpolation/test/CMakeFiles/MorphologicalContourInterpolationTestDriver.dir/itkMorphologicalContourInterpolationTestWithRLEImage.cxx.o -MF Modules/Remote/MorphologicalContourInterpolation/test/CMakeFiles/MorphologicalContourInterpolationTestDriver.dir/itkMorphologicalContourInterpolationTestWithRLEImage.cxx.o.d -o Modules/Remote/MorphologicalContourInterpolation/test/CMakeFiles/MorphologicalContourInterpolationTestDriver.dir/itkMorphologicalContourInterpolationTestWithRLEImage.cxx.o -c /.../ITK/Modules/Remote/MorphologicalContourInterpolation/test/itkMorphologicalContourInterpolationTestWithRLEImage.cxx In file included from Modules/Remote/MorphologicalContourInterpolation/test/itkMorphologicalContourInterpolationTestWithRLEImage.cxx:20: In file included from Modules/IO/ImageBase/include/itkImageFileWriter.h:266: In file included from Modules/IO/ImageBase/include/itkImageFileWriter.hxx:33: In file included from Modules/Core/Common/include/itkImageAlgorithm.h:221: Modules/Core/Common/include/itkImageAlgorithm.hxx:40:37: error: no viable constructor or deduction guide for deduction of template arguments of 'ImageScanlineIterator' 40 | itk::ImageScanlineIterator ot(outImage, outRegion); | ^ --- .../RLEImage/include/itkRLEImageScanlineIterator.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h index 6e2a5a8bdf4..83a175c1df8 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineIterator.h @@ -109,6 +109,12 @@ ImageScanlineIterator(SmartPointer::RegionType &) -> ImageScanlineIterator>; +// Deduction guide for class template argument deduction (CTAD). +template +ImageScanlineIterator(RLEImage *, + const typename RLEImage::RegionType &) + -> ImageScanlineIterator>; + } // end namespace itk #endif // itkRLEImageScanlineIterator_h From 51b346ea4ef4645072de8b7eb5a8564e73306faf Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 25 Jan 2025 11:14:25 -0600 Subject: [PATCH 84/95] COMP: Use modern macro for name of class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When preparing for the future with ITK by setting ITK_FUTURE_LEGACY_REMOVE:BOOL=ON ITK_LEGACY_REMOVEBOOL=ON The future preferred macro should be used │ - itkTypeMacro │ + itkOverrideGetNameOfClassMacro --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 2 +- .../RLEImage/include/itkRLEImageRegionConstIterator.h | 2 +- .../RLEImage/include/itkRLEImageScanlineConstIterator.h | 2 +- .../RLEImage/include/itkRLERegionOfInterestImageFilter.h | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index f817d10e1d5..ee710df2a97 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -65,7 +65,7 @@ class RLEImage : public itk::ImageBase itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(RLEImage, ImageBase); + itkOverrideGetNameOfClassMacro(RLEImage); /** Pixel type alias support. Used to declare pixel type in filters * or other operations. */ diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index 8c53f9232ac..fbb0deb546a 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -69,7 +69,7 @@ class ImageRegionConstIterator> using PixelType = typename Superclass::PixelType; /** Run-time type information (and related methods). */ - itkTypeMacro(ImageRegionConstIterator, ImageConstIterator); + itkOverrideGetNameOfClassMacro(ImageRegionConstIterator); /** Default constructor. Needed since we provide a cast constructor. */ ImageRegionConstIterator() diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h index 90310340366..99235ede91b 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageScanlineConstIterator.h @@ -59,7 +59,7 @@ class ImageScanlineConstIterator> using PixelType = typename Superclass::PixelType; /** Run-time type information (and related methods). */ - itkTypeMacro(ImageScanlineConstIterator, ImageRegionConstIterator); + itkOverrideGetNameOfClassMacro(ImageScanlineConstIterator); /** Default constructor. Needed since we provide a cast constructor. */ ImageScanlineConstIterator() diff --git a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h index cce1521b624..b847e607031 100644 --- a/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h +++ b/Modules/Filtering/RLEImage/include/itkRLERegionOfInterestImageFilter.h @@ -66,7 +66,7 @@ class RegionOfInterestImageFilter itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(RegionOfInterestImageFilter, ImageToImageFilter); + itkOverrideGetNameOfClassMacro(RegionOfInterestImageFilter); /** Typedef to describe the input image region types. */ using RegionType = typename RLEImageType::RegionType; @@ -158,7 +158,7 @@ class RegionOfInterestImageFilter, RLEImage itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(RegionOfInterestImageFilter, ImageToImageFilter); + itkOverrideGetNameOfClassMacro(RegionOfInterestImageFilter); /** Typedef to describe the input image region types. */ using RegionType = typename RLEImageType::RegionType; From 34bb8120a0e4c091e0a40d0cdff39698ee7d3d1a Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 25 Jan 2025 11:27:40 -0600 Subject: [PATCH 85/95] STYLE: ITK_FUTURE_LEGACY_REMOVE itkTypeMacro and itkTypeMacroNoParent Deprecated `itkTypeMacro` and `itkTypeMacroNoParent`, in favor of `itkOverrideGetNameOfClassMacro` and `itkVirtualGetNameOfClassMacro`, respectively. --- Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h index b4d03bb2672..d12272e5fe8 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageConstIterator.h @@ -54,7 +54,7 @@ class ImageConstIterator> static constexpr unsigned int ImageIteratorDimension = VImageDimension; /** Run-time type information (and related methods). */ - itkTypeMacroNoParent(ImageConstIterator); + itkVirtualGetNameOfClassMacro(ImageConstIterator); /** Image type alias support. */ using ImageType = RLEImage; From f0517643eb743ab9085c6eadb847acb964b477ff Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Wed, 29 Apr 2026 07:37:34 -0500 Subject: [PATCH 86/95] ENH: Convert ExternalData .sha512 tags to .cid (IPFS content IDs) Migrate 35 ExternalData tag files to CIDv1-raw form. The CID blobs (7 new) are added to ITKTestingData gh-pages in InsightSoftwareConsortium/ITKTestingData#40. --- Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.cid | 1 + Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.cid | 1 + Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/2D.png.cid | 1 + Modules/Filtering/RLEImage/test/Input/2D.png.sha512 | 1 - .../Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.cid | 1 + .../RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 | 1 - .../Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.cid | 1 + .../RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 | 1 - .../Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.cid | 1 + .../RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 | 1 - .../Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.cid | 1 + .../RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 | 1 - .../RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.cid | 1 + .../RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 | 1 - .../RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.cid | 1 + .../RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/Empty.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 | 1 - .../RLEImage/test/Input/ExtrapolationAppearing.nrrd.cid | 1 + .../RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/FourD.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.cid | 1 + .../Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/Small2D.png.cid | 1 + Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 | 1 - .../RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.cid | 1 + .../RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 | 1 - .../RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.cid | 1 + .../RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/brainParc.mha.cid | 1 + Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/vb-seg.mha.cid | 1 + Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 | 1 - Modules/Filtering/RLEImage/test/Input/ws.nrrd.cid | 1 + Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 | 1 - 70 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/2D.png.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/2D.png.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/Empty.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/FourD.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/Small2D.png.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/brainParc.mha.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/vb-seg.mha.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 create mode 100644 Modules/Filtering/RLEImage/test/Input/ws.nrrd.cid delete mode 100644 Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 diff --git a/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.cid b/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.cid new file mode 100644 index 00000000000..d53ef8ff823 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.cid @@ -0,0 +1 @@ +bafkreib2jcz776zhw246jch4abaify6g6xhegiglyhzacenxi73tbijuxu diff --git a/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 deleted file mode 100644 index 3cb5c81a584..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/105769fixed.nii.gz.sha512 +++ /dev/null @@ -1 +0,0 @@ -7cefdfdfd161a469e021b86a109f5fe18c3a5d5ffbf554be8be8f22d24717821cf7d996bac4320f2ad931689fb93f87086ca52d0f64d75f1235d1a1b60ca9322 diff --git a/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.cid b/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.cid new file mode 100644 index 00000000000..d1420e1c26b --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.cid @@ -0,0 +1 @@ +bafkreick7vd27d3tqztjvn7b422wysowiixvlrj3qxkq5xop2bnyqwnaw4 diff --git a/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 deleted file mode 100644 index a6fe73535d9..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/105769moving.nii.gz.sha512 +++ /dev/null @@ -1 +0,0 @@ -ae40c8904a248d25b26dfd3c65db3a51de0c06c65f4a618e86b7e2e8c3f6c8cdd1eac1ca7c238e619def2ec6819ab16ddcaac7be4e15866a9992a7cde6a9d07d diff --git a/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.cid new file mode 100644 index 00000000000..7b9a7b29838 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.cid @@ -0,0 +1 @@ +bafkreihj3yutrrpirztddw7gy3tom2iorjilfqiw3dotwjjvsrquszzzzy diff --git a/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 deleted file mode 100644 index f12d0a311c9..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/1MN1.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -a6cdab87ada9ad338cb309ee28abae8c7598a44d28796285b85f1af6b0e5bc82c116499eeedb8d88ad638dcce19024958e3a657f17bc63f052b09c27c401be55 diff --git a/Modules/Filtering/RLEImage/test/Input/2D.png.cid b/Modules/Filtering/RLEImage/test/Input/2D.png.cid new file mode 100644 index 00000000000..786b9b2ff8b --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/2D.png.cid @@ -0,0 +1 @@ +bafkreibkr5ed5dq2ug2luujh7iljj42iihyrlmb64mkzqbjk5y2kyelgca diff --git a/Modules/Filtering/RLEImage/test/Input/2D.png.sha512 b/Modules/Filtering/RLEImage/test/Input/2D.png.sha512 deleted file mode 100644 index 7b1b1989fcd..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/2D.png.sha512 +++ /dev/null @@ -1 +0,0 @@ -9ce98c80c2be824d3a9f221c45f6a887184abdc048f2f342a83f49f71c1350d31e9e63e08d60d97fe96ec65e1449811537f16fbb26605e8aaf9dcb02a8f8d482 diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.cid b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.cid new file mode 100644 index 00000000000..d31f2507249 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.cid @@ -0,0 +1 @@ +bafkreib5witrs3cvmcfe4ywniufyz37xukyaj3z6x4vhyaws3vnt7aejea diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 deleted file mode 100644 index 712a57e3f0d..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_fin.nii.gz.sha512 +++ /dev/null @@ -1 +0,0 @@ -71d58e5c95d483f6d0007aa34625f0101f0750dcbc0f806b8d83b731913eafb67c842796ab1d09fcaf935df463f0a8c5f81764175c52b4a9fc51aec803d8388e diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.cid b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.cid new file mode 100644 index 00000000000..21a8137a73e --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.cid @@ -0,0 +1 @@ +bafkreidod4atkopejsyqivziwskc6r5zd25vce3iavjkpuuewsqzypdoum diff --git a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 deleted file mode 100644 index 0a3e7e57c21..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/64816L_amygdala_int.nii.gz.sha512 +++ /dev/null @@ -1 +0,0 @@ -8268d5ebf4dbba9b52fa6a375a70194cf323b122f230606707f7f5122b32cd088d9657266da2124233eb9703ffcc535f7c2d97ceb767f56105b0cb0801c4c83f diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.cid b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.cid new file mode 100644 index 00000000000..4cc58a9bb0a --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.cid @@ -0,0 +1 @@ +bafkreiel2l6xyfqjt36gjmc2xbeix4vambaqhgnw3x5s4lmt7el75i5uy4 diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 deleted file mode 100644 index 18fbf5c2c7a..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_fin.nii.gz.sha512 +++ /dev/null @@ -1 +0,0 @@ -dba160f3cabdc646e7c144a5a65803774ca55394ddeb549c0fc02f2e211b04ef88ab27bd7bcf8ad1aff792bb58f6b6515edd90b3fa1e3a6630975a885afe322a diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.cid b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.cid new file mode 100644 index 00000000000..842099cb20d --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.cid @@ -0,0 +1 @@ +bafkreic7q4gkyokrflzxqqqitx5pbv7cxe5vrrgtwwbxrxj33hlni3v6qy diff --git a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 b/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 deleted file mode 100644 index 8055e226d07..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/65239R_amygdala_int.nii.gz.sha512 +++ /dev/null @@ -1 +0,0 @@ -c4806e3d999fd910de86e85624d1058894d89e770a589a876149da1c218f57703790105d98743ae8d7001f0f26ed635868e24ac25b902d234d160bc8fe4301f9 diff --git a/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.cid new file mode 100644 index 00000000000..371f24a9995 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.cid @@ -0,0 +1 @@ +bafkreihmyn7pkuhrz7323e7rab5deqr6hs3hoxhx6bqdko5mxky4ron55y diff --git a/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 deleted file mode 100644 index c8af2ca8a72..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/AccidentalMiddleSliceSeg.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -fef524960f673e47b605985aa6af485b28f6baeb885ae8b3d23dfaff2f0f284b285f50bbdb59c657a6225dbaf5e98aad384de249e44fc25c167c6c69750914ac diff --git a/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.cid new file mode 100644 index 00000000000..d32e93144f5 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.cid @@ -0,0 +1 @@ +bafkreiapuklol6iv4kaniskgwhut54g447lrkouoavtda2h4agqwoxbbxm diff --git a/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 deleted file mode 100644 index 241b1411f26..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/BigZ.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -01a84b44df11cc8271f3d5e4af12666c38fc3d5ed274faf06e081a5513b8d7282ec2398211a22fd87f192371d9b86bfc7602d17e11bfe2fa5b20b96acba47798 diff --git a/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.cid new file mode 100644 index 00000000000..9dd1f2436d2 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.cid @@ -0,0 +1 @@ +bafkreigyky43pe2glq43mvxinfoxvlnv7oj26z3rqwsxe52qtuwd6gr5ci diff --git a/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 deleted file mode 100644 index d5c665f9280..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/DoubleTwoLabelBranching.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -ed20871dbab0a1fc903209af89b49a5809ccd88fe2db52ac71bf1f57cf4f72a73988a392d554c8b073f053e14b6c2d700acf1193658df601e23634cdc0f99f30 diff --git a/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.cid new file mode 100644 index 00000000000..9b596016c7f --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.cid @@ -0,0 +1 @@ +bafkreicgqhfbdvqkl4byv56sjfvd4tbj6d4cmkx4bsgtunfxg3gaiddaza diff --git a/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 deleted file mode 100644 index 985a0f0d871..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/Empty.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -f2d1e3df34b57c456a67a347d2a53d5cf096a0bcb2c8a20092cc3f3e86643d23836b0052b59bf64bac95f93bdba6adb380adec91166bd9ad9ead0435df9544d7 diff --git a/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.cid new file mode 100644 index 00000000000..a9bace479a7 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.cid @@ -0,0 +1 @@ +bafkreihc6q2lnb46gfyu77w5y4ilsqekx3oiuggjlzce64aq3tcvxglduy diff --git a/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 deleted file mode 100644 index 2ccc4445dd3..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ExtrapolationAppearing.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -263cb6d853d551700abe53dfc73e451cb50f9095ad20ecdbb8565fc2b0f2fd4863f97669f4f6bdb802b99001ee82d46a441363cb49ac9171d62552001f3a8567 diff --git a/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.cid new file mode 100644 index 00000000000..6a717c0134a --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.cid @@ -0,0 +1 @@ +bafkreigv4bcueqojhouysj3lxeigd2i3f3rcvmtkypi7linrgnei4zlr6a diff --git a/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 deleted file mode 100644 index d39b18da1b1..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/FaceRoI.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -d01b9b1430eb30f1cf0f82e331687f396193e0ae1d7ab3cb63e27a456a7152503d45e3eca39e9ede949977e03dde732cd330d0a5fd8768f362255a79e642ca60 diff --git a/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.cid new file mode 100644 index 00000000000..15d673454c5 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.cid @@ -0,0 +1 @@ +bafkreibmeohmkrkulrmyqqptoch3v2mwoausnhpq5btvyqnzromjmsk534 diff --git a/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 deleted file mode 100644 index 2523d199536..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/FourD.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -5e81a4959b9150d8ddbcb7d1f097a14fb00ac614c633a8617356607bc5c25a2aad48ab8001773db5b7a4f75a62b0df501a9af3848d1128fdf50150db595aef2c diff --git a/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.cid new file mode 100644 index 00000000000..c0f5f1383d8 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.cid @@ -0,0 +1 @@ +bafkreidjbqsw4ygy4isc6gqqpgcg5adexeoc5gnt26j7zpfm5lhhmme2ry diff --git a/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 deleted file mode 100644 index f575e60c2d0..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/FullEnd.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -b3fadf72aa928b0e9acd55d910d4bcf60d031b2e84dabace9069c6891670f6db61dabad43bd2da6efa57af49bfe13288c300ab2c9cdd11b516c80f82bce08d23 diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.cid new file mode 100644 index 00000000000..8eb43554aeb --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.cid @@ -0,0 +1 @@ +bafkreia77htujqonvdzb4wdzk2c3fmmjx6s5wc4zvfkahxumcou2vtlsri diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 deleted file mode 100644 index acead814258..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/GridSeg.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -edfd6a4aaf43eb940e998bbcd73aadb6b1a7ce1d4f27e069f82da36601d94970173112d72e4f02ae935f80857619020d600b5bed2576f479fc9255082fafb107 diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.cid new file mode 100644 index 00000000000..fd61f8909dc --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.cid @@ -0,0 +1 @@ +bafkreihaa52jcvehe5vczpvgg634yarwvmvzmcyc2kf3mk32ng4uqbzn34 diff --git a/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 deleted file mode 100644 index 5d33e0136ae..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/GridSeg2.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -b32b370cced6144a9c892ffca54a94bf4dd64404ce700416d09067bef52779501a7b772aedc9d2f585721272e53c79871184d78b971e819758afc6c0da967d6e diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.cid new file mode 100644 index 00000000000..21eebbb2b16 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.cid @@ -0,0 +1 @@ +bafkreigfqxkod62sntm7orjzyyzsmtfhbk7lem6sslfa2gfq6mjg3zh4eq diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 deleted file mode 100644 index efa17bd0bd5..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ManyToMany.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -00f367a8488c9456e78f04063062f4556a641e15f4366eb325c2cbaa19dce12ea43306238648ce1b2c0aedd7acf8e0d1484cbcf80e7bca36e9a425d8209202ca diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.cid new file mode 100644 index 00000000000..3fcc9179950 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.cid @@ -0,0 +1 @@ +bafkreihdrdpt7wiudnannjpxlbouwipyt62zt7kh532kxc3c24nsdja4wq diff --git a/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 deleted file mode 100644 index 039ce9c236f..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ManyToMany16.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -2fc1b61001121bbb61b3ffe34e1cb8b1c38e109e4869f5aca0a505f47a8f5120cc8a595454f350f69d783b4e53563c1a59b16c9d1565781ab7dfaf11fcda78e0 diff --git a/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.cid new file mode 100644 index 00000000000..e88961a6c3c --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.cid @@ -0,0 +1 @@ +bafkreicyvy5uecyza76g4bcr2nbswone6rrlkubeeyte6yeqe62j3u76qa diff --git a/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 deleted file mode 100644 index 0fac2d55fe4..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/Micro1.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -938cff2303a30070fea1356ea9c3a28d01c712285054c385823f9efc8aa8b01b01cd59371b292fe66e208933cfcaea8248290b0d90ea3ffbb1bca0a7d54b4522 diff --git a/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.cid new file mode 100644 index 00000000000..dcaa296fbd1 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.cid @@ -0,0 +1 @@ +bafkreig5ygh4vqwbhuhgv4shub6nyn5dxv2d6wtgovdwqqkv5iwn4ohf3y diff --git a/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 deleted file mode 100644 index 54608d1343c..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/NoSlices.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -d44bfe1f7246ea43a3769bafd98151ade7797de64002ee8f0ce783064ab3580301d8126d1b14f39ab8da04e12627d836fe5bb623e82363d76fb3ba757ccc2294 diff --git a/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.cid new file mode 100644 index 00000000000..b7d61ae9ead --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.cid @@ -0,0 +1 @@ +bafkreighhapx2okkpm767f7e6eszycckghbnvv5slztxhvqtsp63iydh5a diff --git a/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 deleted file mode 100644 index 39461ebfd97..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/OneToOne.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -7eaef1ea728368426f38b7bd567bc5f64a923ed56e8f4c30d06e81ebca16029bd35d801363cb20ead0e5cadaae866dee2c1209c768737e8ca00acf341f4349cc diff --git a/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.cid new file mode 100644 index 00000000000..eeb1bdc05e5 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.cid @@ -0,0 +1 @@ +bafkreicgb2kche6tvqi7hlhjv4ffeodgumsnvbk44oebqzmsjywmurxx2m diff --git a/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 deleted file mode 100644 index 7d35cc982d0..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/OneToThree.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -456ffae61e9e051cff87835221e334ddb54c42a52143ed6813cf710355d5678ee15c3100ec5547adacf772bd7600d177f14f45e4d94e7a0bb4b0438c46dda588 diff --git a/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.cid new file mode 100644 index 00000000000..8c12c823abb --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.cid @@ -0,0 +1 @@ +bafkreibt464276qlxgdff7gbezvdsdy42lvw4xmcxbutwgaeb6ldyl2lou diff --git a/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 deleted file mode 100644 index 3ad61f7f32c..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/SevenLabels.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -14e1dd4f285e1ac76a4c17e8e1b39dfff73b55f05093d1040895e6903728341c2e49e92d1f99d0865ac7e746c23aa6caab14a279a6c1aba5f04aece703f695af diff --git a/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.cid new file mode 100644 index 00000000000..ee19b512509 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.cid @@ -0,0 +1 @@ +bafkreigesnc4q7q75tgo6ejajgie74z33q2sz6nb2tkrm7q7fmjpnlipty diff --git a/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 deleted file mode 100644 index 83a6b5d8046..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/SimplestOneToOne.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -b2b45f85ea93b5a529dd77477fb27431e67623d14d4cadf04e59961df7e9ef60643fab53245a102ebd9e8c1df831dd7e95b74cecf84ad11fad57ac50c1ec89f0 diff --git a/Modules/Filtering/RLEImage/test/Input/Small2D.png.cid b/Modules/Filtering/RLEImage/test/Input/Small2D.png.cid new file mode 100644 index 00000000000..b9dfa36c104 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/Small2D.png.cid @@ -0,0 +1 @@ +bafkreigqf3mup3p6wyhgghtn7myxrc2ohzcpvnkaqcxe2uylc4lg6hhywm diff --git a/Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 b/Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 deleted file mode 100644 index 52e376a0097..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/Small2D.png.sha512 +++ /dev/null @@ -1 +0,0 @@ -81e4b54baeaf99e5c13d25397851d06b6e091cd21e15a211825e3909ef937aae2ba827bfe3c5edc3629af1fa5db6a9f59b6725f5646a50e8404e287eccb3a954 diff --git a/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.cid new file mode 100644 index 00000000000..01561909467 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.cid @@ -0,0 +1 @@ +bafkreielkkmkrrv7oseu3fwjbtu7x6haad73dp4nk2pjxwqrc6bo2imhvq diff --git a/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 deleted file mode 100644 index 2331f997c70..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ThreeAxisFourLabelConflict.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -d271897514ea2129ca0d12b48f7037f0fe223b2e354f812998bf0df549b3c0c820b6b941ceb78ebb13de658bf6c8b6a96f2bc9503274c7e6d006c11bf71eba84 diff --git a/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.cid new file mode 100644 index 00000000000..c1138e28409 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.cid @@ -0,0 +1 @@ +bafkreihga2ja24eulxbuvyidzbtp5zplsts7fir7fsduuens3yvwnx5q3q diff --git a/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 deleted file mode 100644 index d55cce878d0..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/TwoAxisDoubleTwoLabelBC.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -1310fc4e2cdca6bbba95a4ce10bfe3a7219e1d795d5e5ecd757a2d9e68911a13426053a6915309ddc6527b45199809bcb0098114a7ed4c677b448d75b4fd1b44 diff --git a/Modules/Filtering/RLEImage/test/Input/brainParc.mha.cid b/Modules/Filtering/RLEImage/test/Input/brainParc.mha.cid new file mode 100644 index 00000000000..305376f36f8 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/brainParc.mha.cid @@ -0,0 +1 @@ +bafkreigrhsu4viwh7twyxc2i4ftk4ba4t26zyfn3qgo66vanj4ge5j2cd4 diff --git a/Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 b/Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 deleted file mode 100644 index 9b7128cfcf8..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/brainParc.mha.sha512 +++ /dev/null @@ -1 +0,0 @@ -f6a4fa4eef68fa83a012afa0a947573a45249cf8b13428dc1b5472fb256b1053aa9d9e091510737eb37c38b3b85e1442834c3b88ba02365244652628f88fcb2d diff --git a/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.cid b/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.cid new file mode 100644 index 00000000000..2af739f8455 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.cid @@ -0,0 +1 @@ +bafkreiapyugfzw2syniuvvbn6os7vaobplrr47clelwcwnbygbwcml5wdq diff --git a/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 b/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 deleted file mode 100644 index cc973f75cf7..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/vb-seg.mha.sha512 +++ /dev/null @@ -1 +0,0 @@ -e3f372362fb6fa1ef18cfb09f852e3463febff6ed86a6061e065e2b67a98116d40502e806d971ac53b8bd7d56713bda002245cd78f9338c2e86e150036fa2f24 diff --git a/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.cid new file mode 100644 index 00000000000..85cc0bfb0aa --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.cid @@ -0,0 +1 @@ +bafkreibikb3v5lualk2zu5rodeobslnagtczs3e3ciqycalt7uknmf244y diff --git a/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 deleted file mode 100644 index 5bf91604f80..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/wb-crop.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -0b6dad04a7d2d54c56899a4c620a89f7c83d1713ac55cb4f8327f8a81c93e506b2cf2761c60e54b10c0221b620cc458b6901c158c9070480cfe5dc7d601ee6cb diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.cid new file mode 100644 index 00000000000..b0f9ac362aa --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.cid @@ -0,0 +1 @@ +bafkreiadn23dzqnn7hpeupwbtalhr36cyfrzvljiy3zashwar4bavrvohq diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 deleted file mode 100644 index 2cf0b38edd6..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/wb-seg.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -8b358858e5a31c39ce77ddc387398ae0fbd73669cb5450dbd144bf646b1bf11157d7533d63bfd8d7f5aa6dea32928ab661b51873c208e4ac109a344eb24034f7 diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.cid new file mode 100644 index 00000000000..ae9d5845fc0 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.cid @@ -0,0 +1 @@ +bafkreie25rdxrmj6ogkfdnfr5qfox37befaqpgzubhftsmqv3fvuogqwzy diff --git a/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 deleted file mode 100644 index c5ba205c43e..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/wb-seg32.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -b04d9e9caf63f26ecf3fa2187b70fec5057c74ffde01ef175ce0365dfd5121679926a9639d1495954d53ae30c4ce327595623ba39179f38e2017a5c43556a485 diff --git a/Modules/Filtering/RLEImage/test/Input/ws.nrrd.cid b/Modules/Filtering/RLEImage/test/Input/ws.nrrd.cid new file mode 100644 index 00000000000..938b42c3169 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/Input/ws.nrrd.cid @@ -0,0 +1 @@ +bafkreig26f7jzqumejcr5o4aexda7uj572ozqnpb74zlrjhgzho6ew5dmm diff --git a/Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 b/Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 deleted file mode 100644 index 8132505498d..00000000000 --- a/Modules/Filtering/RLEImage/test/Input/ws.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -67e9f82b93799a2dc7c213a13f0e1653326d80beef4875f781a3d047ef81d712c8b7de70c3514ba8a11e378c12365c3e9faa0e0d8a09fe66c744c39aaacf0d58 From e068d5a2e4e6a6eeddf844d9186f12c95864287f Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Mon, 4 May 2026 16:38:41 -0500 Subject: [PATCH 87/95] STYLE: Apply gersemi 0.19.3 to RLEImage wrapping test CMakeLists --- .../RLEImage/wrapping/test/CMakeLists.txt | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt b/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt index 475cf496ae9..1204796b7e9 100644 --- a/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/wrapping/test/CMakeLists.txt @@ -1,11 +1,20 @@ # test regular image to RLE conversion -itk_python_expression_add_test(NAME itkRegionOfInterestImageFilterISS2RLEImageSS2USPythonTest - EXPRESSION "instance = itk.RegionOfInterestImageFilter.ISS2RLEImageSS2US.New()") +itk_python_expression_add_test( + NAME itkRegionOfInterestImageFilterISS2RLEImageSS2USPythonTest + EXPRESSION + "instance = itk.RegionOfInterestImageFilter.ISS2RLEImageSS2US.New()" +) # test RLE to regular image conversion -itk_python_expression_add_test(NAME itkRegionOfInterestImageFilterRLEImageSS2USISS2PythonTest - EXPRESSION "instance = itk.RegionOfInterestImageFilter.RLEImageSS2USISS2.New()") +itk_python_expression_add_test( + NAME itkRegionOfInterestImageFilterRLEImageSS2USISS2PythonTest + EXPRESSION + "instance = itk.RegionOfInterestImageFilter.RLEImageSS2USISS2.New()" +) # test RLE to RLE (plain RoI operation) -itk_python_expression_add_test(NAME itkRegionOfInterestImageFilterRLEImageSS2USRLEImageSS2USPythonTest - EXPRESSION "instance = itk.RegionOfInterestImageFilter.RLEImageSS2USRLEImageSS2US.New()") +itk_python_expression_add_test( + NAME itkRegionOfInterestImageFilterRLEImageSS2USRLEImageSS2USPythonTest + EXPRESSION + "instance = itk.RegionOfInterestImageFilter.RLEImageSS2USRLEImageSS2US.New()" +) From 1f03dba866275e00beb4778850a99bb02613397f Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Mon, 4 May 2026 16:38:45 -0500 Subject: [PATCH 88/95] DOC: Add RLEImage module README pointing at archived upstream --- Modules/Filtering/RLEImage/README.md | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Modules/Filtering/RLEImage/README.md diff --git a/Modules/Filtering/RLEImage/README.md b/Modules/Filtering/RLEImage/README.md new file mode 100644 index 00000000000..fd0a0d31ec5 --- /dev/null +++ b/Modules/Filtering/RLEImage/README.md @@ -0,0 +1,30 @@ +# RLEImage + +In-tree ITK module providing a run-length-encoded image type for +memory-efficient storage of large label volumes (segmentation masks). +The flagship class `itk::RLEImage` +is a drop-in replacement for `itk::Image` in many label-image +workflows, with iterators and filters that operate directly on the +encoded representation. + +## Origin + +Ingested from the standalone remote module +[**KitwareMedical/ITKRLEImage**](https://github.com/KitwareMedical/ITKRLEImage) +on 2026-05-04 via the v4 ingestion pipeline. The upstream repository +will be archived read-only after this PR merges; it remains +reachable at the URL above for historical reference. + +## Companion module + +`itk::MorphologicalContourInterpolation` (in +`Modules/Filtering/MorphologicalContourInterpolation/`) has an +optional `TEST_DEPENDS` on this module — the +`itkMorphologicalContourInterpolationTestWithRLEImage` test +exercises that integration. + +## References + +- Zukić D., Vicory J., McCormick M., Wisse L., Gerig G., Yushkevich P., + Aylward S. *ND morphological contour interpolation.* The Insight + Journal. 2016. From 6ad310b26fb5127cd1ab8e71a056a7e0db81a01f Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Mon, 4 May 2026 16:38:48 -0500 Subject: [PATCH 89/95] COMP: Remove RLEImage remote-fetch cmake (now in-tree) --- Modules/Remote/RLEImage.remote.cmake | 57 ---------------------------- 1 file changed, 57 deletions(-) delete mode 100644 Modules/Remote/RLEImage.remote.cmake diff --git a/Modules/Remote/RLEImage.remote.cmake b/Modules/Remote/RLEImage.remote.cmake deleted file mode 100644 index e254dffe06f..00000000000 --- a/Modules/Remote/RLEImage.remote.cmake +++ /dev/null @@ -1,57 +0,0 @@ -#-- # Grading Level Criteria Report -#-- EVALUATION DATE: 2020-03-24 -#-- EVALUATORS: [Dženan Zukić] -#-- -#-- ## Compliance level 5 star (AKA ITK main modules, or remote modules that could become core modules) -#-- - [ ] Widespread community dependance -#-- - [ ] Above 90% code coverage -#-- - [ ] CI dashboards and testing monitored rigorously -#-- - [X] Key API features are exposed in wrapping interface -#-- - [ ] All requirements of Levels 4,3,2,1 -#-- -#-- ## Compliance Level 4 star (Very high-quality code, perhaps small community dependance) -#-- - [X] Meets all ITK code style standards -#-- - [X] No external requirements beyond those needed by ITK proper -#-- - [ ] Builds and passes tests on all supported platforms within 1 month of each core tagged release -#-- - [ ] Windows Shared Library Build with Visual Studio -#-- - [ ] Mac with clang compiller -#-- - [ ] Linux with gcc compiler -#-- - [ ] Active developer community dedicated to maintaining code-base -#-- - [ ] 75% code coverage demonstrated for testing suite -#-- - [X] Continuous integration testing performed -#-- - [X] All requirements of Levels 3,2,1 -#-- -#-- ## Compliance Level 3 star (Quality beta code) -#-- - [X] API | executable interface is considered mostly stable and feature complete -#-- - [X] 10% C0-code coverage demonstrated for testing suite -#-- - [X] Some tests exist and pass on at least some platform -#-- - [X] All requirements of Levels 2,1 -#-- -#-- ## Compliance Level 2 star (Alpha code feature API development or niche community/execution environment dependance ) -#-- - [X] Compiles for at least 1 niche set of execution envirionments, and perhaps others -#-- (may depend on specific external tools like a java environment, or specific external libraries to work ) -#-- - [X] All requirements of Levels 1 -#-- -#-- ## Compliance Level 1 star (Pre-alpha features under development and code of unknown quality) -#-- - [X] Code complies on at least 1 platform -#-- -#-- ## Compliance Level 0 star ( Code/Feature of known poor-quality or deprecated status ) -#-- - [ ] Code reviewed and explicitly identified as not recommended for use -#-- -#-- ### Please document here any justification for the criteria above -# Code style enforced by clang-format on 2020-02-19, and clang-tidy modernizations completed - -# Contact: Dženan Zukić -itk_fetch_module( - RLEImage - "Run-length encoded memory compression scheme for an itk::Image. - -Insight Journal article: -https://doi.org/10.54294/t82x76 - -This work is supported by NIH grant R01 EB014346 -'Continued development and maintenance of the ITK-SNAP 3D image segmentation software'." - MODULE_COMPLIANCE_LEVEL 3 - GIT_REPOSITORY https://github.com/KitwareMedical/ITKRLEImage.git - GIT_TAG d7a59ec1bb2edfd55d96cb664b73e7b1e29ed410 - ) From d02473a1243b286913a7a82e9b27cd76bf795b24 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Mon, 4 May 2026 16:38:49 -0500 Subject: [PATCH 90/95] ENH: Enable Module_RLEImage in configure-ci pixi task --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index cf4dc7d016b..9f1dd62bf5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,7 @@ cmd = '''cmake -DModule_SplitComponents:BOOL=ON -DModule_IOMeshMZ3:BOOL=ON -DModule_IOFDF:BOOL=ON + -DModule_RLEImage:BOOL=ON -DITK_COMPUTER_MEMORY_SIZE:STRING=11 -DModule_StructuralSimilarity:BOOL=ON''' description = "Configure ITK for CI (with ccache compiler launcher)" From ea0718057805a99b2b86f586055ef22257e28c74 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Mon, 4 May 2026 17:02:51 -0500 Subject: [PATCH 91/95] BUG: Add CTAD deduction guides for RLEImage iterator specializations C++17 class-template-argument-deduction synthesizes implicit guides only from the primary class template; the partial specializations ImageRegionConstIterator> and ImageRegionIterator< RLEImage<...>> need explicit deduction guides so generic ITK code that calls the unparameterized form ImageRegionConstIterator it(image, region); can be instantiated when image is an RLEImage. Without these guides, the call in itkImageAlgorithm.hxx (and any other CTAD-using ITK core code) fails to compile when downstream code instantiates the algorithm template against an RLEImage type. The same generic call already works for the primary itk::Image case because CTAD synthesizes guides from the primary template's constructors. Surfaced when wiring up MorphologicalContourInterpolation's RLEImage-flavored test which uses itkImageFileWriter.h -> itkImageAlgorithm.hxx with RLEImage instantiations. --- .../RLEImage/include/itkRLEImageRegionConstIterator.h | 10 ++++++++++ .../RLEImage/include/itkRLEImageRegionIterator.h | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h index fbb0deb546a..ed847242ad9 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionConstIterator.h @@ -246,6 +246,16 @@ class ImageRegionConstIteratorWithOnlyIndex::operator=(it); } }; // no additional implementation required + +// CTAD deduction guide. C++17 generates implicit deduction guides only from +// the primary template; the RLEImage partial specialization needs an explicit +// guide so generic code calling `ImageRegionConstIterator it(img, region);` +// (e.g. itkImageAlgorithm.hxx) compiles when img is an RLEImage. +template +ImageRegionConstIterator(const RLEImage *, + const typename RLEImage::RegionType &) + -> ImageRegionConstIterator>; + } // end namespace itk #endif // itkRLEImageRegionConstIterator_h diff --git a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h index 2d29ace886e..d4b84b05651 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImageRegionIterator.h @@ -161,6 +161,14 @@ class ImageRegionIteratorWithIndex::operator=(it); } }; // no additional implementation required + +// CTAD deduction guide. See the matching guide in +// itkRLEImageRegionConstIterator.h for rationale. +template +ImageRegionIterator(RLEImage *, + const typename RLEImage::RegionType &) + -> ImageRegionIterator>; + } // end namespace itk #endif // itkRLEImageRegionIterator_h From 71008a18e937432288d980a6b114db7998e32103 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Tue, 5 May 2026 05:38:11 -0500 Subject: [PATCH 92/95] BUG: Make RLEImage GetBuffer() const return ConstPointer The const overload returned a non-const SmartPointer to m_Buffer, allowing callers holding a const RLEImage to mutate the underlying RLE line buffer. Return BufferType::ConstPointer so the const overload preserves const semantics. --- Modules/Filtering/RLEImage/include/itkRLEImage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/include/itkRLEImage.h b/Modules/Filtering/RLEImage/include/itkRLEImage.h index ee710df2a97..718ff633fac 100644 --- a/Modules/Filtering/RLEImage/include/itkRLEImage.h +++ b/Modules/Filtering/RLEImage/include/itkRLEImage.h @@ -227,7 +227,7 @@ class RLEImage : public itk::ImageBase } /** We need to allow itk-style const iterators to be constructed. */ - typename BufferType::Pointer + typename BufferType::ConstPointer GetBuffer() const { return m_Buffer; From d3978e174777167a69946509b6762865b489724d Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Tue, 5 May 2026 05:38:33 -0500 Subject: [PATCH 93/95] COMP: Drop stray itkRLEImageIteratorWithIndexTest argument The itk_add_test for itkRLEImageIteratorTest passed itkRLEImageIteratorWithIndexTest as a second positional argument. Test drivers forward argv[2..n] to the function named in argv[1]; they do not invoke a second function. The withIndex test still runs via its own registration so coverage is unchanged. --- Modules/Filtering/RLEImage/test/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index d7ff6cbfd64..7258caafaac 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -48,7 +48,6 @@ itk_add_test( COMMAND RLEImageTestDriver itkRLEImageIteratorTest - itkRLEImageIteratorWithIndexTest ) itk_add_test( NAME itkRLEImageIteratorWithIndexTest From 1447f3ac428105c6f3adf3352828178cb0794338 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Tue, 5 May 2026 11:27:21 -0500 Subject: [PATCH 94/95] COMP: Drop dead cmake_minimum_required + standalone wrapper from RLEImage In-tree, ITK_SOURCE_DIR is always defined and ITK's top-level CMakeLists pins the CMake minimum version. The per-module cmake_minimum_required line and if(NOT ITK_SOURCE_DIR) ... else() itk_module_impl() endif() guard are dead code. Pre-emptive cleanup matching the v4 ingest-pipeline rules codified in PR #6204 (sanitize-history.py:patch_drop_cmake_minimum_required and :patch_standalone_build_guard). --- Modules/Filtering/RLEImage/CMakeLists.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Modules/Filtering/RLEImage/CMakeLists.txt b/Modules/Filtering/RLEImage/CMakeLists.txt index 8ce8a9ad9d7..7d96cc88a26 100644 --- a/Modules/Filtering/RLEImage/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/CMakeLists.txt @@ -1,14 +1,7 @@ -cmake_minimum_required(VERSION 3.16.3) project(RLEImage) if(POLICY CMP0135) cmake_policy(SET CMP0135 NEW) endif() -if(NOT ITK_SOURCE_DIR) - find_package(ITK REQUIRED) - list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) - include(ITKModuleExternal) -else() - itk_module_impl() -endif() +itk_module_impl() From 5f48a035737fe282be0ec989f258b070b0ba70cd Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Tue, 5 May 2026 12:22:35 -0500 Subject: [PATCH 95/95] ENH: Test that pins MultiLabelMeshPipeline friend on RLE iterators Add itkRLEImageMultiLabelMeshPipelineFriendTest, an in-tree witness that the `friend class ::MultiLabelMeshPipeline;` grants on itk::ImageConstIterator> and itk::ImageRegionConstIterator> are still in place. The test defines a stub `MultiLabelMeshPipeline` at global scope (the same name and namespace as the friend declarations target) and reads several of the iterator's protected scan-line bookkeeping members (m_Index0 / m_BeginIndex0 / m_EndIndex0 / m_RealIndex / m_SegmentRemainder). If a future cleanup ever removes the friendship the test fails to compile, surfacing the regression at build time. The downstream consumer this protects is ITK-SNAP's MultiLabelMeshPipeline, which uses direct access to those iterator internals for its multi-label surface-extraction performance path. Removing the friendship would silently break that build with no warning from this module's own test suite. --- .../Filtering/RLEImage/test/CMakeLists.txt | 7 ++ ...EImageMultiLabelMeshPipelineFriendTest.cxx | 101 ++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 Modules/Filtering/RLEImage/test/itkRLEImageMultiLabelMeshPipelineFriendTest.cxx diff --git a/Modules/Filtering/RLEImage/test/CMakeLists.txt b/Modules/Filtering/RLEImage/test/CMakeLists.txt index 7258caafaac..4a142680227 100644 --- a/Modules/Filtering/RLEImage/test/CMakeLists.txt +++ b/Modules/Filtering/RLEImage/test/CMakeLists.txt @@ -11,6 +11,7 @@ set( itkRLEImageRegionConstIteratorWithOnlyIndexTest.cxx itkRLEImageRegionIteratorTest.cxx itkRLEImageScanlineIteratorTest1.cxx + itkRLEImageMultiLabelMeshPipelineFriendTest.cxx ) createtestdriver( RLEImage "${RLEImage-Test_LIBRARIES}" "${RLEImageTests}" ) @@ -73,6 +74,12 @@ itk_add_test( RLEImageTestDriver itkRLEImageScanlineIteratorTest1 ) +itk_add_test( + NAME itkRLEImageMultiLabelMeshPipelineFriendTest + COMMAND + RLEImageTestDriver + itkRLEImageMultiLabelMeshPipelineFriendTest +) function(ReadWriteTest ImageName Ext) # optional: big set(outImage "${ITK_TEST_OUTPUT_DIR}/${ImageName}.${Ext}") diff --git a/Modules/Filtering/RLEImage/test/itkRLEImageMultiLabelMeshPipelineFriendTest.cxx b/Modules/Filtering/RLEImage/test/itkRLEImageMultiLabelMeshPipelineFriendTest.cxx new file mode 100644 index 00000000000..416da599087 --- /dev/null +++ b/Modules/Filtering/RLEImage/test/itkRLEImageMultiLabelMeshPipelineFriendTest.cxx @@ -0,0 +1,101 @@ +/*========================================================================= + * + * Copyright NumFOCUS + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +// This test pins the `friend class ::MultiLabelMeshPipeline;` grant +// declared by `itk::ImageConstIterator>` and +// `itk::ImageRegionConstIterator>` (see +// itkRLEImageConstIterator.h and itkRLEImageRegionConstIterator.h). +// +// `MultiLabelMeshPipeline` is the downstream consumer (originally in +// ITK-SNAP) that needs direct access to the iterators' protected +// scan-line bookkeeping (m_Index0 / m_BeginIndex0 / m_EndIndex0 / +// m_RealIndex / m_SegmentRemainder / m_BI) for the multi-label +// surface-extraction pipeline. Removing the friendship would silently +// break that downstream build. This test compiles successfully if and +// only if the friendship is present, so it acts as a build-time gate +// against accidental removal. + +#include "itkRLEImage.h" +#include "itkRLEImageRegionIterator.h" +#include "itkImageRegionIterator.h" + +// MultiLabelMeshPipeline is declared at global scope (matching the +// `friend class ::MultiLabelMeshPipeline;` grants) and reads several +// protected members of the const-iterator. The class is intentionally +// defined here in test scope rather than imported from the downstream +// project; it is the simplest in-tree witness to the friend-access +// contract. +class MultiLabelMeshPipeline +{ +public: + template + static bool + ExerciseProtectedAccess(const TIterator & it) + { + // Access several of the protected scan-line bookkeeping members. + // If the friendship is removed, every line below becomes a + // protected-access compile error. + const auto idx0 = it.m_Index0; + const auto beginIdx0 = it.m_BeginIndex0; + const auto endIdx0 = it.m_EndIndex0; + const auto realIdx = it.m_RealIndex; + const auto segRem = it.m_SegmentRemainder; + const bool inRange = idx0 >= beginIdx0 && idx0 <= endIdx0; + return inRange && (realIdx + segRem) >= 0; + } +}; + +int +itkRLEImageMultiLabelMeshPipelineFriendTest(int, char *[]) +{ + using PixelType = unsigned short; + constexpr unsigned int Dimension = 3; + using ImageType = itk::RLEImage; + using ConstIteratorType = itk::ImageConstIterator; + using RegionConstIteratorType = itk::ImageRegionConstIterator; + + auto image = ImageType::New(); + + ImageType::IndexType idx{}; + ImageType::SizeType size{ { 4, 4, 4 } }; + ImageType::RegionType region{ idx, size }; + + image->SetRegions(region); + image->Allocate(true); + image->FillBuffer(PixelType{ 0 }); + + // Plain ImageConstIterator> path + ConstIteratorType cit(image, region); + cit.GoToBegin(); + if (!MultiLabelMeshPipeline::ExerciseProtectedAccess(cit)) + { + std::cerr << "Friend access via ImageConstIterator returned false.\n"; + return EXIT_FAILURE; + } + + // ImageRegionConstIterator> path (separate friend grant) + RegionConstIteratorType rcit(image, region); + rcit.GoToBegin(); + if (!MultiLabelMeshPipeline::ExerciseProtectedAccess(rcit)) + { + std::cerr << "Friend access via ImageRegionConstIterator returned false.\n"; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +}