NorMIT-nav  2023.01.05-dev+develop.0da12
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 
cx::ProbeDefinition
Definition of characteristics for an Ultrasound Probe Sector.
Definition: cxProbeDefinition.h:101
cx::cxSyntheticVolume::cxSyntheticVolume
cxSyntheticVolume(Vector3D bounds)
Definition: cxSyntheticVolume.h:39
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ProcessedUSInputDataPtr
boost::shared_ptr< class ProcessedUSInputData > ProcessedUSInputDataPtr
Definition: cxReconstructionMethodService.h:36
cx::calculateMass
double calculateMass(cx::ImagePtr image)
Definition: cxSyntheticVolume.cpp:342
vtkImageDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Definition: cxVideoConnectionWidget.h:30
cx::cxSyntheticVolume
Definition: cxSyntheticVolume.h:36
cx::calculateRMSError
double calculateRMSError(vtkImageDataPtr a, vtkImageDataPtr b)
Definition: cxSyntheticVolume.cpp:225
cxUSFrameData.h
cx::calculateCentroid
cx::Vector3D calculateCentroid(cx::ImagePtr image)
Definition: cxSyntheticVolume.cpp:330
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::cxSyntheticVolume::~cxSyntheticVolume
virtual ~cxSyntheticVolume()
Definition: cxSyntheticVolume.h:45
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cx::cxSyntheticVolume::getBounds
virtual Vector3D getBounds()
Definition: cxSyntheticVolume.h:48
cx::cxSyntheticVolume::mBounds
Vector3D mBounds
Definition: cxSyntheticVolume.h:114
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
cxMathBase.h
cx::cxSyntheticVolumePtr
boost::shared_ptr< cxSyntheticVolume > cxSyntheticVolumePtr
Definition: cxSyntheticVolume.h:118
cx::cxSyntheticVolume::printInfo
virtual void printInfo() const
Definition: cxSyntheticVolume.h:105