From bd2798bed2fddfe00dac006013a9fb1363417f20 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 14 Nov 2017 14:56:02 +0100 Subject: Remove unused code --- include/astra/Float32Data3DMemory.h | 33 ++------------------------------- python/astra/PyIncludes.pxd | 1 - python/astra/data3d_c.pyx | 6 +++--- src/Float32Data3DMemory.cpp | 33 --------------------------------- 4 files changed, 5 insertions(+), 68 deletions(-) diff --git a/include/astra/Float32Data3DMemory.h b/include/astra/Float32Data3DMemory.h index 876aa37..4ebe60b 100644 --- a/include/astra/Float32Data3DMemory.h +++ b/include/astra/Float32Data3DMemory.h @@ -52,22 +52,10 @@ protected: */ float32* m_pfData; - /** Array of float32 pointers, each pointing to a single row - * in the m_pfData memory block. - * To access element (ix, iy, iz) internally, use m_ppfDataRowInd[iz * m_iHeight + iy][ix] - */ - float32** m_ppfDataRowInd; - - /** Array of float32 pointers, each pointing to a single slice - * in the m_pfData memory block. - * To access element (ix, iy, iz) internally, use m_pppfDataSliceInd[iz][iy][ix] - */ - float32*** m_pppfDataSliceInd; - float32 m_fGlobalMin; ///< minimum value of the data float32 m_fGlobalMax; ///< maximum value of the data - /** Allocate memory for m_pfData, m_ppfDataRowInd and m_pppfDataSliceInd arrays. + /** Allocate memory for m_pfData. * * The allocated block consists of m_iSize float32s. The block is * not cleared after allocation and its contents is undefined. @@ -75,7 +63,7 @@ protected: */ void _allocateData(); - /** Free memory for m_pfData, m_ppfDataRowInd and m_pppfDataSliceInd arrays. + /** Free memory for m_pfData. * * This function may ONLY be called if the memory for both blocks has been * allocated before. @@ -299,23 +287,6 @@ inline const float32* CFloat32Data3DMemory::getDataConst() const return (const float32*)m_pfData; } -//---------------------------------------------------------------------------------------- -// Get a float32** to the data block, represented as a 3-dimensional array of float32 values. -inline float32*** CFloat32Data3DMemory::getData3D() -{ - ASTRA_ASSERT(m_bInitialized); - return m_pppfDataSliceInd; -} - -//---------------------------------------------------------------------------------------- -// Get a const float32** to the data block, represented as a 3-dimensional array of float32 values. -inline const float32*** CFloat32Data3DMemory::getData3DConst() const -{ - ASTRA_ASSERT(m_bInitialized); - return (const float32***)m_pppfDataSliceInd; -} -//---------------------------------------------------------------------------------------- - } // end namespace astra #endif // _INC_ASTRA_FLOAT32DATA2D diff --git a/python/astra/PyIncludes.pxd b/python/astra/PyIncludes.pxd index 512b82f..ec37d0a 100644 --- a/python/astra/PyIncludes.pxd +++ b/python/astra/PyIncludes.pxd @@ -211,7 +211,6 @@ cdef extern from "astra/Float32Data3DMemory.h" namespace "astra": CFloat32Data3DMemory() void updateStatistics() float32 *getData() - float32 ***getData3D() THREEEDataType getType() diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 0717ca0..897634b 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -254,7 +254,7 @@ cdef fillDataObjectScalar(CFloat32Data3DMemory * obj, float s): @cython.boundscheck(False) @cython.wraparound(False) cdef fillDataObjectArray(CFloat32Data3DMemory * obj, float [:,:,::1] data): - cdef float [:,:,::1] cView = obj.getData3D()[0][0] + cdef float [:,:,::1] cView = obj.getData() cView[:] = data cdef CFloat32Data3D * getObject(i) except NULL: @@ -271,7 +271,7 @@ def get(i): cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem_safe(getObject(i)) outArr = np.empty((pDataObject.getDepth(),pDataObject.getHeight(), pDataObject.getWidth()),dtype=np.float32,order='C') cdef float [:,:,::1] mView = outArr - cdef float [:,:,::1] cView = pDataObject.getData3D()[0][0] + cdef float [:,:,::1] cView = pDataObject.getData() mView[:] = cView return outArr @@ -282,7 +282,7 @@ def get_shared(i): shape[0] = pDataObject.getDepth() shape[1] = pDataObject.getHeight() shape[2] = pDataObject.getWidth() - return np.PyArray_SimpleNewFromData(3,shape,np.NPY_FLOAT32,pDataObject.getData3D()[0][0]) + return np.PyArray_SimpleNewFromData(3,shape,np.NPY_FLOAT32,pDataObject.getData()) def get_single(i): raise NotImplementedError("Not yet implemented") diff --git a/src/Float32Data3DMemory.cpp b/src/Float32Data3DMemory.cpp index 5c5c310..017625b 100644 --- a/src/Float32Data3DMemory.cpp +++ b/src/Float32Data3DMemory.cpp @@ -71,8 +71,6 @@ bool CFloat32Data3DMemory::_initialize(int _iWidth, int _iHeight, int _iDepth) // allocate memory for the data, but do not fill it m_pfData = NULL; - m_ppfDataRowInd = NULL; - m_pppfDataSliceInd = NULL; m_pCustomMemory = 0; _allocateData(); @@ -103,8 +101,6 @@ bool CFloat32Data3DMemory::_initialize(int _iWidth, int _iHeight, int _iDepth, c // allocate memory for the data, but do not fill it m_pfData = NULL; - m_ppfDataRowInd = NULL; - m_pppfDataSliceInd = NULL; m_pCustomMemory = 0; _allocateData(); @@ -140,8 +136,6 @@ bool CFloat32Data3DMemory::_initialize(int _iWidth, int _iHeight, int _iDepth, f // allocate memory for the data, but do not fill it m_pfData = NULL; - m_ppfDataRowInd = NULL; - m_pppfDataSliceInd = NULL; m_pCustomMemory = 0; _allocateData(); @@ -178,8 +172,6 @@ bool CFloat32Data3DMemory::_initialize(int _iWidth, int _iHeight, int _iDepth, C // allocate memory for the data, but do not fill it m_pCustomMemory = _pCustomMemory; m_pfData = NULL; - m_ppfDataRowInd = NULL; - m_pppfDataSliceInd = NULL; _allocateData(); // initialization complete @@ -198,8 +190,6 @@ void CFloat32Data3DMemory::_allocateData() ASTRA_ASSERT(m_iSize > 0); ASTRA_ASSERT(m_iSize == (size_t)m_iWidth * m_iHeight * m_iDepth); ASTRA_ASSERT(m_pfData == NULL); - ASTRA_ASSERT(m_ppfDataRowInd == NULL); - ASTRA_ASSERT(m_pppfDataSliceInd == NULL); if (!m_pCustomMemory) { // allocate contiguous block @@ -213,20 +203,6 @@ void CFloat32Data3DMemory::_allocateData() } else { m_pfData = m_pCustomMemory->m_fPtr; } - - // create array of pointers to each row of the data block - m_ppfDataRowInd = new float32*[m_iHeight*m_iDepth]; - for (int iy = 0; iy < m_iHeight*m_iDepth; iy++) - { - m_ppfDataRowInd[iy] = &(m_pfData[iy * m_iWidth]); - } - - // create array of pointers to each row of the data block - m_pppfDataSliceInd = new float32**[m_iDepth]; - for (int iy = 0; iy < m_iDepth; iy++) - { - m_pppfDataSliceInd[iy] = &(m_ppfDataRowInd[iy * m_iHeight]); - } } //---------------------------------------------------------------------------------------- @@ -235,13 +211,6 @@ void CFloat32Data3DMemory::_freeData() { // basic checks ASTRA_ASSERT(m_pfData != NULL); - ASTRA_ASSERT(m_ppfDataRowInd != NULL); - ASTRA_ASSERT(m_pppfDataSliceInd != NULL); - - // free memory for index table - delete[] m_pppfDataSliceInd; - // free memory for index table - delete[] m_ppfDataRowInd; if (!m_pCustomMemory) { // free memory for data block @@ -266,8 +235,6 @@ void CFloat32Data3DMemory::_clear() m_iSize = 0; m_pfData = NULL; - m_ppfDataRowInd = NULL; - m_pppfDataSliceInd = NULL; m_pCustomMemory = NULL; } -- cgit v1.2.3