NorMIT-nav  22.09
An IGT application
cxReconstructedOutputVolumeParams.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 
12 
14 
15 namespace cx
16 {
17 
19  mInputSpacing(0),
20  mMaxVolumeSize(32*1000),
21  mValid(false)
22 {
23 
24 }
27 OutputVolumeParams::OutputVolumeParams(DoubleBoundingBox3D extent, double inputSpacing, double maxVolumeSize) :
28  mInputSpacing(inputSpacing), mMaxVolumeSize(maxVolumeSize), mValid(false)
29 {
30  mImage.setSpacingKeepDim(Eigen::Array3d(inputSpacing, inputSpacing, inputSpacing));
31  mImage.setDimKeepBoundsAlignSpacing(extent.range());
32 
33  this->constrainVolumeSize();
34 
35  if(mImage.getDim().minCoeff() <= 1) //At least one of the dimensions <= 1
36  mValid = false;
37  else
38  mValid = true;
39 }
40 
41 unsigned long OutputVolumeParams::getVolumeSize() const
42 {
43  return mImage.getNumVoxels();
44 }
45 
48 void OutputVolumeParams::setSpacing(double spacing)
49 {
50  this->suggestSpacingKeepBounds(spacing);
51 }
53 {
54  return mImage.getSpacing()[0];
55 }
58 void OutputVolumeParams::setDim(int index, int newDim)
59 {
60  double newSpacing = mImage.getBounds()[index] / (newDim);
61  this->setSpacing(newSpacing);
62 }
63 Eigen::Array3i OutputVolumeParams::getDim() const
64 {
65  return mImage.getDim();
66 }
70 {
71  this->suggestSpacingKeepBounds(mInputSpacing);
73  mImage.changeToUniformSpacing();
74 }
75 
76 void OutputVolumeParams::suggestSpacingKeepBounds(double spacing)
77 {
78  Eigen::Array3d bounds = mImage.getBounds();
79  mImage.setSpacingKeepDim(Eigen::Array3d(spacing, spacing, spacing));
80  mImage.setDimKeepBoundsAlignSpacing(bounds);
81 }
82 
84 {
85  mMaxVolumeSize = maxSize;
86 }
87 
89 {
90  return mMaxVolumeSize;
91 }
92 
93 
95 {
96  mImage.m_rMd = rMd;
97 }
98 
100 {
101  return mImage.m_rMd;
102 }
103 
104 
106 {
107  return DoubleBoundingBox3D(Vector3D::Zero(), mImage.getBounds());
108 }
109 
111 {
112  return mInputSpacing;
113 }
114 
115 } // namespace cx
cx::OutputVolumeParams::get_rMd
Transform3D get_rMd()
Definition: cxReconstructedOutputVolumeParams.cpp:99
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cx::ImageParameters::getNumVoxels
unsigned long getNumVoxels() const
Definition: cxImageParameters.h:40
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ImageParameters::getSpacing
Eigen::Array3d getSpacing() const
Definition: cxImageParameters.cpp:38
cx::OutputVolumeParams::setSpacing
void setSpacing(double spacing)
Definition: cxReconstructedOutputVolumeParams.cpp:48
cx::OutputVolumeParams::getInputSpacing
double getInputSpacing()
Definition: cxReconstructedOutputVolumeParams.cpp:110
cx::OutputVolumeParams::getMaxVolumeSize
unsigned long getMaxVolumeSize()
Definition: cxReconstructedOutputVolumeParams.cpp:88
cx::OutputVolumeParams::setDim
void setDim(int index, int newDim)
Definition: cxReconstructedOutputVolumeParams.cpp:58
cx::ImageParameters::getBounds
Eigen::Array3d getBounds()
Definition: cxImageParameters.cpp:43
cx::ImageParameters::setSpacingKeepDim
void setSpacingKeepDim(Eigen::Array3d spacing)
Definition: cxImageParameters.cpp:73
cx::OutputVolumeParams::getDim
Eigen::Array3i getDim() const
Definition: cxReconstructedOutputVolumeParams.cpp:63
cx::OutputVolumeParams::set_rMd
void set_rMd(Transform3D rMd)
Definition: cxReconstructedOutputVolumeParams.cpp:94
cx::OutputVolumeParams::getExtent
DoubleBoundingBox3D getExtent()
Definition: cxReconstructedOutputVolumeParams.cpp:105
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::OutputVolumeParams::constrainVolumeSize
void constrainVolumeSize()
Definition: cxReconstructedOutputVolumeParams.cpp:69
cx::ImageParameters::changeToUniformSpacing
void changeToUniformSpacing()
Definition: cxImageParameters.cpp:155
cx::OutputVolumeParams::setMaxVolumeSize
void setMaxVolumeSize(double maxSize)
Definition: cxReconstructedOutputVolumeParams.cpp:83
cx::OutputVolumeParams::getVolumeSize
unsigned long getVolumeSize() const
Definition: cxReconstructedOutputVolumeParams.cpp:41
cx::OutputVolumeParams::getSpacing
double getSpacing() const
Definition: cxReconstructedOutputVolumeParams.cpp:52
cx::ImageParameters::setDimKeepBoundsAlignSpacing
void setDimKeepBoundsAlignSpacing(Eigen::Array3d bounds)
Definition: cxImageParameters.cpp:53
cx::OutputVolumeParams::OutputVolumeParams
OutputVolumeParams()
Definition: cxReconstructedOutputVolumeParams.cpp:18
cx::DoubleBoundingBox3D::range
Vector3D range() const
Definition: cxBoundingBox3D.cpp:200
cxReconstructedOutputVolumeParams.h
cx::ImageParameters::limitVoxelsKeepBounds
void limitVoxelsKeepBounds(unsigned long maxVolumeSize)
Definition: cxImageParameters.cpp:87
cx::ImageParameters::getDim
Eigen::Array3i getDim() const
Definition: cxImageParameters.cpp:33
cx::ImageParameters::m_rMd
Transform3D m_rMd
Definition: cxImageParameters.h:36