NorMIT-nav  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 }
cxtest::SphereSyntheticVolume::evaluate
virtual unsigned char evaluate(const cx::Vector3D &p) const
Definition: cxtestSphereSyntheticVolume.cpp:40
qstring_cast
QString qstring_cast(const T &val)
Definition: cxTypeConversions.h:46
cxtest::SphereSyntheticVolume::setSphere
void setSphere(const cx::Vector3D &center, double radius)
Definition: cxtestSphereSyntheticVolume.cpp:33
cxtest::SphereSyntheticVolume::SphereSyntheticVolume
SphereSyntheticVolume(cx::Vector3D bounds)
Definition: cxtestSphereSyntheticVolume.cpp:17
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxTypeConversions.h
cxtest
Definition: cxtestDirectSignalListener.cpp:13
cxtest::SphereSyntheticVolume::printInfo
virtual void printInfo() const
Definition: cxtestSphereSyntheticVolume.cpp:24
cx::cxSyntheticVolume::mBounds
Vector3D mBounds
Definition: cxSyntheticVolume.h:114
cxtestSphereSyntheticVolume.h
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42