Created
May 29, 2014 18:32
-
-
Save agirault/f48d4c6bbad3a34361e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, unsigned int VImageDimension > | |
void VectorImageUtils< T, VImageDimension >::HFieldToDeformationFieldImageFilter(typename DeformationImageType::Pointer itkImage) | |
{ | |
ImageRegionConstIteratorWithIndex<DeformationImageType> it = ImageRegionConstIteratorWithIndex<DeformationImageType>( | |
itkImage, itkImage->GetRequestedRegion()); | |
for(it.GoToBegin();!it.IsAtEnd(); ++it) | |
{ | |
typename DeformationImageType::PixelType displacementValue; | |
typename DeformationImageType::PixelType hFieldValue = it.Get(); | |
typename DeformationImageType::IndexType index = it.GetIndex(); | |
typedef typename DeformationImageType::PixelType::ValueType CoordRepType; | |
const unsigned int Dimension = DeformationImageType::ImageDimension; | |
itk::Point<CoordRepType, Dimension> ipt; | |
itkImage->TransformIndexToPhysicalPoint(index,ipt); | |
displacementValue = hFieldValue - ipt; | |
it.Set(displacementValue); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment