diff options
-rw-r--r-- | include/astra/ParallelProjectionGeometry3D.h | 8 | ||||
-rw-r--r-- | include/astra/ProjectionGeometry3D.h | 64 | ||||
-rw-r--r-- | src/ParallelProjectionGeometry3D.cpp | 24 | ||||
-rw-r--r-- | src/ProjectionGeometry3D.cpp | 109 |
4 files changed, 13 insertions, 192 deletions
diff --git a/include/astra/ParallelProjectionGeometry3D.h b/include/astra/ParallelProjectionGeometry3D.h index 85d0687..3549984 100644 --- a/include/astra/ParallelProjectionGeometry3D.h +++ b/include/astra/ParallelProjectionGeometry3D.h @@ -84,9 +84,7 @@ public: int _iDetectorColCount, float32 _fDetectorWidth, float32 _fDetectorHeight, - const float32* _pfProjectionAngles, - const float32* _pfExtraDetectorOffsetsX = NULL, - const float32* _pfExtraDetectorOffsetsY = NULL); + const float32* _pfProjectionAngles); /** Copy constructor. */ @@ -119,9 +117,7 @@ public: int _iDetectorColCount, float32 _fDetectorWidth, float32 _fDetectorHeight, - const float32* _pfProjectionAngles, - const float32* _pfExtraDetectorOffsetsX = NULL, - const float32* _pfExtraDetectorOffsetsY = NULL); + const float32* _pfProjectionAngles); /** Create a hard copy. */ diff --git a/include/astra/ProjectionGeometry3D.h b/include/astra/ProjectionGeometry3D.h index 0deffa6..72a1a55 100644 --- a/include/astra/ProjectionGeometry3D.h +++ b/include/astra/ProjectionGeometry3D.h @@ -92,12 +92,6 @@ protected: */ float32* m_pfProjectionAngles; - /** Dynamically allocated array of vectors that represents the amount by which an image has been shifted after - * projection. Each projection image has a 2 shifts associated with it, one x-translation and y-translation - */ - float32* m_pfExtraDetectorOffsetsX; - float32* m_pfExtraDetectorOffsetsY; - /** Default constructor. Sets all numeric member variables to 0 and all pointer member variables to NULL. * * If an object is constructed using this default constructor, it must always be followed by a call @@ -122,9 +116,7 @@ protected: int _iDetectorColCount, float32 _fDetectorSpacingX, float32 _fDetectorSpacingY, - const float32* _pfProjectionAngles, - const float32* _pfExtraDetectorOffsetsX = NULL, - const float32* _pfExtraDetectorOffsetsY = NULL); + const float32* _pfProjectionAngles); /** Copy constructor. */ @@ -160,9 +152,7 @@ protected: int _iDetectorColCount, float32 _fDetectorSpacingX, float32 _fDetectorSpacingY, - const float32* _pfProjectionAngles, - const float32* _pfExtraDetectorOffsetsX = NULL, - const float32* _pfExtraDetectorOffsetsY = NULL); + const float32* _pfProjectionAngles); public: @@ -254,18 +244,6 @@ public: */ const float32* getProjectionAngles() const; - const float32* getExtraDetectorOffsetsX() const; - - const float32* getExtraDetectorOffsetsY() const; - - float32 getExtraDetectorOffsetX(int _iProjectionIndex) const; - - float32 getExtraDetectorOffsetY(int _iProjectionIndex) const; - - AstraError setExtraDetectorOffsetsX(float32* _pfExtraDetectorOffsetsX); - - AstraError setExtraDetectorOffsetsY(float32* _pfExtraDetectorOffsetsY); - /** Get the column index coordinate of a point on a detector array. * * @param _fOffsetX Distance between the center of the detector array and a certain point (both on the X-axis). @@ -445,44 +423,6 @@ inline const float32* CProjectionGeometry3D::getProjectionAngles() const //---------------------------------------------------------------------------------------- -// Get pointer to buffer used to store x-translations of the projection images. -inline const float32* CProjectionGeometry3D::getExtraDetectorOffsetsX() const -{ - // basic checks - ASTRA_ASSERT(m_bInitialized); - - return m_pfExtraDetectorOffsetsX; -} - -//---------------------------------------------------------------------------------------- -// Get pointer to buffer used to store y-translations of the projection images. -inline const float32* CProjectionGeometry3D::getExtraDetectorOffsetsY() const -{ - // basic checks - ASTRA_ASSERT(m_bInitialized); - - return m_pfExtraDetectorOffsetsY; -} -//---------------------------------------------------------------------------------------- -// Get the x-translation of a specific projection image. -inline float32 CProjectionGeometry3D::getExtraDetectorOffsetX(int _iProjectionIndex) const -{ - // basic checks - ASTRA_ASSERT(m_bInitialized); - - return m_pfExtraDetectorOffsetsX[_iProjectionIndex]; -} - -//---------------------------------------------------------------------------------------- -// Get the y-translation of a specific projection image. -inline float32 CProjectionGeometry3D::getExtraDetectorOffsetY(int _iProjectionIndex) const -{ - // basic checks - ASTRA_ASSERT(m_bInitialized); - - return m_pfExtraDetectorOffsetsX[_iProjectionIndex]; -} -//---------------------------------------------------------------------------------------- // detector offset X -> detector column index (float) inline float32 CProjectionGeometry3D::detectorOffsetXToColIndexFloat(float32 _fOffsetX) const { diff --git a/src/ParallelProjectionGeometry3D.cpp b/src/ParallelProjectionGeometry3D.cpp index c0366bc..2027f95 100644 --- a/src/ParallelProjectionGeometry3D.cpp +++ b/src/ParallelProjectionGeometry3D.cpp @@ -50,9 +50,7 @@ CParallelProjectionGeometry3D::CParallelProjectionGeometry3D(int _iProjectionAng int _iDetectorColCount, float32 _fDetectorWidth, float32 _fDetectorHeight, - const float32* _pfProjectionAngles, - const float32* _pfExtraDetectorOffsetsX, - const float32* _pfExtraDetectorOffsetsY) : + const float32* _pfProjectionAngles) : CProjectionGeometry3D() { initialize(_iProjectionAngleCount, @@ -60,9 +58,7 @@ CParallelProjectionGeometry3D::CParallelProjectionGeometry3D(int _iProjectionAng _iDetectorColCount, _fDetectorWidth, _fDetectorHeight, - _pfProjectionAngles, - _pfExtraDetectorOffsetsX, - _pfExtraDetectorOffsetsY); + _pfProjectionAngles); } //---------------------------------------------------------------------------------------- @@ -95,18 +91,14 @@ bool CParallelProjectionGeometry3D::initialize(int _iProjectionAngleCount, int _iDetectorColCount, float32 _fDetectorWidth, float32 _fDetectorHeight, - const float32* _pfProjectionAngles, - const float32* _pfExtraDetectorOffsetsX, - const float32* _pfExtraDetectorOffsetsY) + const float32* _pfProjectionAngles) { _initialize(_iProjectionAngleCount, _iDetectorRowCount, _iDetectorColCount, _fDetectorWidth, _fDetectorHeight, - _pfProjectionAngles, - _pfExtraDetectorOffsetsX, - _pfExtraDetectorOffsetsY); + _pfProjectionAngles); // success m_bInitialized = _check(); @@ -127,10 +119,6 @@ CProjectionGeometry3D* CParallelProjectionGeometry3D::clone() const res->m_fDetectorSpacingY = m_fDetectorSpacingY; res->m_pfProjectionAngles = new float32[m_iProjectionAngleCount]; memcpy(res->m_pfProjectionAngles, m_pfProjectionAngles, sizeof(float32)*m_iProjectionAngleCount); - res->m_pfExtraDetectorOffsetsX = new float32[m_iProjectionAngleCount]; - memcpy(res->m_pfExtraDetectorOffsetsX, m_pfExtraDetectorOffsetsX, sizeof(float32)*m_iProjectionAngleCount); - res->m_pfExtraDetectorOffsetsY = new float32[m_iProjectionAngleCount]; - memcpy(res->m_pfExtraDetectorOffsetsY, m_pfExtraDetectorOffsetsY, sizeof(float32)*m_iProjectionAngleCount); return res; } @@ -178,8 +166,6 @@ void CParallelProjectionGeometry3D::toXML(XMLNode* _sNode) const _sNode->addChildNode("DetectorRowCount", m_iDetectorRowCount); _sNode->addChildNode("DetectorColCount", m_iDetectorColCount); _sNode->addChildNode("ProjectionAngles", m_pfProjectionAngles, m_iProjectionAngleCount); - _sNode->addChildNode("ExtraDetectorOffsetsX", m_pfExtraDetectorOffsetsX, m_iProjectionAngleCount); - _sNode->addChildNode("ExtraDetectorOffsetsY", m_pfExtraDetectorOffsetsY, m_iProjectionAngleCount); } CVector3D CParallelProjectionGeometry3D::getProjectionDirection(int _iProjectionIndex, int _iDetectorIndex) const @@ -199,7 +185,7 @@ CParallelProjectionGeometry2D * CParallelProjectionGeometry3D::createProjectionG //getProjectionAngles(pfProjectionAngles); CParallelProjectionGeometry2D * pOutput = new CParallelProjectionGeometry2D(getProjectionCount(), - getDetectorColCount(), getDetectorSpacingX(), pfProjectionAngles,getExtraDetectorOffsetsX()); + getDetectorColCount(), getDetectorSpacingX(), pfProjectionAngles); //delete [] pfProjectionAngles; diff --git a/src/ProjectionGeometry3D.cpp b/src/ProjectionGeometry3D.cpp index b78b7b8..bc8029b 100644 --- a/src/ProjectionGeometry3D.cpp +++ b/src/ProjectionGeometry3D.cpp @@ -72,9 +72,7 @@ CProjectionGeometry3D::CProjectionGeometry3D(int _iAngleCount, int _iDetectorColCount, float32 _fDetectorSpacingX, float32 _fDetectorSpacingY, - const float32 *_pfProjectionAngles, - const float32 *_pfExtraDetectorOffsetsX, - const float32 *_pfExtraDetectorOffsetsY) : configCheckData(0) + const float32 *_pfProjectionAngles) : configCheckData(0) { _clear(); _initialize(_iAngleCount, @@ -82,9 +80,7 @@ CProjectionGeometry3D::CProjectionGeometry3D(int _iAngleCount, _iDetectorColCount, _fDetectorSpacingX, _fDetectorSpacingY, - _pfProjectionAngles, - _pfExtraDetectorOffsetsX, - _pfExtraDetectorOffsetsY); + _pfProjectionAngles); } //---------------------------------------------------------------------------------------- @@ -97,9 +93,7 @@ CProjectionGeometry3D::CProjectionGeometry3D(const CProjectionGeometry3D& _projG _projGeom.m_iDetectorColCount, _projGeom.m_fDetectorSpacingX, _projGeom.m_fDetectorSpacingY, - _projGeom.m_pfProjectionAngles, - _projGeom.m_pfExtraDetectorOffsetsX, - _projGeom.m_pfExtraDetectorOffsetsY); + _projGeom.m_pfProjectionAngles); } //---------------------------------------------------------------------------------------- @@ -122,8 +116,6 @@ void CProjectionGeometry3D::_clear() m_fDetectorSpacingX = 0.0f; m_fDetectorSpacingY = 0.0f; m_pfProjectionAngles = NULL; - m_pfExtraDetectorOffsetsX = NULL; - m_pfExtraDetectorOffsetsY = NULL; m_bInitialized = false; } @@ -139,15 +131,7 @@ void CProjectionGeometry3D::clear() if (m_pfProjectionAngles != NULL) { delete [] m_pfProjectionAngles; } - if (m_pfExtraDetectorOffsetsX != NULL) { - delete [] m_pfExtraDetectorOffsetsX; - } - if (m_pfExtraDetectorOffsetsY != NULL) { - delete [] m_pfExtraDetectorOffsetsY; - } m_pfProjectionAngles = NULL; - m_pfExtraDetectorOffsetsX = NULL; - m_pfExtraDetectorOffsetsY = NULL; m_bInitialized = false; } @@ -206,58 +190,6 @@ bool CProjectionGeometry3D::initialize(const Config& _cfg) CC.markNodeParsed("ProjectionAngles"); ASTRA_DELETE(node); - // Optional: ExtraDetectorOffsetX - node = _cfg.self->getSingleNode("ExtraDetectorOffsetsX"); - m_pfExtraDetectorOffsetsX = new float32[m_iProjectionAngleCount]; - if (node) { - vector<float32> translationsX = node->getContentNumericalArray(); - if (translationsX.size() < m_iProjectionAngleCount){ - cout << "Not enough ExtraDetectorOffsetsX components specified. " << endl; - for (int i = 0; i < m_iProjectionAngleCount; i++) { - m_pfExtraDetectorOffsetsX[i] = 0; - } - } - else { - for (int i = 0; i < m_iProjectionAngleCount; i++) { - m_pfExtraDetectorOffsetsX[i] = translationsX[i]; - } - } - } - else { - //cout << "No ExtraDetectorOffsetsX tag specified." << endl; - for (int i = 0; i < m_iProjectionAngleCount; i++) { - m_pfExtraDetectorOffsetsX[i] = 0; - } - } - CC.markOptionParsed("ExtraDetectorOffsetsX"); - ASTRA_DELETE(node); - - // Optional: ExtraDetectorOffsetsY - node = _cfg.self->getSingleNode("ExtraDetectorOffsetsY"); - m_pfExtraDetectorOffsetsY = new float32[m_iProjectionAngleCount]; - if (node) { - vector<float32> translationsX = node->getContentNumericalArray(); - if (translationsX.size() < m_iProjectionAngleCount){ - cout << "Not enough ExtraDetectorOffsetsY components specified. " << endl; - for (int i = 0; i < m_iProjectionAngleCount; i++) { - m_pfExtraDetectorOffsetsY[i] = 0; - } - } - else { - for (int i = 0; i < m_iProjectionAngleCount; i++) { - m_pfExtraDetectorOffsetsY[i] = translationsX[i]; - } - } - } - else { - //cout << "No ExtraDetectorOffsetsY tag specified." << endl; - for (int i = 0; i < m_iProjectionAngleCount; i++) { - m_pfExtraDetectorOffsetsY[i] = 0; - } - } - CC.markOptionParsed("ExtraDetectorOffsetsY"); - ASTRA_DELETE(node); - // Interface class, so don't return true return false; } @@ -269,9 +201,7 @@ bool CProjectionGeometry3D::_initialize(int _iProjectionAngleCount, int _iDetectorColCount, float32 _fDetectorSpacingX, float32 _fDetectorSpacingY, - const float32 *_pfProjectionAngles, - const float32 *_pfExtraDetectorOffsetsX, - const float32 *_pfExtraDetectorOffsetsY) + const float32 *_pfProjectionAngles) { if (m_bInitialized) { clear(); @@ -285,14 +215,8 @@ bool CProjectionGeometry3D::_initialize(int _iProjectionAngleCount, m_fDetectorSpacingX = _fDetectorSpacingX; m_fDetectorSpacingY = _fDetectorSpacingY; m_pfProjectionAngles = new float32[m_iProjectionAngleCount]; - m_pfExtraDetectorOffsetsX = new float32[m_iProjectionAngleCount]; - m_pfExtraDetectorOffsetsY = new float32[m_iProjectionAngleCount]; for (int i = 0; i < m_iProjectionAngleCount; i++) { m_pfProjectionAngles[i] = _pfProjectionAngles[i]; - m_pfExtraDetectorOffsetsX[i] = _pfExtraDetectorOffsetsX ? _pfExtraDetectorOffsetsX[i]:0; - m_pfExtraDetectorOffsetsY[i] = _pfExtraDetectorOffsetsY ? _pfExtraDetectorOffsetsY[i]:0; - //m_pfExtraDetectorOffsetsX[i] = 0; - //m_pfExtraDetectorOffsetsY[i] = 0; } m_iDetectorTotCount = m_iProjectionAngleCount * m_iDetectorRowCount * m_iDetectorColCount; @@ -301,29 +225,4 @@ bool CProjectionGeometry3D::_initialize(int _iProjectionAngleCount, return false; } -//--------------------------------------------------------------------------------------- -// -AstraError CProjectionGeometry3D::setExtraDetectorOffsetsX(float32* _pfExtraDetectorOffsetsX) -{ - if (!m_bInitialized) - return ASTRA_ERROR_NOT_INITIALIZED; - - for (int iAngle = 0; iAngle<m_iProjectionAngleCount; iAngle++) - m_pfExtraDetectorOffsetsX[iAngle] = _pfExtraDetectorOffsetsX[iAngle]; - - return ASTRA_SUCCESS; -} - -//--------------------------------------------------------------------------------------- -// -AstraError CProjectionGeometry3D::setExtraDetectorOffsetsY(float32* _pfExtraDetectorOffsetsY) -{ - if (!m_bInitialized) - return ASTRA_ERROR_NOT_INITIALIZED; - - for (int iAngle = 0; iAngle<m_iProjectionAngleCount; iAngle++) - m_pfExtraDetectorOffsetsY[iAngle] = _pfExtraDetectorOffsetsY[iAngle]; - - return ASTRA_SUCCESS; -} } // namespace astra |