From e8f6dd643fc04588cb8a8eaa8453c0eb6d40e236 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 28 Oct 2016 09:35:21 +0200 Subject: Remove unused data3d functions --- include/astra/Float32ProjectionData3D.h | 49 ------ include/astra/Float32ProjectionData3DMemory.h | 49 ------ include/astra/Float32VolumeData3D.h | 66 -------- include/astra/Float32VolumeData3DMemory.h | 49 ------ src/Float32ProjectionData3D.cpp | 226 -------------------------- src/Float32ProjectionData3DMemory.cpp | 96 ----------- src/Float32VolumeData3D.cpp | 222 ------------------------- src/Float32VolumeData3DMemory.cpp | 90 ---------- 8 files changed, 847 deletions(-) diff --git a/include/astra/Float32ProjectionData3D.h b/include/astra/Float32ProjectionData3D.h index ae0664b..1634eeb 100644 --- a/include/astra/Float32ProjectionData3D.h +++ b/include/astra/Float32ProjectionData3D.h @@ -85,55 +85,6 @@ public: */ virtual CFloat32Data3D::EDataType getType() const; - /** Fetch a COPY of a projection of the data. Note that if you update the 2D data slice, the data in the - * 3d data object will remain unaltered. To copy the data back in the 3D-volume you must return the data by calling 'returnProjection'. - * - * @param _iProjectionNr projection number - * @return Volume data object - */ - virtual CFloat32VolumeData2D* fetchProjection(int _iProjectionNr) const = 0; - - /** Return a projection slice to the 3d data. The data will be deleted. If the slice was fetched with - * 'fetchProjection', the data will be stored first. - * - * @param _iProjectionNr projection number - * @param _pProjection 2D Projection Data - */ - virtual void returnProjection(int _iProjectionNr, CFloat32VolumeData2D* _pProjection) = 0; - - /** Fetch a COPY of a sinogram slice of the data. Note that if you update the 2D data slice, the data in the - * 3d data object will remain unaltered. To copy the data back in the 3D-volume you must return the data by calling 'returnSlice'. - * - * @param _iSliceNr slice number - * @return Sinogram data object - */ - virtual CFloat32ProjectionData2D* fetchSinogram(int _iSliceNr) const = 0; - - /** Return a sinogram slice to the 3d data. The data will be stored in the 3D Data object. - * - * @param _iSliceNr slice number - * @param _pSinogram2D 2D Sinogram Object. - */ - virtual void returnSinogram(int _iSliceNr, CFloat32ProjectionData2D* _pSinogram2D) = 0; - - /** This SLOW function returns a detector value stored a specific index in the array. - * Reading values in this way might cause a lot of unnecessar__y memory operations, don't - * use it in time-critical code. - * - * @param _iIndex Index in the array if the data were stored completely in main memory - * @return The value the location specified by _iIndex - */ - virtual float32 getDetectorValue(int _iIndex) = 0; - - /** This SLOW function stores a detector value at a specific index in the array. - * Writing values in this way might cause a lot of unnecessary memory operations, don't - * use it in time-critical code. - * - * @param _iIndex Index in the array if the data were stored completely in main memory - * @param _fValue The value to be stored at the location specified by _iIndex - */ - virtual void setDetectorValue(int _iIndex, float32 _fValue) = 0; - /** * Overloaded Operator: data += data (pointwise) * diff --git a/include/astra/Float32ProjectionData3DMemory.h b/include/astra/Float32ProjectionData3DMemory.h index 14bae36..732c31a 100644 --- a/include/astra/Float32ProjectionData3DMemory.h +++ b/include/astra/Float32ProjectionData3DMemory.h @@ -166,55 +166,6 @@ public: - /** Fetch a COPY of a projection of the data. Note that if you update the 2D data slice, the data in the - * 3D data object will remain unaltered. To copy the data back in the 3D-volume you must return the data by calling 'returnProjection'. - * - * @param _iProjectionNr projection number - * @return Volume data object - */ - virtual CFloat32VolumeData2D* fetchProjection(int _iProjectionNr) const; - - /** Return a projection slice to the 3D data. The data will be deleted. If the slice was fetched with - * 'fetchProjection', the data will be stored first. - * - * @param _iProjectionNr projection number - * @param _pProjection 2D Projection image - */ - virtual void returnProjection(int _iProjectionNr, CFloat32VolumeData2D* _pProjection); - - /** Fetch a COPY of a sinogram slice of the data. Note that if you update the 2D data slice, the data in the - * 3D data object will remain unaltered. To copy the data back in the 3D-volume you must return the data by calling 'returnSlice'. - * - * @param _iSliceNr slice number - * @return Sinogram data object - */ - virtual CFloat32ProjectionData2D* fetchSinogram(int _iSliceNr) const; - - /** This SLOW function returns a detector value stored a specific index in the array. - * Reading values in this way might cause a lot of unnecessary memory operations, don't - * use it in time-critical code. - * - * @param _iIndex Index in the array if the data were stored completely in main memory - * @return The value the location specified by _iIndex - */ - virtual float32 getDetectorValue(int _iIndex); - - /** This SLOW function stores a detector value at a specific index in the array. - * Writing values in this way might cause a lot of unnecessary memory operations, don't - * use it in time-critical code. - * - * @param _iIndex Index in the array if the data were stored completely in main memory - * @param _fValue The value to be stored at the location specified by _iIndex - */ - virtual void setDetectorValue(int _iIndex, float32 _fValue); - - /** Return a sinogram slice to the 3d data. The data will be stored in the 3D Data object. - * - * @param _iSliceNr slice number - * @param _pSinogram2D 2D Sinogram Object. - */ - virtual void returnSinogram(int _iSliceNr, CFloat32ProjectionData2D* _pSinogram2D); - /** Which type is this class? * * @return DataType: PROJECTION diff --git a/include/astra/Float32VolumeData3D.h b/include/astra/Float32VolumeData3D.h index 7a32efe..535e960 100644 --- a/include/astra/Float32VolumeData3D.h +++ b/include/astra/Float32VolumeData3D.h @@ -85,72 +85,6 @@ public: */ virtual CFloat32Data3D::EDataType getType() const; - /** Fetch a slice from the data in the x direction. Note that if you update the 2D data slice, the data in the - * 3d data object will remain unaltered. To copy the data you must return the data by calling 'returnSliceX'. - * You should not delete data fetched with this function yourself, instead call the 'returnSliceX' function. - * - * @param _iColumnIndex slice number - * @return Volume data object - */ - virtual CFloat32VolumeData2D* fetchSliceX(int _iColumnIndex) const = 0; - - /** Fetch a slice from the data in the y direction. Note that if you update the 2D data slice, the data in the - * 3d data object will remain unaltered. To copy the data you must return the data by calling 'returnSliceY'. - * You should not delete data fetched with this function yourself, instead call the 'returnSliceY' function. - * - * @param _iRowIndex slice number - * @return Volume data object - */ - virtual CFloat32VolumeData2D* fetchSliceY(int _iRowIndex) const = 0; - - /** Fetch a slice from the data in the z direction. Note that if you update the 2D data slice, the data in the - * 3d data object will remain unaltered. To copy the data you must return the data by calling 'returnSliceZ'. - * You should not delete data fetched with this function yourself, instead call the 'returnSliceZ' function. - * - * @param _iSliceIndex slice number - * @return Volume data object - */ - virtual CFloat32VolumeData2D* fetchSliceZ(int _iSliceIndex) const = 0; - - /** Return a slice from the data in the x direction to the 3d data. The data will be deleted. If the slice was - * fetched with 'fetchSliceX', the data will be stored first. - * - * @param _iColumnIndex slice number - */ - virtual void returnSliceX(int _iColumnIndex, CFloat32VolumeData2D * _pSlice) = 0; - - /** Return a slice from the data in the y direction to the 3d data. The data will be deleted. If the slice was - * fetched with 'fetchSliceY', the data will be stored first. - * - * @param _iRowIndex slice number - */ - virtual void returnSliceY(int _iRowIndex, CFloat32VolumeData2D * _pSlice) = 0; - - /** Return a slice from the data in the z direction to the 3d data. The data will be deleted. If the slice was - * fetched with 'fetchSliceZ', the data will be stored first. - * - * @param _iSliceIndex slice number - */ - virtual void returnSliceZ(int _iSliceIndex, CFloat32VolumeData2D * _pSlice) = 0; - - /** This SLOW function returns a voxel value stored at a specific index in the array. - * Reading values in this way might cause a lot of unnecessary memory operations, don't - * use it in time-critical code. - * - * @param _iIndex Index in the array if the data were stored completely in main memory - * @return The value stored at the location specified by _iIndex - */ - virtual float32 getVoxelValue(int _iIndex) = 0; - - /** This SLOW function stores a voxel value at a specific index in the array. - * Writing values in this way might cause a lot of unnecessary memory operations, don't - * use it in time-critical code. - * - * @param _iIndex Index in the array if the data were stored completely in main memory - * @param _fValue The value to be stored at the location specified by _iIndex - */ - virtual void setVoxelValue(int _iIndex, float32 _fValue) = 0; - /** * Overloaded Operator: data += data (pointwise) * diff --git a/include/astra/Float32VolumeData3DMemory.h b/include/astra/Float32VolumeData3DMemory.h index 70f0939..4a70f65 100644 --- a/include/astra/Float32VolumeData3DMemory.h +++ b/include/astra/Float32VolumeData3DMemory.h @@ -158,55 +158,6 @@ public: */ CVolumeGeometry3D* getGeometry() const; - /** - * Gets a slice, containing all voxels with a given x (= column) index. - */ - CFloat32VolumeData2D * fetchSliceX(int _iColumnIndex) const; - - /** - * Gets a slice, containing all voxels with a given y (= row) index. - */ - CFloat32VolumeData2D * fetchSliceY(int _iRowIndex) const; - - /** - * Gets a slice, containing all voxels with a given z (= slice) index. - */ - CFloat32VolumeData2D * fetchSliceZ(int _iSliceIndex) const; - - /** - * Gets a slice, containing all voxels with a given x (= column) index. - */ - void returnSliceX(int _iColumnIndex, CFloat32VolumeData2D * _pSliceData); - - /** - * Gets a slice, containing all voxels with a given y (= row) index. - */ - void returnSliceY(int _iRowIndex, CFloat32VolumeData2D * _pSliceData); - - /** - * Copies data from a 2D slice containing all voxels with a given z (= slice) index to the - * 3D memory stored in this class. - */ - void returnSliceZ(int _iSliceIndex, CFloat32VolumeData2D * _pSliceData); - - /** This SLOW function returns a volume value stored a specific index in the array. - * Reading values in this way might cause a lot of unnecessary memory operations, don't - * use it in time-critical code. - * - * @param _iIndex Index in the array if the data were stored completely in main memory - * @return The value the location specified by _iIndex - */ - virtual float32 getVoxelValue(int _iIndex); - - /** This SLOW function stores a voxel value at a specific index in the array. - * Writing values in this way might cause a lot of unnecessary memory operations, don't - * use it in time-critical code. - * - * @param _iIndex Index in the array if the data were stored completely in main memory - * @param _fValue The value to be stored at the location specified by _iIndex - */ - virtual void setVoxelValue(int _iIndex, float32 _fValue); - /** * Overloaded Operator: data = data (pointwise) * diff --git a/src/Float32ProjectionData3D.cpp b/src/Float32ProjectionData3D.cpp index c751c58..ba41e10 100644 --- a/src/Float32ProjectionData3D.cpp +++ b/src/Float32ProjectionData3D.cpp @@ -47,232 +47,6 @@ CFloat32ProjectionData3D::~CFloat32ProjectionData3D() { m_pGeometry = 0; } -CFloat32ProjectionData3D& CFloat32ProjectionData3D::operator+=(const CFloat32ProjectionData3D& _data) -{ - CProjectionGeometry3D * pThisGeometry = getGeometry(); - - int iProjectionCount = pThisGeometry->getProjectionCount(); - int iDetectorCount = pThisGeometry->getDetectorTotCount(); -#ifdef _DEBUG - CProjectionGeometry3D * pDataGeometry = _data.getGeometry(); - int iDataProjectionDetectorCount = pDataGeometry->getDetectorTotCount(); - - ASTRA_ASSERT(iProjectionCount == pDataGeometry->getProjectionCount()); - ASTRA_ASSERT(iDetectorCount == iDataProjectionDetectorCount); -#endif - - for(int iProjectionIndex = 0; iProjectionIndex < iProjectionCount; iProjectionIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchProjection(iProjectionIndex); - CFloat32VolumeData2D * pDataProjection = _data.fetchProjection(iProjectionIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorCount; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - float32 fDataValue = pDataProjection->getDataConst()[iDetectorIndex]; - - fThisValue += fDataValue; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnProjection(iProjectionIndex, pThisProjection); - - delete pThisProjection; - delete pDataProjection; - } - - return *this; -} - -CFloat32ProjectionData3D& CFloat32ProjectionData3D::operator-=(const CFloat32ProjectionData3D& _data) -{ - CProjectionGeometry3D * pThisGeometry = getGeometry(); - - int iProjectionCount = pThisGeometry->getProjectionCount(); - int iDetectorCount = pThisGeometry->getDetectorTotCount(); -#ifdef _DEBUG - CProjectionGeometry3D * pDataGeometry = _data.getGeometry(); - int iDataProjectionDetectorCount = pDataGeometry->getDetectorTotCount(); - - ASTRA_ASSERT(iProjectionCount == pDataGeometry->getProjectionCount()); - ASTRA_ASSERT(iDetectorCount == iDataProjectionDetectorCount); -#endif - - for(int iProjectionIndex = 0; iProjectionIndex < iProjectionCount; iProjectionIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchProjection(iProjectionIndex); - CFloat32VolumeData2D * pDataProjection = _data.fetchProjection(iProjectionIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorCount; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - float32 fDataValue = pDataProjection->getDataConst()[iDetectorIndex]; - - fThisValue -= fDataValue; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnProjection(iProjectionIndex, pThisProjection); - - delete pThisProjection; - delete pDataProjection; - } - - return *this; -} - -CFloat32ProjectionData3D& CFloat32ProjectionData3D::operator*=(const CFloat32ProjectionData3D& _data) -{ - CProjectionGeometry3D * pThisGeometry = getGeometry(); - - int iProjectionCount = pThisGeometry->getProjectionCount(); - int iDetectorCount = pThisGeometry->getDetectorTotCount(); -#ifdef _DEBUG - CProjectionGeometry3D * pDataGeometry = _data.getGeometry(); - int iDataProjectionDetectorCount = pDataGeometry->getDetectorTotCount(); - - ASTRA_ASSERT(iProjectionCount == pDataGeometry->getProjectionCount()); - ASTRA_ASSERT(iDetectorCount == iDataProjectionDetectorCount); -#endif - - for(int iProjectionIndex = 0; iProjectionIndex < iProjectionCount; iProjectionIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchProjection(iProjectionIndex); - CFloat32VolumeData2D * pDataProjection = _data.fetchProjection(iProjectionIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorCount; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - float32 fDataValue = pDataProjection->getDataConst()[iDetectorIndex]; - - fThisValue *= fDataValue; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnProjection(iProjectionIndex, pThisProjection); - - delete pThisProjection; - delete pDataProjection; - } - - return *this; -} - -CFloat32ProjectionData3D& CFloat32ProjectionData3D::operator*=(const float32& _fScalar) -{ - CProjectionGeometry3D * pThisGeometry = getGeometry(); - - int iProjectionCount = pThisGeometry->getProjectionCount(); - int iDetectorCount = pThisGeometry->getDetectorTotCount(); - - for(int iProjectionIndex = 0; iProjectionIndex < iProjectionCount; iProjectionIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchProjection(iProjectionIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorCount; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - - fThisValue *= _fScalar; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnProjection(iProjectionIndex, pThisProjection); - - delete pThisProjection; - } - - return *this; -} - -CFloat32ProjectionData3D& CFloat32ProjectionData3D::operator/=(const float32& _fScalar) -{ - CProjectionGeometry3D * pThisGeometry = getGeometry(); - - int iProjectionCount = pThisGeometry->getProjectionCount(); - int iDetectorCount = pThisGeometry->getDetectorTotCount(); - - for(int iProjectionIndex = 0; iProjectionIndex < iProjectionCount; iProjectionIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchProjection(iProjectionIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorCount; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - - fThisValue /= _fScalar; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnProjection(iProjectionIndex, pThisProjection); - - delete pThisProjection; - } - - return *this; -} - -CFloat32ProjectionData3D& CFloat32ProjectionData3D::operator+=(const float32& _fScalar) -{ - CProjectionGeometry3D * pThisGeometry = getGeometry(); - - int iProjectionCount = pThisGeometry->getProjectionCount(); - int iDetectorCount = pThisGeometry->getDetectorTotCount(); - - for(int iProjectionIndex = 0; iProjectionIndex < iProjectionCount; iProjectionIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchProjection(iProjectionIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorCount; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - - fThisValue += _fScalar; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnProjection(iProjectionIndex, pThisProjection); - - delete pThisProjection; - } - - return *this; -} - -CFloat32ProjectionData3D& CFloat32ProjectionData3D::operator-=(const float32& _fScalar) -{ - CProjectionGeometry3D * pThisGeometry = getGeometry(); - - int iProjectionCount = pThisGeometry->getProjectionCount(); - int iDetectorCount = pThisGeometry->getDetectorTotCount(); - - for(int iProjectionIndex = 0; iProjectionIndex < iProjectionCount; iProjectionIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchProjection(iProjectionIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorCount; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - - fThisValue -= _fScalar; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnProjection(iProjectionIndex, pThisProjection); - - delete pThisProjection; - } - - return *this; -} - void CFloat32ProjectionData3D::changeGeometry(CProjectionGeometry3D* _pGeometry) { if (!m_bInitialized) return; diff --git a/src/Float32ProjectionData3DMemory.cpp b/src/Float32ProjectionData3DMemory.cpp index f42e216..81daf9e 100644 --- a/src/Float32ProjectionData3DMemory.cpp +++ b/src/Float32ProjectionData3DMemory.cpp @@ -130,102 +130,6 @@ CFloat32ProjectionData3DMemory::~CFloat32ProjectionData3DMemory() //_unInit(); //delete stuff inherited from CFloat32Data3DMemory } -//---------------------------------------------------------------------------------------- -// Fetch a projection -CFloat32VolumeData2D* CFloat32ProjectionData3DMemory::fetchProjection(int _iProjectionNr) const -{ - // fetch slice of the geometry - CVolumeGeometry2D volGeom(m_pGeometry->getDetectorColCount(), m_pGeometry->getDetectorRowCount()); - // create new volume data - CFloat32VolumeData2D* res = new CFloat32VolumeData2D(&volGeom); - // copy data - int row, col; - for (row = 0; row < m_pGeometry->getDetectorRowCount(); ++row) { - for (col = 0; col < m_pGeometry->getDetectorColCount(); ++col) { - res->getData()[row*m_pGeometry->getDetectorColCount() + col] = - m_pfData[_iProjectionNr * m_pGeometry->getDetectorColCount() + m_pGeometry->getDetectorColCount()* m_pGeometry->getProjectionCount() * row + col]; - } - } - // return - return res; -} - -//---------------------------------------------------------------------------------------- -// Return a projection -void CFloat32ProjectionData3DMemory::returnProjection(int _iProjectionNr, CFloat32VolumeData2D* _pProjection) -{ - /// TODO: check geometry - // copy data - int row, col; - for (row = 0; row < m_pGeometry->getDetectorRowCount(); ++row) { - for (col = 0; col < m_pGeometry->getDetectorColCount(); ++col) { - m_pfData[_iProjectionNr * m_pGeometry->getDetectorColCount() + m_pGeometry->getDetectorColCount()* m_pGeometry->getProjectionCount() * row + col] = - _pProjection->getData()[row*m_pGeometry->getDetectorColCount() + col]; - } - } -} - -//---------------------------------------------------------------------------------------- -// Fetch a sinogram -CFloat32ProjectionData2D* CFloat32ProjectionData3DMemory::fetchSinogram(int _iSliceNr) const -{ - CParallelProjectionGeometry3D * pParallelProjGeo = (CParallelProjectionGeometry3D *)m_pGeometry; - CParallelProjectionGeometry2D * pProjGeo2D = pParallelProjGeo->createProjectionGeometry2D(); - - // create new projection data - CFloat32ProjectionData2D* res = new CFloat32ProjectionData2D(pProjGeo2D); - // copy data - int row, col; - - int iDetectorColumnCount = m_pGeometry->getDetectorColCount(); - int iProjectionAngleCount = m_pGeometry->getProjectionCount(); - - for (row = 0; row < m_pGeometry->getProjectionCount(); ++row) { - for (col = 0; col < m_pGeometry->getDetectorColCount(); ++col) - { - int iTargetIndex = row * iDetectorColumnCount + col; - int iSourceIndex = _iSliceNr * iDetectorColumnCount * iProjectionAngleCount + row * iDetectorColumnCount + col; - - float32 fStoredValue = m_pfData[iSourceIndex]; - - res->getData()[iTargetIndex] = fStoredValue; - } - } - - delete pProjGeo2D; - - // return - return res; -} - -//---------------------------------------------------------------------------------------- -// Return a sinogram -void CFloat32ProjectionData3DMemory::returnSinogram(int _iSliceNr, CFloat32ProjectionData2D* _pSinogram2D) -{ - /// TODO: check geometry - // copy data - int row, col; - for (row = 0; row < m_pGeometry->getProjectionCount(); ++row) { - for (col = 0; col < m_pGeometry->getDetectorColCount(); ++col) { - m_pfData[_iSliceNr*m_pGeometry->getDetectorColCount()*m_pGeometry->getProjectionCount() + row*m_pGeometry->getDetectorColCount() + col] = - _pSinogram2D->getData()[row*m_pGeometry->getDetectorColCount() + col]; - } - } -} - -//---------------------------------------------------------------------------------------- -// Returns a specific value -float32 CFloat32ProjectionData3DMemory::getDetectorValue(int _iIndex) -{ - return m_pfData[_iIndex]; -} - -//---------------------------------------------------------------------------------------- -// Sets a specific value -void CFloat32ProjectionData3DMemory::setDetectorValue(int _iIndex, float32 _fValue) -{ - m_pfData[_iIndex] = _fValue; -} //---------------------------------------------------------------------------------------- CFloat32ProjectionData3DMemory& CFloat32ProjectionData3DMemory::operator=(const CFloat32ProjectionData3DMemory& _dataIn) diff --git a/src/Float32VolumeData3D.cpp b/src/Float32VolumeData3D.cpp index bf7eced..96e6940 100644 --- a/src/Float32VolumeData3D.cpp +++ b/src/Float32VolumeData3D.cpp @@ -43,228 +43,6 @@ CFloat32VolumeData3D::~CFloat32VolumeData3D() { } -CFloat32VolumeData3D& CFloat32VolumeData3D::operator+=(const CFloat32VolumeData3D& _data) -{ - CVolumeGeometry3D * pThisGeometry = getGeometry(); - - int iSliceCount = pThisGeometry->getGridSliceCount(); -#ifdef _DEBUG - CVolumeGeometry3D * pDataGeometry = _data.getGeometry(); - int iThisSlicePixelCount = pThisGeometry->getGridRowCount() * pThisGeometry->getGridColCount(); - int iDataSlicePixelCount = pDataGeometry->getGridRowCount() * pDataGeometry->getGridColCount(); - - ASTRA_ASSERT(iSliceCount == pDataGeometry->getGridSliceCount()); - ASTRA_ASSERT(iThisSlicePixelCount == iDataSlicePixelCount); -#endif - - for(int iSliceIndex = 0; iSliceIndex < iSliceCount; iSliceIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchSliceZ(iSliceIndex); - CFloat32VolumeData2D * pDataProjection = _data.fetchSliceZ(iSliceIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorIndex; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - float32 fDataValue = pDataProjection->getDataConst()[iDetectorIndex]; - - fThisValue += fDataValue; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnSliceZ(iSliceIndex, pThisProjection); - - delete pThisProjection; - delete pDataProjection; - } - - return *this; -} - -CFloat32VolumeData3D& CFloat32VolumeData3D::operator-=(const CFloat32VolumeData3D& _data) -{ - CVolumeGeometry3D * pThisGeometry = getGeometry(); - - int iSliceCount = pThisGeometry->getGridSliceCount(); -#ifdef _DEBUG - CVolumeGeometry3D * pDataGeometry = _data.getGeometry(); - int iThisSlicePixelCount = pThisGeometry->getGridRowCount() * pThisGeometry->getGridColCount(); - int iDataSlicePixelCount = pDataGeometry->getGridRowCount() * pDataGeometry->getGridColCount(); - - ASTRA_ASSERT(iSliceCount == pDataGeometry->getGridSliceCount()); - ASTRA_ASSERT(iThisSlicePixelCount == iDataSlicePixelCount); -#endif - - for(int iSliceIndex = 0; iSliceIndex < iSliceCount; iSliceIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchSliceZ(iSliceIndex); - CFloat32VolumeData2D * pDataProjection = _data.fetchSliceZ(iSliceIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorIndex; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - float32 fDataValue = pDataProjection->getDataConst()[iDetectorIndex]; - - fThisValue -= fDataValue; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnSliceZ(iSliceIndex, pThisProjection); - - delete pThisProjection; - delete pDataProjection; - } - - return *this; -} - -CFloat32VolumeData3D& CFloat32VolumeData3D::operator*=(const CFloat32VolumeData3D& _data) -{ - CVolumeGeometry3D * pThisGeometry = getGeometry(); - - int iSliceCount = pThisGeometry->getGridSliceCount(); -#ifdef _DEBUG - CVolumeGeometry3D * pDataGeometry = _data.getGeometry(); - int iThisSlicePixelCount = pThisGeometry->getGridRowCount() * pThisGeometry->getGridColCount(); - int iDataSlicePixelCount = pDataGeometry->getGridRowCount() * pDataGeometry->getGridColCount(); - - ASTRA_ASSERT(iSliceCount == pDataGeometry->getGridSliceCount()); - ASTRA_ASSERT(iThisSlicePixelCount == iDataSlicePixelCount); -#endif - - for(int iSliceIndex = 0; iSliceIndex < iSliceCount; iSliceIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchSliceZ(iSliceIndex); - CFloat32VolumeData2D * pDataProjection = _data.fetchSliceZ(iSliceIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorIndex; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - float32 fDataValue = pDataProjection->getDataConst()[iDetectorIndex]; - - fThisValue *= fDataValue; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnSliceZ(iSliceIndex, pThisProjection); - - delete pThisProjection; - delete pDataProjection; - } - - return *this; -} - -CFloat32VolumeData3D& CFloat32VolumeData3D::operator*=(const float32& _fScalar) -{ - CVolumeGeometry3D * pThisGeometry = getGeometry(); - - int iSliceCount = pThisGeometry->getGridSliceCount(); - - for(int iSliceIndex = 0; iSliceIndex < iSliceCount; iSliceIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchSliceZ(iSliceIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorIndex; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - - fThisValue *= _fScalar; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnSliceZ(iSliceIndex, pThisProjection); - - delete pThisProjection; - } - - return *this; -} - -CFloat32VolumeData3D& CFloat32VolumeData3D::operator/=(const float32& _fScalar) -{ - CVolumeGeometry3D * pThisGeometry = getGeometry(); - - int iSliceCount = pThisGeometry->getGridSliceCount(); - - for(int iSliceIndex = 0; iSliceIndex < iSliceCount; iSliceIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchSliceZ(iSliceIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorIndex; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - - fThisValue /= _fScalar; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnSliceZ(iSliceIndex, pThisProjection); - - delete pThisProjection; - } - - return *this; -} - -CFloat32VolumeData3D& CFloat32VolumeData3D::operator+=(const float32& _fScalar) -{ - CVolumeGeometry3D * pThisGeometry = getGeometry(); - - int iSliceCount = pThisGeometry->getGridSliceCount(); - - for(int iSliceIndex = 0; iSliceIndex < iSliceCount; iSliceIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchSliceZ(iSliceIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorIndex; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - - fThisValue += _fScalar; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnSliceZ(iSliceIndex, pThisProjection); - - delete pThisProjection; - } - - return *this; -} - -CFloat32VolumeData3D& CFloat32VolumeData3D::operator-=(const float32& _fScalar) -{ - CVolumeGeometry3D * pThisGeometry = getGeometry(); - - int iSliceCount = pThisGeometry->getGridSliceCount(); - - for(int iSliceIndex = 0; iSliceIndex < iSliceCount; iSliceIndex++) - { - CFloat32VolumeData2D * pThisProjection = fetchSliceZ(iSliceIndex); - - for(int iDetectorIndex = 0; iDetectorIndex < iDetectorIndex; iDetectorIndex++) - { - float32 fThisValue = pThisProjection->getData()[iDetectorIndex]; - - fThisValue -= _fScalar; - - pThisProjection->getData()[iDetectorIndex] = fThisValue; - } - - returnSliceZ(iSliceIndex, pThisProjection); - - delete pThisProjection; - } - - return *this; -} - void CFloat32VolumeData3D::changeGeometry(CVolumeGeometry3D* _pGeometry) { if (!m_bInitialized) return; diff --git a/src/Float32VolumeData3DMemory.cpp b/src/Float32VolumeData3DMemory.cpp index ba39eaa..9f81c85 100644 --- a/src/Float32VolumeData3DMemory.cpp +++ b/src/Float32VolumeData3DMemory.cpp @@ -121,96 +121,6 @@ bool CFloat32VolumeData3DMemory::initialize(CVolumeGeometry3D* _pGeometry, CFloa return m_bInitialized; } - -//---------------------------------------------------------------------------------------- -// Fetch a slice -CFloat32VolumeData2D * CFloat32VolumeData3DMemory::fetchSliceZ(int _iSliceIndex) const -{ - // fetch slice of the geometry - int iRowCount = m_pGeometry->getGridRowCount(); - int iColumnCount = m_pGeometry->getGridColCount(); - CVolumeGeometry2D volGeom(iColumnCount, iRowCount); - - // create new volume data - CFloat32VolumeData2D* res = new CFloat32VolumeData2D(&volGeom); - - // copy data - float * pfTargetData = res->getData(); - for(int iRowIndex = 0; iRowIndex < iRowCount; iRowIndex++) - { - for(int iColumnIndex = 0; iColumnIndex < iColumnCount; iColumnIndex++) - { - int iSourceIndex = _iSliceIndex * iColumnCount * iRowCount + iRowIndex * iColumnCount + iColumnIndex; - int iTargetIndex = iRowIndex * iColumnCount + iColumnIndex; - float fStoredValue = m_pfData[iSourceIndex]; - pfTargetData[iTargetIndex] = fStoredValue; - } - } - // return - return res; -} - -//---------------------------------------------------------------------------------------- -// Return a slice -void CFloat32VolumeData3DMemory::returnSliceZ(int _iSliceIndex, CFloat32VolumeData2D * _pSlice) -{ - int iRowCount = _pSlice->getGeometry()->getGridRowCount(); - int iColumnCount = _pSlice->getGeometry()->getGridColCount(); - - assert(iRowCount == m_pGeometry->getGridRowCount()); - assert(iColumnCount == m_pGeometry->getGridColCount()); - - for(int iRowIndex = 0; iRowIndex < iRowCount; iRowIndex++) - { - for(int iColumnIndex = 0; iColumnIndex < iColumnCount; iColumnIndex++) - { - int iSourceIndex = iRowIndex * iColumnCount + iColumnIndex; - int iTargetIndex = _iSliceIndex * iColumnCount * iRowCount + iRowIndex * iColumnCount + iColumnIndex; - float fStoredValue = _pSlice->getDataConst()[iSourceIndex]; - m_pfData[iTargetIndex] = fStoredValue; - } - } -} - -CFloat32VolumeData2D * CFloat32VolumeData3DMemory::fetchSliceX(int _iColumnIndex) const -{ - // TODO: - assert(false); - return NULL; -} - -CFloat32VolumeData2D * CFloat32VolumeData3DMemory::fetchSliceY(int _iRowIndex) const -{ - // TODO: - assert(false); - return NULL; -} - -void CFloat32VolumeData3DMemory::returnSliceX(int _iColumnIndex, CFloat32VolumeData2D * _pSliceData) -{ - // TODO: - assert(false); -} - -void CFloat32VolumeData3DMemory::returnSliceY(int _iRowIndex, CFloat32VolumeData2D * _pSliceData) -{ - // TODO: - assert(false); -} - -//---------------------------------------------------------------------------------------- -// Returns a specific value -float32 CFloat32VolumeData3DMemory::getVoxelValue(int _iIndex) -{ - return m_pfData[_iIndex]; -} - -//---------------------------------------------------------------------------------------- -// Sets a specific value -void CFloat32VolumeData3DMemory::setVoxelValue(int _iIndex, float32 _fValue) -{ - m_pfData[_iIndex] = _fValue; -} //---------------------------------------------------------------------------------------- CFloat32VolumeData3DMemory& CFloat32VolumeData3DMemory::operator=(const CFloat32VolumeData3DMemory& _dataIn) -- cgit v1.2.3