CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxtestSphereSyntheticVolume.cpp
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 
13 #include "cxTypeConversions.h"
14 
15 namespace cxtest {
16 
18  cx::cxSyntheticVolume(dimensions)
19 {
20  mCenter = mBounds/2;
21  mRadius = 0.6 * mBounds.array().minCoeff()/2;
22 }
23 
25 {
26  std::cout << QString("Volume: Sphere, bounds=[%1], C=[%2], R=[%3]")
27  .arg(qstring_cast(mBounds))
28  .arg(qstring_cast(mCenter))
29  .arg(mRadius)
30  << std::endl;
31 }
32 
33 void SphereSyntheticVolume::setSphere(const cx::Vector3D& center, double radius)
34 {
35  mCenter = center;
36  mRadius = radius;
37 }
38 
39 unsigned char
41 {
42  if ((p - mCenter).norm() < mRadius)
43  {
44  return 255;
45  }
46  else
47  {
48  return 0;
49  }
50 }
51 
52 }
QString qstring_cast(const T &val)
void setSphere(const cx::Vector3D &center, double radius)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
virtual unsigned char evaluate(const cx::Vector3D &p) const
Namespace for all CustusX production code.