Skip to content

Libs/Image/VectorImage.h

Namespaces

Name
shapeworks

Classes

Name
class shapeworks::VectorImage
Image composed of vectors instead of just scalars.

Source code

#pragma once

#include "Image.h"

#include <itkVectorLinearInterpolateImageFunction.h>
#include <itkGradientImageFilter.h>

namespace shapeworks {

//
// TODO: generalize Image class instead of this:
//       https://github.com/SCIInstitute/ShapeWorks/issues/1053
class VectorImage
{
public:

  using GradientImageFilter = itk::GradientImageFilter<Image::ImageType>;
  using ImageType = GradientImageFilter::OutputImageType;
  using GradientInterpolator = itk::VectorLinearInterpolateImageFunction<
    ImageType, typename Image::PixelType>;

  VectorImage(const Image& dt_img);
  VectorImage() = delete;
  ~VectorImage() = default;

  Vector evaluate(Point p) { return toVector(interpolator->Evaluate(p)); }

private:
  itk::SmartPointer<ImageType> image;
  itk::SmartPointer<GradientInterpolator> interpolator;
};

} // shapeworks

Updated on 2022-03-31 at 09:51:19 -0600