Skip to content
Snippets Groups Projects
Commit 8a740f60 authored by Julien Michel's avatar Julien Michel
Browse files

ENH: Patching ITK to allow seamless interpolation of VectorImage

parent df6928d1
No related branches found
No related tags found
No related merge requests found
......@@ -223,8 +223,8 @@ public:
(Concept::SameDimension<ImageDimension, InputImageDimension>));
itkConceptMacro(SameDimensionCheck2,
(Concept::SameDimension<ImageDimension, DeformationFieldDimension>));
itkConceptMacro(InputHasNumericTraitsCheck,
(Concept::HasNumericTraits<typename TInputImage::PixelType>));
/** itkConceptMacro(InputHasNumericTraitsCheck,
(Concept::HasNumericTraits<typename TInputImage::PixelType>));*/
itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
(Concept::HasNumericTraits<typename TDeformationField::PixelType::ValueType>));
/** End concept checking */
......
......@@ -26,6 +26,7 @@
#include "vnl/vnl_math.h"
#include "itkVariableLengthVector.h"
#include "itkPixelBuilder.h"
namespace itk
{
......@@ -45,7 +46,7 @@ WarpImageFilter<TInputImage,TOutputImage,TDeformationField>
m_OutputOrigin.Fill( 0.0 );
m_OutputDirection.SetIdentity();
m_OutputSize.Fill(0);
m_EdgePaddingValue = NumericTraits<PixelType>::Zero;
PixelBuilder<PixelType>::Zero(m_EdgePaddingValue,1);
m_OutputStartIndex.Fill(0);
// Setup default interpolator
typename DefaultInterpolatorType::Pointer interp =
......
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkPixelBuilder.h,v $
Language: C++
Date: $Date: 2010-04-05 18:05:48 $
Version: $Revision: 1.65 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkPixelBuilder_h
#define __itkPixelBuilder_h
#include "itkVariableLengthVector.h"
namespace itk
{
/** \class PixelBuilder
*
* \ingroup DataRepresentation
*/
template <typename T>
class PixelBuilder
{
public:
// Default implementation
static void Zero( T & pixel,unsigned int)
{
pixel = itk::NumericTraits<T>::Zero;
}
static void RefZero( T & pixel,const T &)
{
pixel = itk::NumericTraits<T>::Zero;
}
};
// Partial specialisation for VariableLengthVector
template <typename T>
class PixelBuilder< VariableLengthVector<T> >
{
public:
static void Zero(VariableLengthVector<T>& pixel, unsigned int nbComp)
{
pixel.SetSize(nbComp,true);
pixel.Fill(itk::NumericTraits<T>::Zero);
}
static void RefZero(VariableLengthVector<T>& pixel, const VariableLengthVector<T>& refPixel )
{
pixel.SetSize(refPixel.Size(),true);
pixel.Fill(itk::NumericTraits<T>::Zero);
}
};
} // End namespace itk
#endif // __itkPixelBuilder_h
......@@ -18,7 +18,7 @@
#define __itkOptLinearInterpolateImageFunction_txx
#include "itkOptLinearInterpolateImageFunction.h"
#include "itkPixelBuilder.h"
#include "vnl/vnl_math.h"
namespace itk
......@@ -89,7 +89,8 @@ LinearInterpolateImageFunction< TInputImage, TCoordRep >
* neighbors. The weight for each neighbor is the fraction overlap
* of the neighbor pixel with respect to a pixel centered on point.
*/
RealType value = NumericTraits<RealType>::Zero;
RealType value;
PixelBuilder<RealType>::Zero(value,this->GetInputImage()->GetNumberOfComponentsPerPixel());
typedef typename NumericTraits<InputPixelType>::ScalarRealType ScalarRealType;
ScalarRealType totalOverlap = NumericTraits<ScalarRealType>::Zero;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment