Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef SYNTHETIC_VOLUME_HPP
34 #define SYNTHETIC_VOLUME_HPP
35 
36 #include "cxtestutilities_export.h"
37 
38 #include "cxUSFrameData.h"
39 #include <vector>
40 #include <cstdlib>
41 #include <time.h>
42 #include "cxMathBase.h"
43 
44 
45 namespace cx {
46 
57 class CXTESTUTILITIES_EXPORT cxSyntheticVolume {
58 public:
59 
61  {
62  // Seed the random number generator
63  srand(time(NULL));
64  mBounds = bounds;
65  }
66  virtual ~cxSyntheticVolume() { };
67 
68  virtual Vector3D
70  {
71  return mBounds;
72  }
73 
90  sampleUsData(const std::vector<Transform3D>& planes_rMf,
91  const Eigen::Array2f& pixelSpacing,
92  const Eigen::Array2i& sliceDimension,
93  const Transform3D& output_dMr,
94  const double noiseSigma,
95  const unsigned char noiseMean) const;
100  sampleUsData(const std::vector<Transform3D>& planes_rMt,
101  const ProbeDefinition& probe,
102  const Transform3D& output_dMr,
103  const double noiseSigma=0,
104  const unsigned char noiseMean=0) const;
108  sampleUsData(const Transform3D& plane_rMt,
109  const ProbeDefinition& probe,
110  const double noiseSigma=0,
111  const unsigned char noiseMean=0) const;
115  sampleUsData(const Transform3D& plane_rMf,
116  const Eigen::Array2f& pixelSpacing,
117  const Eigen::Array2i& sliceDimension,
118  const double noiseSigma,
119  const unsigned char noiseMean) const;
120 
125  virtual unsigned char evaluate(const Vector3D& p) const = 0;
126  virtual void printInfo() const {}
127 
128  void fillVolume(cx::ImagePtr vol);
129  virtual float computeRMSError(cx::ImagePtr vol);
130 
131 protected:
132  unsigned char constrainToUnsignedChar(const int val) const;
133  vtkImageDataPtr createEmptyMask(const Eigen::Array2i& sliceDimension) const;
134 
136 
137 };
138 
139 typedef boost::shared_ptr<cxSyntheticVolume> cxSyntheticVolumePtr;
140 
141 CXTESTUTILITIES_EXPORT double calculateRMSError(vtkImageDataPtr a, vtkImageDataPtr b);
142 CXTESTUTILITIES_EXPORT cx::Vector3D calculateCentroid(cx::ImagePtr image);
143 CXTESTUTILITIES_EXPORT double calculateMass(cx::ImagePtr image);
144 
145 }
146 #endif
147 
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:48
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:63
Definition of characteristics for an Ultrasound Probe Sector.
virtual Vector3D getBounds()
boost::shared_ptr< class ProcessedUSInputData > ProcessedUSInputDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr