CustusX  22.04-rc5
An IGT application
cxSyntheticVolume.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef SYNTHETIC_VOLUME_HPP
13 #define SYNTHETIC_VOLUME_HPP
14 
15 #include "cxtestutilities_export.h"
16 
17 #include "cxUSFrameData.h"
18 #include <vector>
19 #include <cstdlib>
20 #include <time.h>
21 #include "cxMathBase.h"
22 
23 
24 namespace cx {
25 
36 class CXTESTUTILITIES_EXPORT cxSyntheticVolume {
37 public:
38 
40  {
41  // Seed the random number generator
42  srand(time(NULL));
43  mBounds = bounds;
44  }
45  virtual ~cxSyntheticVolume() { };
46 
47  virtual Vector3D
49  {
50  return mBounds;
51  }
52 
69  sampleUsData(const std::vector<Transform3D>& planes_rMf,
70  const Eigen::Array2f& pixelSpacing,
71  const Eigen::Array2i& sliceDimension,
72  const Transform3D& output_dMr,
73  const double noiseSigma,
74  const unsigned char noiseMean) const;
79  sampleUsData(const std::vector<Transform3D>& planes_rMt,
80  const ProbeDefinition& probe,
81  const Transform3D& output_dMr,
82  const double noiseSigma=0,
83  const unsigned char noiseMean=0) const;
87  sampleUsData(const Transform3D& plane_rMt,
88  const ProbeDefinition& probe,
89  const double noiseSigma=0,
90  const unsigned char noiseMean=0) const;
94  sampleUsData(const Transform3D& plane_rMf,
95  const Eigen::Array2f& pixelSpacing,
96  const Eigen::Array2i& sliceDimension,
97  const double noiseSigma,
98  const unsigned char noiseMean) const;
99 
104  virtual unsigned char evaluate(const Vector3D& p) const = 0;
105  virtual void printInfo() const {}
106 
107  void fillVolume(cx::ImagePtr vol);
108  virtual float computeRMSError(cx::ImagePtr vol);
109 
110 protected:
111  unsigned char constrainToUnsignedChar(const int val) const;
112  vtkImageDataPtr createEmptyMask(const Eigen::Array2i& sliceDimension) const;
113 
115 
116 };
117 
118 typedef boost::shared_ptr<cxSyntheticVolume> cxSyntheticVolumePtr;
119 
120 CXTESTUTILITIES_EXPORT double calculateRMSError(vtkImageDataPtr a, vtkImageDataPtr b);
121 CXTESTUTILITIES_EXPORT cx::Vector3D calculateCentroid(cx::ImagePtr image);
122 CXTESTUTILITIES_EXPORT double calculateMass(cx::ImagePtr image);
123 
124 }
125 #endif
126 
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
double calculateMass(cx::ImagePtr image)
virtual void printInfo() const
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cxSyntheticVolume(Vector3D bounds)
boost::shared_ptr< cxSyntheticVolume > cxSyntheticVolumePtr
cx::Vector3D calculateCentroid(cx::ImagePtr image)
double calculateRMSError(vtkImageDataPtr a, vtkImageDataPtr b)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
Definition of characteristics for an Ultrasound Probe Sector.
virtual Vector3D getBounds()
boost::shared_ptr< class ProcessedUSInputData > ProcessedUSInputDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.