From 1d851f0a8fa093e044c7264569cc6f88df39a16e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 26 Jan 2017 14:57:42 +0100 Subject: Remove unused 3d global min/max --- include/astra/Float32Data3D.h | 16 ------------ include/astra/Float32Data3DMemory.h | 42 ++---------------------------- matlab/mex/astra_mex_data3d_c.cpp | 4 --- matlab/mex/mexDataManagerHelpFunctions.cpp | 11 -------- matlab/mex/mexDataManagerHelpFunctions.h | 2 -- python/astra/data3d_c.pyx | 1 - src/Float32Data3DMemory.cpp | 38 --------------------------- 7 files changed, 2 insertions(+), 112 deletions(-) diff --git a/include/astra/Float32Data3D.h b/include/astra/Float32Data3D.h index 1cd9c20..2b3b88e 100644 --- a/include/astra/Float32Data3D.h +++ b/include/astra/Float32Data3D.h @@ -107,22 +107,6 @@ public: */ int getDimensionCount() const; - /** - * Clamp data to minimum value - * - * @param _fMin minimum value - * @return l-value - */ - virtual CFloat32Data3D& clampMin(float32& _fMin) = 0; - - /** - * Clamp data to maximum value - * - * @param _fMax maximum value - * @return l-value - */ - virtual CFloat32Data3D& clampMax(float32& _fMax) = 0; - /** get a description of the class * * @return description string diff --git a/include/astra/Float32Data3DMemory.h b/include/astra/Float32Data3DMemory.h index d885101..e0c04a0 100644 --- a/include/astra/Float32Data3DMemory.h +++ b/include/astra/Float32Data3DMemory.h @@ -237,35 +237,11 @@ public: * After the call p = getData3D(), use p[iy][ix] to access element (ix, iy, iz). * The data memory and pointer array are still "owned" by the CFloat32Data3DMemory * instance; this memory may NEVER be freed by the caller of this function. - * If changes are made to this data, the function updateStatistics() - * should be called after completion of all changes. * * @return pointer to the 3-dimensional 32-bit floating point data block */ const float32*** getData3DConst() const; - /** Update data statistics, such as minimum and maximum value, after the data has been modified. - */ - virtual void updateStatistics(); - - /** Get the minimum value in the data block. - * If the data has been changed after construction, the function - * updateStatistics() must be called at least once before - * a query can be made on this value. - * - * @return minimum value in the data block - */ - virtual float32 getGlobalMin() const; - - /** Get the maximum value in the data block - * If the data has been changed after construction, the function - * updateStatistics() must be called at least once before - * a query can be made on this value. - * - * @return maximum value in the data block - */ - virtual float32 getGlobalMax() const; - /** which type is this class? * * @return DataType: ASTRA_DATATYPE_FLOAT32_PROJECTION or @@ -305,27 +281,12 @@ inline CFloat32Data3DMemory::EDataType CFloat32Data3DMemory::getType() const return BASE; } -//---------------------------------------------------------------------------------------- -// Get the minimum value in the data block. -inline float32 CFloat32Data3DMemory::getGlobalMin() const -{ - ASTRA_ASSERT(m_bInitialized); - return m_fGlobalMin; -} - -//---------------------------------------------------------------------------------------- -// Get the maximum value in the data block -inline float32 CFloat32Data3DMemory::getGlobalMax() const -{ - ASTRA_ASSERT(m_bInitialized); - return m_fGlobalMax; -} - //---------------------------------------------------------------------------------------- // Get a pointer to the data block, represented as a 1-dimensional array of float32 values. inline float32* CFloat32Data3DMemory::getData() { ASTRA_ASSERT(m_bInitialized); + return m_pfData; } @@ -334,6 +295,7 @@ inline float32* CFloat32Data3DMemory::getData() inline const float32* CFloat32Data3DMemory::getDataConst() const { ASTRA_ASSERT(m_bInitialized); + return (const float32*)m_pfData; } diff --git a/matlab/mex/astra_mex_data3d_c.cpp b/matlab/mex/astra_mex_data3d_c.cpp index 7909a79..2dca3b8 100644 --- a/matlab/mex/astra_mex_data3d_c.cpp +++ b/matlab/mex/astra_mex_data3d_c.cpp @@ -103,7 +103,6 @@ void astra_mex_data3d_create(int& nlhs, mxArray* plhs[], int& nrhs, const mxArra copyMexToCFloat32Array(data, pDataObject3D->getData(), pDataObject3D->getSize()); } - pDataObject3D->updateStatistics(); // step4: store data object int iIndex = CData3DManager::getSingleton().store(pDataObject3D); @@ -162,8 +161,6 @@ void astra_mex_data3d_link(int& nlhs, mxArray* plhs[], int& nrhs, const mxArray* return; } - //pDataObject3D->updateStatistics(); - // step4: store data object int iIndex = CData3DManager::getSingleton().store(pDataObject3D); @@ -234,7 +231,6 @@ void astra_mex_data3d_store(int nlhs, mxArray* plhs[], int nrhs, const mxArray* } copyMexToCFloat32Array(prhs[2], pDataObject->getData(), pDataObject->getSize()); - pDataObject->updateStatistics(); } void astra_mex_data3d_dimensions(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) diff --git a/matlab/mex/mexDataManagerHelpFunctions.cpp b/matlab/mex/mexDataManagerHelpFunctions.cpp index ebf6f8f..c47ee27 100644 --- a/matlab/mex/mexDataManagerHelpFunctions.cpp +++ b/matlab/mex/mexDataManagerHelpFunctions.cpp @@ -164,17 +164,6 @@ checkDataSize(const mxArray * const mArray, && (zOffset + geom->getGridSliceCount()) <= dims[2]); } -//----------------------------------------------------------------------------------------- -void -updateStatistics(const std::vector & vecIn) -{ - const size_t tot_size = vecIn.size(); - for (size_t count = 0; count < tot_size; count++) - { - vecIn[count]->updateStatistics(); - } -} - //----------------------------------------------------------------------------------------- void getDataPointers(const std::vector & vecIn, diff --git a/matlab/mex/mexDataManagerHelpFunctions.h b/matlab/mex/mexDataManagerHelpFunctions.h index fff83a0..b7edb0f 100644 --- a/matlab/mex/mexDataManagerHelpFunctions.h +++ b/matlab/mex/mexDataManagerHelpFunctions.h @@ -50,8 +50,6 @@ bool checkDataSize(const mxArray * const, const astra::CProjectionGeometry3D * c bool checkDataSize(const mxArray * const, const astra::CVolumeGeometry3D * const, const mwIndex & zOffset); -void updateStatistics(const std::vector &); - void getDataPointers(const std::vector &, std::vector &); void getDataSizes(const std::vector &, diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 915c60d..1b9293a 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -132,7 +132,6 @@ def create(datatype,geometry,data=None, link=False): if not link: fillDataObject(pDataObject3D, data) - pDataObject3D.updateStatistics() return man3d.store(pDataObject3D) diff --git a/src/Float32Data3DMemory.cpp b/src/Float32Data3DMemory.cpp index 8735585..7e60527 100644 --- a/src/Float32Data3DMemory.cpp +++ b/src/Float32Data3DMemory.cpp @@ -76,10 +76,6 @@ bool CFloat32Data3DMemory::_initialize(int _iWidth, int _iHeight, int _iDepth) m_pCustomMemory = 0; _allocateData(); - // set minmax to default values - m_fGlobalMin = 0.0; - m_fGlobalMax = 0.0; - // initialization complete return true; @@ -273,9 +269,6 @@ void CFloat32Data3DMemory::_clear() m_ppfDataRowInd = NULL; m_pppfDataSliceInd = NULL; m_pCustomMemory = NULL; - - //m_fGlobalMin = 0.0f; - //m_fGlobalMax = 0.0f; } //---------------------------------------------------------------------------------------- @@ -289,37 +282,6 @@ void CFloat32Data3DMemory::_unInit() m_bInitialized = false; } -//---------------------------------------------------------------------------------------- -// Update data statistics, such as minimum and maximum value, after the data has been modified. -void CFloat32Data3DMemory::updateStatistics() -{ - _computeGlobalMinMax(); -} - -//---------------------------------------------------------------------------------------- -// Find the minimum and maximum data value. -void CFloat32Data3DMemory::_computeGlobalMinMax() -{ - // basic checks - ASTRA_ASSERT(m_bInitialized); - ASTRA_ASSERT(m_pfData != NULL); - ASTRA_ASSERT(m_iSize > 0); - - // initial values - m_fGlobalMin = m_pfData[0]; - m_fGlobalMax = m_pfData[0]; - - // loop - size_t i; - float32 v; - for (i = 0; i < m_iSize; ++i) - { - v = m_pfData[i]; - if (v < m_fGlobalMin) m_fGlobalMin = v; - if (v > m_fGlobalMax) m_fGlobalMax = v; - } -} - //---------------------------------------------------------------------------------------- // Copy the data block pointed to by _pfData to the data block pointed to by m_pfData. void CFloat32Data3DMemory::copyData(const float32* _pfData, size_t _iSize) -- cgit v1.2.3