Skip to content

Commit

Permalink
ENH: Deprecate ::Zero and ::One
Browse files Browse the repository at this point in the history
These were deprecated in 2012; just before the ITK 4.2 release.
ZeroValue() and OneValue() should be used instead.
  • Loading branch information
hjmjohnson committed Dec 30, 2014
1 parent fe5a8ef commit 73a6e2d
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion BRAINSCommonLib/itkBOBFFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ BOBFFilter<TInputImage, TOutputImage>
::BOBFFilter() :
m_Lower(NumericTraits<InputPixelType>::NonpositiveMin() ),
m_Upper(NumericTraits<InputPixelType>::max() ),
m_ReplaceValue(NumericTraits<OutputPixelType>::One)
m_ReplaceValue(NumericTraits<OutputPixelType>::OneValue())
{
this->SetNumberOfRequiredInputs(2);
m_Seed.Fill(0);
Expand Down
2 changes: 1 addition & 1 deletion BRAINSCommonLib/itkFindCenterOfBrainFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ FindCenterOfBrainFilter<TInputImage, TMaskImage>
m_ClosingSize(7),
m_HeadSizeLimit(1000),
m_HeadSizeEstimate(0),
m_BackgroundValue(NumericTraits<typename ImageType::PixelType>::Zero),
m_BackgroundValue(NumericTraits<typename ImageType::PixelType>::ZeroValue()),
m_GenerateDebugImages(false),
m_ImageMask(ITK_NULLPTR),
m_ClippedImageMask(ITK_NULLPTR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ MultiModeHistogramThresholdBinaryImageFilter<TInputImage, TOutputImage>
// there are
m_QuantileUpperThreshold(1),
m_LinearQuantileThreshold(0.01),
m_InsideValue(NumericTraits<typename IntegerImageType::PixelType>::One),
m_OutsideValue(NumericTraits<typename IntegerImageType::PixelType>::Zero)
m_InsideValue(NumericTraits<typename IntegerImageType::PixelType>::OneValue()),
m_OutsideValue(NumericTraits<typename IntegerImageType::PixelType>::ZeroValue())
{
m_QuantileLowerThreshold.Fill(0.0);
m_QuantileUpperThreshold.Fill(1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ScalarImagePortionToHistogramGenerator<TImageType, TMaskType>
::SetBinaryPortionImage(const TMaskType *binaryImage)
{
m_ImageToListSampleGenerator->SetMaskImage(binaryImage);
m_ImageToListSampleGenerator->SetMaskValue(NumericTraits<typename TMaskType::PixelType>::One);
m_ImageToListSampleGenerator->SetMaskValue(NumericTraits<typename TMaskType::PixelType>::OneValue());
}

template <class TImageType, class TMaskType>
Expand Down
2 changes: 1 addition & 1 deletion BRAINSCut/BRAINSCutGenerateProbability.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ ::CreateNewFloatImageFromTemplate(WorkingImageType::Pointer & PointerToOutputIma
while( !bbri.IsAtEnd() )
{
// Zeroing voxel signal intensity values
bbri.Set(itk::NumericTraits<WorkingImageType::PixelType>::Zero);
bbri.Set(itk::NumericTraits<WorkingImageType::PixelType>::ZeroValue());
++bbri;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void CreateNewFloatImageFromTemplate(WorkingImageType::Pointer & PointerToOutput
while( !bbri.IsAtEnd() )
{
// Zeroing voxel signal intensity values
bbri.Set(itk::NumericTraits<WorkingImageType::PixelType>::Zero);
bbri.Set(itk::NumericTraits<WorkingImageType::PixelType>::ZeroValue());
++bbri;
}
}
Expand Down
2 changes: 1 addition & 1 deletion BRAINSDemonWarp/DemonsPreprocessor.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DemonsPreprocessor<TInputImage, TOutputImage>
m_MovingBinaryVolume("none"),
m_Lower(NumericTraits<PixelType>::NonpositiveMin() ),
m_Upper(NumericTraits<PixelType>::max() ),
m_DefaultPixelValue(NumericTraits<PixelType>::One),
m_DefaultPixelValue(NumericTraits<PixelType>::OneValue()),
m_OutDebug(false),
m_UseHistogramMatching(0)
{
Expand Down
2 changes: 1 addition & 1 deletion BRAINSDemonWarp/DemonsRegistrator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ DemonsRegistrator<TRealImage, TOutputImage, TFieldValue>::DemonsRegistrator() :
m_FixedImagePyramid(FixedImagePyramidType::New() ),
m_MovingImagePyramid(MovingImagePyramidType::New() ),
m_Registration(RegistrationType::New() ),
m_DefaultPixelValue( NumericTraits<typename RealImageType::PixelType>::Zero),
m_DefaultPixelValue( NumericTraits<typename RealImageType::PixelType>::ZeroValue()),
m_NumberOfLevels(1),
m_NumberOfIterations(UnsignedIntArray(1) ),
m_DisplacementField(ITK_NULLPTR),
Expand Down
2 changes: 1 addition & 1 deletion BRAINSDemonWarp/ThirionRegistration.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ThirionRegistration<TImage, TRealImage, TOutputImage>
m_BOBFTemplateMask("none"),
m_Lower(NumericTraits<PixelType>::NonpositiveMin() ),
m_Upper(NumericTraits<PixelType>::max() ),
m_DefaultPixelValue(NumericTraits<PixelType>::Zero),
m_DefaultPixelValue(NumericTraits<PixelType>::ZeroValue()),
m_NumberOfHistogramLevels(256),
m_NumberOfMatchPoints(2),
m_NumberOfLevels(4)
Expand Down
4 changes: 2 additions & 2 deletions BRAINSResample/itkGridForwardWarpImageFilterNew.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ namespace itk
template <class TDisplacementField, class TOutputImage>
GridForwardWarpImageFilterNew<TDisplacementField, TOutputImage>
::GridForwardWarpImageFilterNew() :
m_BackgroundValue(NumericTraits<PixelType>::Zero),
m_ForegroundValue(NumericTraits<PixelType>::One)
m_BackgroundValue(NumericTraits<PixelType>::ZeroValue()),
m_ForegroundValue(NumericTraits<PixelType>::OneValue())
{
// Setup default values
for( unsigned int q = 0; q < ImageDimension; q++ )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class NaryRelabelImageFilter :

/**
* Set/Get the value used as "background" in the images.
* Defaults to NumericTraits<PixelType>::Zero.
* Defaults to NumericTraits<PixelType>::ZeroValue().
*/
itkSetMacro(BackgroundValue, InputImagePixelType);
itkGetConstMacro(BackgroundValue, InputImagePixelType);
Expand Down
6 changes: 3 additions & 3 deletions BRAINSSurfaceTools/vtkITK/itkDisplacementFieldTransform.txx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ DisplacementFieldTransform<TScalarType, NDimensions>
* of ITK images
*/
this->m_Jacobian.set_size( SpaceDimension, numberOfParameters );
this->m_Jacobian.Fill( NumericTraits<JacobianInternalPixelType>::Zero );
this->m_Jacobian.Fill( NumericTraits<JacobianInternalPixelType>::ZeroValue() );
SizeType size;
size.Fill( 1 );
m_LastSupportRegion.SetSize( size );
Expand Down Expand Up @@ -486,7 +486,7 @@ DisplacementFieldTransform<TScalarType, NDimensions>
return transformedPoint;
}

outputPoint.Fill( NumericTraits<ScalarType>::Zero );
outputPoint.Fill( NumericTraits<ScalarType>::ZeroValue() );

OutputVectorType displacement = LinearInterpolateAtIndex( index );
for ( j = 0; j < SpaceDimension; j++ )
Expand Down Expand Up @@ -524,7 +524,7 @@ DisplacementFieldTransform<TScalarType, NDimensions>
p0.SetSize( SpaceDimension );
for ( j = 0; j < SpaceDimension; j++ )
{
p0[j] = NumericTraits<JacobianInternalPixelType>::Zero;
p0[j] = NumericTraits<JacobianInternalPixelType>::ZeroValue();
}

for ( j = 0; j < SpaceDimension; j++ )
Expand Down
10 changes: 5 additions & 5 deletions BRAINSSurfaceTools/vtkITK/itkLevelTracingImageFilter.txx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ LevelTracingImageFilter<TInputImage,TOutputImage>
OutputImageRegionType regionOut = outputImage->GetRequestedRegion();
outputImage->SetBufferedRegion( regionOut );
outputImage->Allocate();
outputImage->FillBuffer ( NumericTraits<OutputImagePixelType>::Zero );
outputImage->FillBuffer ( NumericTraits<OutputImagePixelType>::ZeroValue() );

outputPath->Initialize();

Expand Down Expand Up @@ -397,7 +397,7 @@ LevelTracingImageFilter<TInputImage,TOutputImage>

// Now we have the seed and the starting neighbor
outputPath->SetStart(seed);
outputImage->SetPixel(pix, NumericTraits<OutputImagePixelType>::One);
outputImage->SetPixel(pix, NumericTraits<OutputImagePixelType>::OneValue());
do
{
for(int s = 0; s<8; s++)
Expand All @@ -413,7 +413,7 @@ LevelTracingImageFilter<TInputImage,TOutputImage>
{
//condition is satisfied, label the output image and output path
outputImage->SetPixel(pixTemp,
NumericTraits<OutputImagePixelType>::One);
NumericTraits<OutputImagePixelType>::OneValue());
offset[0]=offsetX;
offset[1]=offsetY;
outputPath->InsertStep(noOfPixels, offset);
Expand Down Expand Up @@ -459,7 +459,7 @@ LevelTracingImageFilter<TInputImage,TOutputImage>
OutputImageRegionType region = outputImage->GetRequestedRegion();
outputImage->SetBufferedRegion( region );
outputImage->Allocate();
outputImage->FillBuffer ( NumericTraits<OutputImagePixelType>::Zero );
outputImage->FillBuffer ( NumericTraits<OutputImagePixelType>::ZeroValue() );

typedef LevelTracingImageFunction<InputImageType, double> FunctionType;
typedef FloodFilledImageFunctionConditionalIterator<OutputImageType, FunctionType> IteratorType;
Expand All @@ -475,7 +475,7 @@ LevelTracingImageFilter<TInputImage,TOutputImage>

while( !it.IsAtEnd())
{
it.Set(NumericTraits<OutputImagePixelType>::One);
it.Set(NumericTraits<OutputImagePixelType>::OneValue());
++it;
progress.CompletedPixel(); // potential exception thrown here
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ NewOtsuThresholdImageCalculator<TInputImage>
::NewOtsuThresholdImageCalculator()
{
m_Image = ITK_NULLPTR;
m_Threshold = NumericTraits<PixelType>::Zero;
m_Threshold = NumericTraits<PixelType>::ZeroValue();
m_NumberOfHistogramBins = 128;
m_Omega = 2;
}
Expand Down
2 changes: 1 addition & 1 deletion BRAINSSurfaceTools/vtkITK/itkNewOtsuThresholdImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class NewOtsuThresholdImageFilter :
TOutputImage::ImageDimension ) ;

/** Set the "outside" pixel value. The default value
* NumericTraits<OutputPixelType>::Zero. */
* NumericTraits<OutputPixelType>::ZeroValue(). */
itkSetMacro(OutsideValue,OutputPixelType);

/** Get the "outside" pixel value. */
Expand Down
4 changes: 2 additions & 2 deletions BRAINSSurfaceTools/vtkITK/itkNewOtsuThresholdImageFilter.txx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ template<class TInputImage, class TOutputImage>
NewOtsuThresholdImageFilter<TInputImage, TOutputImage>
::NewOtsuThresholdImageFilter()
{
m_OutsideValue = NumericTraits<OutputPixelType>::Zero;
m_OutsideValue = NumericTraits<OutputPixelType>::ZeroValue();
m_InsideValue = NumericTraits<OutputPixelType>::max();
m_Threshold = NumericTraits<InputPixelType>::Zero;
m_Threshold = NumericTraits<InputPixelType>::ZeroValue();
m_NumberOfHistogramBins = 128;
m_Omega = 2;
}
Expand Down
8 changes: 4 additions & 4 deletions BRAINSSurfaceTools/vtkITK/vtkITKNumericTraits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ namespace itk
{

#if defined(VTK_TYPE_USE___INT64)
const __int64 NumericTraits<__int64>::Zero = 0;
const __int64 NumericTraits<__int64>::One = 1;
const __int64 NumericTraits<__int64>::ZeroValue() = 0;
const __int64 NumericTraits<__int64>::OneValue() = 1;

const unsigned __int64 NumericTraits<unsigned __int64>::Zero = 0ui64;
const unsigned __int64 NumericTraits<unsigned __int64>::One = 1ui64;
const unsigned __int64 NumericTraits<unsigned __int64>::ZeroValue() = 0ui64;
const unsigned __int64 NumericTraits<unsigned __int64>::OneValue() = 1ui64;
#endif

};

0 comments on commit 73a6e2d

Please sign in to comment.