Skip to content

Instantly share code, notes, and snippets.

@iMichka
Created January 25, 2014 17:26
Show Gist options
  • Select an option

  • Save iMichka/8620027 to your computer and use it in GitHub Desktop.

Select an option

Save iMichka/8620027 to your computer and use it in GitHub Desktop.
diff --git a/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h b/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h
index 7cfedf9..f7ce7e4 100644
--- a/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h
+++ b/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h
@@ -510,7 +510,7 @@ class LinearInterpolateImageFunction:
const typename TInputImage::PixelType & tempPixel = inputImagePtr->GetPixel(idx);
const unsigned int sizeOfVarLengthVector = tempPixel.GetSize();
tempZeros.SetSize(sizeOfVarLengthVector);
- tempZeros.Fill(NumericTraits< RealTypeScalarRealType >::Zero);
+ tempZeros.Fill(NumericTraits< RealTypeScalarRealType >::ZeroValue());
}
template<typename RealTypeScalarRealType>
@@ -519,7 +519,7 @@ class LinearInterpolateImageFunction:
RealTypeScalarRealType & tempZeros) const
{
// All other cases
- tempZeros = NumericTraits< RealTypeScalarRealType >::Zero;
+ tempZeros = NumericTraits< RealTypeScalarRealType >::ZeroValue();
}
};
diff --git a/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx
index 4cc6436..033d723 100644
--- a/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx
+++ b/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx
@@ -31,7 +31,7 @@ template< typename TInputImage, typename TOutputImage >
ConstantPadImageFilter< TInputImage, TOutputImage >
::ConstantPadImageFilter()
{
- m_InternalBoundaryCondition.SetConstant( NumericTraits< OutputImagePixelType >::Zero );
+ m_InternalBoundaryCondition.SetConstant( NumericTraits< OutputImagePixelType >::ZeroValue() );
this->InternalSetBoundaryCondition( &m_InternalBoundaryCondition );
}
diff --git a/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h b/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h
index 20d6296..9d114c6 100644
--- a/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h
+++ b/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h
@@ -93,7 +93,7 @@ class MaskInput
template < typename TPixelType >
void InitializeOutsideValue( TPixelType * )
{
- this->m_OutsideValue = NumericTraits< TPixelType >::Zero;
+ this->m_OutsideValue = NumericTraits< TPixelType >::ZeroValue();
}
template < typename TValue >
@@ -262,12 +262,12 @@ class MaskImageFilter:
VariableLengthVector< TValue > currentValue =
this->GetFunctor().GetOutsideValue();
VariableLengthVector< TValue > zeroVector( currentValue.GetSize() );
- zeroVector.Fill( NumericTraits< TValue >::Zero );
+ zeroVector.Fill( NumericTraits< TValue >::ZeroValue() );
if ( currentValue == zeroVector )
{
zeroVector.SetSize( this->GetOutput()->GetVectorLength() );
- zeroVector.Fill( NumericTraits< TValue >::Zero );
+ zeroVector.Fill( NumericTraits< TValue >::ZeroValue() );
this->GetFunctor().SetOutsideValue( zeroVector );
}
else if ( this->GetFunctor().GetOutsideValue().GetSize() !=
diff --git a/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h b/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h
index c39d702..ca45378 100644
--- a/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h
+++ b/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h
@@ -37,7 +37,7 @@ class MaskNegatedInput
typedef typename NumericTraits< TInput >::AccumulateType AccumulatorType;
MaskNegatedInput()
- : m_OutsideValue(NumericTraits< TOutput >::Zero)
+ : m_OutsideValue(NumericTraits< TOutput >::ZeroValue())
, m_MaskingValue(NumericTraits< TMask >::ZeroValue())
{
}
diff --git a/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx b/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx
index a419659..053068a 100644
--- a/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx
+++ b/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx
@@ -37,7 +37,7 @@ ConnectedComponentFunctorImageFilter< TInputImage, TOutputImage, TFunctor, TMask
InputPixelType value, neighborValue;
OutputPixelType label, originalLabel, neighborLabel;
- OutputPixelType maxLabel = NumericTraits< OutputPixelType >::Zero;
+ OutputPixelType maxLabel = NumericTraits< OutputPixelType >::ZeroValue();
const OutputPixelType maxPossibleLabel = NumericTraits< OutputPixelType >::max();
typename TOutputImage::Pointer output = this->GetOutput();
@@ -49,7 +49,7 @@ ConnectedComponentFunctorImageFilter< TInputImage, TOutputImage, TFunctor, TMask
// Set up the boundary condition to be zero padded (used on output image)
ConstantBoundaryCondition< TOutputImage > BC;
- BC.SetConstant(NumericTraits< OutputPixelType >::Zero);
+ BC.SetConstant(NumericTraits< OutputPixelType >::ZeroValue());
// Neighborhood iterators. Let's use a shaped neighborhood so we can
// restrict the access to face connected neighbors. These iterators
@@ -119,10 +119,10 @@ ConnectedComponentFunctorImageFilter< TInputImage, TOutputImage, TFunctor, TMask
oit.GoToBegin();
while ( !mit.IsAtEnd() )
{
- if ( mit.Get() == NumericTraits< MaskPixelType >::Zero )
+ if ( mit.Get() == NumericTraits< MaskPixelType >::ZeroValue() )
{
// mark pixel as unlabeled
- oit.Set(NumericTraits< OutputPixelType >::Zero);
+ oit.Set(NumericTraits< OutputPixelType >::ZeroValue());
}
++mit;
@@ -146,7 +146,7 @@ ConnectedComponentFunctorImageFilter< TInputImage, TOutputImage, TFunctor, TMask
originalLabel = label;
// If the pixel is not background
- if ( label != NumericTraits< OutputPixelType >::Zero )
+ if ( label != NumericTraits< OutputPixelType >::ZeroValue() )
{
// loop over the "previous" neighbors to find labels. this loop
// may establish one or more new equivalence classes
@@ -160,7 +160,7 @@ ConnectedComponentFunctorImageFilter< TInputImage, TOutputImage, TFunctor, TMask
// if the previous pixel has a label, verify equivalence or
// establish a new equivalence
- if ( neighborLabel != NumericTraits< OutputPixelType >::Zero )
+ if ( neighborLabel != NumericTraits< OutputPixelType >::ZeroValue() )
{
// see if current pixel is connected to its neighbor
neighborValue = isIt.Get();
@@ -228,7 +228,7 @@ ConnectedComponentFunctorImageFilter< TInputImage, TOutputImage, TFunctor, TMask
{
label = oit.Get();
// if pixel has a label, write out the final equivalence
- if ( label != NumericTraits< OutputPixelType >::Zero )
+ if ( label != NumericTraits< OutputPixelType >::ZeroValue() )
{
oit.Set( eqTable->Lookup(label) );
}
diff --git a/Modules/Segmentation/ConnectedComponents/include/itkVectorConnectedComponentImageFilter.h b/Modules/Segmentation/ConnectedComponents/include/itkVectorConnectedComponentImageFilter.h
index de85cf5..f45309f 100644
--- a/Modules/Segmentation/ConnectedComponents/include/itkVectorConnectedComponentImageFilter.h
+++ b/Modules/Segmentation/ConnectedComponents/include/itkVectorConnectedComponentImageFilter.h
@@ -51,7 +51,7 @@ class SimilarVectorsFunctor
{
public:
SimilarVectorsFunctor()
- { m_Threshold = itk::NumericTraits< typename TInput::ValueType >::Zero; }
+ { m_Threshold = itk::NumericTraits< typename TInput::ValueType >::ZeroValue(); }
~SimilarVectorsFunctor() {}
@@ -72,7 +72,7 @@ class SimilarVectorsFunctor
bool operator()(const TInput & a, const TInput & b) const
{
typedef typename NumericTraits<typename TInput::ValueType>::RealType RealValueType;
- RealValueType dotProduct = NumericTraits<RealValueType>::Zero;
+ RealValueType dotProduct = NumericTraits<RealValueType>::ZeroValue();
for ( unsigned int i = 0; i < NumericTraits<TInput>::GetLength(a); ++i)
{
dotProduct += a[i]*b[i];
diff --git a/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx b/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx
index dedaa7d..fecd231 100644
--- a/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx
+++ b/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx
@@ -38,8 +38,8 @@ NormalVectorDiffusionFunction< TSparseImageType >
this->SetRadius(r);
this->SetTimeStep( static_cast< TimeStepType >( 0.5 / ImageDimension ) );
m_NormalProcessType = 0;
- m_ConductanceParameter = NumericTraits< NodeValueType >::Zero;
- m_FluxStopConstant = NumericTraits< NodeValueType >::Zero;
+ m_ConductanceParameter = NumericTraits< NodeValueType >::ZeroValue();
+ m_FluxStopConstant = NumericTraits< NodeValueType >::ZeroValue();
}
template< typename TSparseImageType >
@@ -88,7 +88,7 @@ NormalVectorDiffusionFunction< TSparseImageType >
{
for ( j = 0; j < ImageDimension; j++ )
{
- CenterNode->m_Flux[i][j] = NumericTraits< NodeValueType >::Zero;
+ CenterNode->m_Flux[i][j] = NumericTraits< NodeValueType >::ZeroValue();
}
}
else
@@ -151,7 +151,7 @@ NormalVectorDiffusionFunction< TSparseImageType >
// now compute the intrinsic derivative
for ( j = 0; j < ImageDimension; j++ ) // component axis
{
- DotProduct = NumericTraits< NodeValueType >::Zero;
+ DotProduct = NumericTraits< NodeValueType >::ZeroValue();
for ( k = 0; k < ImageDimension; k++ ) // derivative axis
{
DotProduct += ( gradient[k][j] * CenterNode->m_ManifoldNormal[i][k] );
@@ -190,7 +190,7 @@ NormalVectorDiffusionFunction< TSparseImageType >
const NeighborhoodScalesType neighborhoodScales = this->ComputeNeighborhoodScales();
- change = NumericTraits< NormalVectorType >::Zero;
+ change = NumericTraits< NormalVectorType >::ZeroValue();
for ( i = 0; i < ImageDimension; i++ ) // flux offset axis
{
NextNode = it.GetNext (i);
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment