ITK  5.2.0
Insight Toolkit
SphinxExamples/src/Core/ImageFunction/LinearlyInterpolatePositionInImage/Code.cxx
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#include "itkImage.h"
using ImageType = itk::Image<unsigned char, 1>;
static void
CreateImage(ImageType::Pointer image);
int
main(int, char *[])
{
ImageType::Pointer image = ImageType::New();
CreateImage(image);
pixel[0] = 1.3;
interpolator->SetInputImage(image);
std::cout << "Value at 1.3: " << interpolator->EvaluateAtContinuousIndex(pixel) << std::endl;
return EXIT_SUCCESS;
}
void
CreateImage(ImageType::Pointer image)
{
// Create a 1D image
start[0] = 0;
size[0] = 10;
region.SetSize(size);
region.SetIndex(start);
image->SetRegions(region);
image->Allocate();
for (unsigned int i = 0; i < 10; i++)
{
pixelIndex[0] = i;
image->SetPixel(pixelIndex, i * 10);
}
}
itkContinuousIndex.h
itkLinearInterpolateImageFunction.h
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkImage.h
itk::SmartPointer< Self >
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::Size::SetSize
void SetSize(const SizeValueType val[VDimension])
Definition: itkSize.h:179
itk::ContinuousIndex
A templated class holding a point in n-Dimensional image space.
Definition: itkContinuousIndex.h:46
itk::LinearInterpolateImageFunction::New
static Pointer New()
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86