Skip to content

Commit

Permalink
Merge topic 'VerifyInputInformationAsConst'
Browse files Browse the repository at this point in the history
16eae15 ENH: Make ProcessObject::VerifyInputInformation constant
  • Loading branch information
blowekamp authored and kwrobot committed Oct 25, 2018
2 parents e275ffd + 16eae15 commit 3a6158a
Show file tree
Hide file tree
Showing 30 changed files with 37 additions and 35 deletions.
6 changes: 4 additions & 2 deletions Documentation/ITK5MigrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ Otsu filters now return correct threshold (bin's maximum value instead of mid-po
To keep old behavior, use `filter->SetReturnBinMidpoint( true );`.
This change should be relevant only in tests.

With ITK 5.0, `itk::ProcessObject::VerifyPreconditions()` is declared `const`, so if
you have overridden this virtual member function, make sure that you also add `const`.
With ITK 5.0, `itk::ProcessObject::VerifyPreconditions()` and
`itk::ProcessObject::VerifyInputInformation` are now declared `const`,
so if you have overridden these virtual member function, make sure that you
also add `const`.

Update scripts
--------------
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkImageToImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class ITK_TEMPLATE_EXPORT ImageToImageFilter:public ImageSource< TOutputImage >,
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override;
void VerifyInputInformation() const override;

/** What is the input requested region that is required to produce
* the output requested region? The base assumption for image
Expand Down
10 changes: 5 additions & 5 deletions Modules/Core/Common/include/itkImageToImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#define itkImageToImageFilter_hxx
#include "itkImageToImageFilter.h"
#include "itkInputDataObjectIterator.h"
#include "itkInputDataObjectConstIterator.h"

#include <cmath>

Expand Down Expand Up @@ -164,13 +165,13 @@ ImageToImageFilter< TInputImage, TOutputImage >
template< typename TInputImage, typename TOutputImage >
void
ImageToImageFilter< TInputImage, TOutputImage >
::VerifyInputInformation()
::VerifyInputInformation() const
{

using ImageBaseType = ImageBase< InputImageDimension >;
using ImageBaseType = const ImageBase< InputImageDimension >;

ImageBaseType *inputPtr1 = nullptr;
InputDataObjectIterator it(this);
InputDataObjectConstIterator it(this);

for(; !it.IsAtEnd(); ++it )
{
Expand All @@ -187,8 +188,7 @@ ImageToImageFilter< TInputImage, TOutputImage >
}
}


for (; !it.IsAtEnd(); ++it )
for (; !it.IsAtEnd(); ++it )
{
auto * inputPtrN = dynamic_cast< ImageBaseType * >( it.GetInput() );

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkProcessObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ class ITKCommon_EXPORT ProcessObject:public Object
* check if all the inputs are in the same coordinate frame.
*
*/
virtual void VerifyInputInformation();
virtual void VerifyInputInformation() const;

/** What is the input requested region that is required to produce the
* output requested region? By default, the largest possible region is
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/src/itkProcessObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ ::VerifyPreconditions() const

void
ProcessObject
::VerifyInputInformation()
::VerifyInputInformation() const
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class ITK_TEMPLATE_EXPORT ComparisonImageFilter:

void AfterThreadedGenerateData() override;

void VerifyInputInformation() override;
void VerifyInputInformation() const override;

OutputPixelType m_DifferenceThreshold;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ ComparisonImageFilter< TInputImage, TOutputImage >
template< typename TInputImage, typename TOutputImage >
void
ComparisonImageFilter< TInputImage, TOutputImage >
::VerifyInputInformation()
::VerifyInputInformation() const
{
if(m_VerifyInputInformation)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class ITK_TEMPLATE_EXPORT ConvolutionImageFilterBase :

/** Default superclass implementation ensures that input images
* occupy same physical space. This is not needed for this filter. */
void VerifyInputInformation() override {};
void VerifyInputInformation() const override {};

private:
bool m_Normalize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class ITK_TEMPLATE_EXPORT MaskedFFTNormalizedCorrelationImageFilter :
void PrintSelf(std::ostream& os, Indent indent) const override;

/** Overlap the VerifyInputInformation method */
void VerifyInputInformation() override;
void VerifyInputInformation() const override;

/** Standard pipeline method.*/
void GenerateData() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ MaskedFFTNormalizedCorrelationImageFilter<TInputImage, TOutputImage, TMaskImage>
template< typename TInputImage, typename TOutputImage, typename TMaskImage >
void
MaskedFFTNormalizedCorrelationImageFilter<TInputImage, TOutputImage, TMaskImage>
::VerifyInputInformation()
::VerifyInputInformation() const
{
// Call the superclass' implementation of this method.
Superclass::VerifyInputInformation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ITK_TEMPLATE_EXPORT JoinSeriesImageFilter:
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override;
void VerifyInputInformation() const override;

/** Overrides GenerateOutputInformation() in order to produce
* an image which has a different information than the first input.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ JoinSeriesImageFilter< TInputImage, TOutputImage >
template< typename TInputImage, typename TOutputImage >
void
JoinSeriesImageFilter< TInputImage, TOutputImage >
::VerifyInputInformation()
::VerifyInputInformation() const
{

Superclass::VerifyInputInformation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class ITK_TEMPLATE_EXPORT ChangeInformationImageFilter:
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override {}
void VerifyInputInformation() const override {}

private:
InputImagePointer m_ReferenceImage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class ITK_TEMPLATE_EXPORT InterpolateImagePointsFilter:
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override {}
void VerifyInputInformation() const override {}

private:

Expand Down
2 changes: 1 addition & 1 deletion Modules/Filtering/ImageGrid/include/itkPasteImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class ITK_TEMPLATE_EXPORT PasteImageFilter:
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override {}
void VerifyInputInformation() const override {}

protected:
PasteImageFilter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class ITK_TEMPLATE_EXPORT ResampleImageFilter :
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override { }
void VerifyInputInformation() const override { }

/** ResampleImageFilter can be implemented as a multithreaded filter.
* Therefore, this implementation provides a DynamicThreadedGenerateData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class ITK_TEMPLATE_EXPORT SliceBySliceImageFilter:
SliceBySliceImageFilter();
~SliceBySliceImageFilter() override = default;

void VerifyInputInformation() override;
void VerifyInputInformation() const override;

void GenerateData() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ template< typename TInputImage, typename TOutputImage, typename TInputFilter, ty
void
SliceBySliceImageFilter< TInputImage, TOutputImage, TInputFilter, TOutputFilter, TInternalInputImageType,
TInternalOutputImageType >
::VerifyInputInformation()
::VerifyInputInformation() const
{

Superclass::VerifyInputInformation();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Filtering/ImageGrid/include/itkSliceImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class ITK_TEMPLATE_EXPORT SliceImageFilter:
void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;


void VerifyInputInformation() override;
void VerifyInputInformation() const override;

private:
IndexType m_Start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ SliceImageFilter< TInputImage, TOutputImage >
template< class TInputImage, class TOutputImage >
void
SliceImageFilter< TInputImage, TOutputImage >
::VerifyInputInformation()
::VerifyInputInformation() const
{

Superclass::VerifyInputInformation();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Filtering/ImageGrid/include/itkTileImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class ITK_TEMPLATE_EXPORT TileImageFilter:
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override;
void VerifyInputInformation() const override;

private:
typename TileImageType::Pointer m_TileImage;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ TileImageFilter< TInputImage, TOutputImage >
template< typename TInputImage, typename TOutputImage >
void
TileImageFilter< TInputImage, TOutputImage >
::VerifyInputInformation()
::VerifyInputInformation() const
{

// Do not call superclass's VerifyInputInformation method.
Expand Down
2 changes: 1 addition & 1 deletion Modules/Filtering/ImageGrid/include/itkWarpImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class ITK_TEMPLATE_EXPORT WarpImageFilter:
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override;
void VerifyInputInformation() const override;

/** This function should be in an interpolator but none of the ITK
* interpolators at this point handle edge conditions properly
Expand Down
2 changes: 1 addition & 1 deletion Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ WarpImageFilter< TInputImage, TOutputImage, TDisplacementField >
template< typename TInputImage, typename TOutputImage, typename TDisplacementField >
void
WarpImageFilter< TInputImage, TOutputImage, TDisplacementField >
::VerifyInputInformation()
::VerifyInputInformation() const
{
if (ImageDimension != GetDisplacementField()->GetNumberOfComponentsPerPixel())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class ITK_TEMPLATE_EXPORT HistogramMatchingImageFilter:
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override {}
void VerifyInputInformation() const override {}

/** Compute min, max and mean of an image. */
void ComputeMinMaxMean(const InputImageType *image,
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/TIFF/src/itkTIFFImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ bool TIFFImageIO::CanWriteFile(const char *name)
return false;
}

return this->HasSupportedWriteExtension(name);
return this->HasSupportedWriteExtension(name, false);
}

void TIFFImageIO::WriteImageInformation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ITK_TEMPLATE_EXPORT DemonsRegistrationFilter:
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override {}
void VerifyInputInformation() const override {}

private:
bool m_UseMovingImageGradient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class ITK_TEMPLATE_EXPORT MultiResolutionPDEDeformableRegistration:
*
* \sa ProcessObject::VerifyInputInformation
*/
void VerifyInputInformation() override {}
void VerifyInputInformation() const override {}

private:
RegistrationPointer m_RegistrationFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class ITK_TEMPLATE_EXPORT IsolatedWatershedImageFilter:
// Override since the filter produces the entire dataset
void EnlargeOutputRequestedRegion(DataObject *output) override;

void VerifyInputInformation() override;
void VerifyInputInformation() const override;
void GenerateData() override;
};
} // end namespace itk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ IsolatedWatershedImageFilter< TInputImage, TOutputImage >
template< typename TInputImage, typename TOutputImage >
void
IsolatedWatershedImageFilter< TInputImage, TOutputImage >
::VerifyInputInformation()
::VerifyInputInformation() const
{
Superclass::VerifyInputInformation();

Expand Down

0 comments on commit 3a6158a

Please sign in to comment.