Skip to content

Studio/src/Data/StudioMesh.h

Namespaces

Name
shapeworks

Classes

Name
class shapeworks::StudioMesh
Representation of a single mesh.

Types

Name
using float PixelType
using itk::Image< PixelType, 3 > ImageType

Types Documentation

using PixelType

using PixelType =  float;

using ImageType

using ImageType =  itk::Image<PixelType, 3>;

Source code

#pragma once

#include <itkImage.h>
#include <vnl/vnl_vector.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <vtkTransform.h>

#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <QSharedPointer>
#include <QString>

using PixelType = float;
using ImageType = itk::Image<PixelType, 3>;
class vtkFloatArray;
class vtkStaticPointLocator;

namespace shapeworks {

class StudioMesh;
using MeshHandle = std::shared_ptr<StudioMesh>;
using MeshList = std::vector<MeshHandle>;


class StudioMesh {
 public:
  StudioMesh();

  ~StudioMesh();

  QString get_dimension_string();

  vtkSmartPointer<vtkPolyData> get_poly_data();

  vnl_vector<double> get_center_transform();

  void set_poly_data(vtkSmartPointer<vtkPolyData> poly_data);

  void set_error_message(std::string error_message);

  std::string get_error_message();

  void apply_feature_map(std::string name, ImageType::Pointer image);

  void apply_scalars(MeshHandle mesh);

  void interpolate_scalars_to_mesh(std::string name, Eigen::VectorXd positions, Eigen::VectorXf scalar_values);

  double get_largest_dimension_size();

  vtkFloatArray* get_or_create_array(std::string name, float default_value);

  void paint_ffc(double world_pos[], double radius, bool inclusive);

  bool has_ffc_paint();

  static constexpr const char* const FFC_PAINT = "ffc_paint";

 private:
  // metadata
  int dimensions_[3];
  vnl_vector<double> center_transform_;

  // the polydata
  vtkSmartPointer<vtkPolyData> poly_data_;

  vtkSmartPointer<vtkStaticPointLocator> locator_;

  // error message if the polydata didn't load
  std::string error_message_;
};
}  // namespace shapeworks

Updated on 2022-07-23 at 17:50:05 -0600