summaryrefslogtreecommitdiffstats
path: root/include/astra
diff options
context:
space:
mode:
Diffstat (limited to 'include/astra')
-rw-r--r--include/astra/AstraObjectFactory.h55
-rw-r--r--include/astra/CompositeGeometryManager.h152
-rw-r--r--include/astra/ConeProjectionGeometry3D.h10
-rw-r--r--include/astra/ConeVecProjectionGeometry3D.h11
-rw-r--r--include/astra/CudaBackProjectionAlgorithm.h5
-rw-r--r--include/astra/CudaBackProjectionAlgorithm3D.h2
-rw-r--r--include/astra/CudaCglsAlgorithm.h9
-rw-r--r--include/astra/CudaCglsAlgorithm3D.h2
-rw-r--r--include/astra/CudaEMAlgorithm.h10
-rw-r--r--include/astra/CudaFDKAlgorithm3D.h2
-rw-r--r--include/astra/CudaFilteredBackProjectionAlgorithm.h3
-rw-r--r--include/astra/CudaForwardProjectionAlgorithm.h29
-rw-r--r--include/astra/CudaForwardProjectionAlgorithm3D.h1
-rw-r--r--include/astra/CudaProjector2D.h2
-rw-r--r--include/astra/CudaProjector3D.h2
-rw-r--r--include/astra/CudaReconstructionAlgorithm2D.h22
-rw-r--r--include/astra/CudaSartAlgorithm.h9
-rw-r--r--include/astra/CudaSirtAlgorithm.h11
-rw-r--r--include/astra/CudaSirtAlgorithm3D.h2
-rw-r--r--include/astra/GeometryUtil3D.h70
-rw-r--r--include/astra/Globals.h6
-rw-r--r--include/astra/ParallelProjectionGeometry3D.h11
-rw-r--r--include/astra/ParallelVecProjectionGeometry3D.h10
-rw-r--r--include/astra/PluginAlgorithm.h90
-rw-r--r--include/astra/ProjectionGeometry3D.h19
-rw-r--r--include/astra/ReconstructionAlgorithm2D.h3
26 files changed, 459 insertions, 89 deletions
diff --git a/include/astra/AstraObjectFactory.h b/include/astra/AstraObjectFactory.h
index 1ed4955..325989e 100644
--- a/include/astra/AstraObjectFactory.h
+++ b/include/astra/AstraObjectFactory.h
@@ -40,6 +40,10 @@ $Id$
#include "AlgorithmTypelist.h"
+#ifdef ASTRA_PYTHON
+#include "PluginAlgorithm.h"
+#endif
+
namespace astra {
@@ -59,20 +63,27 @@ public:
*/
~CAstraObjectFactory();
- /** Create, but don't initialize, a new projector object.
+ /** Create, but don't initialize, a new object.
*
- * @param _sType Type of the new projector.
- * @return Pointer to a new, unitialized projector.
+ * @param _sType Type of the new object.
+ * @return Pointer to a new, uninitialized object.
*/
T* create(std::string _sType);
- /** Create and initialize a new projector object.
+ /** Create and initialize a new object.
*
- * @param _cfg Configuration object to create and initialize a new projector.
+ * @param _cfg Configuration object to create and initialize a new object.
* @return Pointer to a new, initialized projector.
*/
T* create(const Config& _cfg);
+ /** Find a plugin.
+ *
+ * @param _sType Name of plugin to find.
+ * @return Pointer to a new, uninitialized object, or NULL if not found.
+ */
+ T* findPlugin(std::string _sType);
+
};
@@ -93,6 +104,15 @@ CAstraObjectFactory<T, TypeList>::~CAstraObjectFactory()
}
+
+//----------------------------------------------------------------------------------------
+// Hook for finding plugin in registered plugins.
+template <typename T, typename TypeList>
+T* CAstraObjectFactory<T, TypeList>::findPlugin(std::string _sType)
+{
+ return NULL;
+}
+
//----------------------------------------------------------------------------------------
// Create
template <typename T, typename TypeList>
@@ -101,6 +121,9 @@ T* CAstraObjectFactory<T, TypeList>::create(std::string _sType)
functor_find<T> finder = functor_find<T>();
finder.tofind = _sType;
CreateObject<TypeList>::find(finder);
+ if (finder.res == NULL) {
+ finder.res = findPlugin(_sType);
+ }
return finder.res;
}
@@ -109,14 +132,11 @@ T* CAstraObjectFactory<T, TypeList>::create(std::string _sType)
template <typename T, typename TypeList>
T* CAstraObjectFactory<T, TypeList>::create(const Config& _cfg)
{
- functor_find<T> finder = functor_find<T>();
- finder.tofind = _cfg.self.getAttribute("type");
- CreateObject<TypeList>::find(finder);
- if (finder.res == NULL) return NULL;
- if (finder.res->initialize(_cfg))
- return finder.res;
-
- delete finder.res;
+ T* object = create(_cfg.self.getAttribute("type"));
+ if (object == NULL) return NULL;
+ if (object->initialize(_cfg))
+ return object;
+ delete object;
return NULL;
}
//----------------------------------------------------------------------------------------
@@ -131,6 +151,15 @@ T* CAstraObjectFactory<T, TypeList>::create(const Config& _cfg)
*/
class _AstraExport CAlgorithmFactory : public CAstraObjectFactory<CAlgorithm, AlgorithmTypeList> {};
+#ifdef ASTRA_PYTHON
+template <>
+inline CAlgorithm* CAstraObjectFactory<CAlgorithm, AlgorithmTypeList>::findPlugin(std::string _sType)
+ {
+ CPluginAlgorithmFactory *fac = CPluginAlgorithmFactory::getSingletonPtr();
+ return fac->getPlugin(_sType);
+ }
+#endif
+
/**
* Class used to create 2D projectors from a string or a config object
*/
diff --git a/include/astra/CompositeGeometryManager.h b/include/astra/CompositeGeometryManager.h
new file mode 100644
index 0000000..6610151
--- /dev/null
+++ b/include/astra/CompositeGeometryManager.h
@@ -0,0 +1,152 @@
+/*
+-----------------------------------------------------------------------
+Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp
+ 2014-2015, CWI, Amsterdam
+
+Contact: astra@uantwerpen.be
+Website: http://sf.net/projects/astra-toolbox
+
+This file is part of the ASTRA Toolbox.
+
+
+The ASTRA Toolbox is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+The ASTRA Toolbox is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
+
+-----------------------------------------------------------------------
+*/
+
+#ifndef _INC_ASTRA_COMPOSITEGEOMETRYMANAGER
+#define _INC_ASTRA_COMPOSITEGEOMETRYMANAGER
+
+#include "Globals.h"
+
+#ifdef ASTRA_CUDA
+
+#include <list>
+#include <map>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+
+namespace astra {
+
+class CCompositeVolume;
+class CCompositeProjections;
+class CFloat32Data3DMemory;
+class CFloat32ProjectionData3DMemory;
+class CFloat32VolumeData3DMemory;
+class CVolumeGeometry3D;
+class CProjectionGeometry3D;
+class CProjector3D;
+
+
+
+class _AstraExport CCompositeGeometryManager {
+public:
+ class CPart;
+ typedef std::list<boost::shared_ptr<CPart> > TPartList;
+ class CPart {
+ public:
+ CPart() { }
+ CPart(const CPart& other);
+ virtual ~CPart() { }
+
+ enum {
+ PART_VOL, PART_PROJ
+ } eType;
+
+ CFloat32Data3DMemory* pData;
+ unsigned int subX;
+ unsigned int subY;
+ unsigned int subZ;
+
+ bool uploadToGPU();
+ bool downloadFromGPU(/*mode?*/);
+ virtual TPartList split(size_t maxSize, int div) = 0;
+ virtual CPart* reduce(const CPart *other) = 0;
+ virtual void getDims(size_t &x, size_t &y, size_t &z) = 0;
+ size_t getSize();
+ };
+
+ class CVolumePart : public CPart {
+ public:
+ CVolumePart() { eType = PART_VOL; }
+ CVolumePart(const CVolumePart& other);
+ virtual ~CVolumePart();
+
+ CVolumeGeometry3D* pGeom;
+
+ virtual TPartList split(size_t maxSize, int div);
+ virtual CPart* reduce(const CPart *other);
+ virtual void getDims(size_t &x, size_t &y, size_t &z);
+
+ CVolumePart* clone() const;
+ };
+ class CProjectionPart : public CPart {
+ public:
+ CProjectionPart() { eType = PART_PROJ; }
+ CProjectionPart(const CProjectionPart& other);
+ virtual ~CProjectionPart();
+
+ CProjectionGeometry3D* pGeom;
+
+ virtual TPartList split(size_t maxSize, int div);
+ virtual CPart* reduce(const CPart *other);
+ virtual void getDims(size_t &x, size_t &y, size_t &z);
+
+ CProjectionPart* clone() const;
+ };
+
+ struct SJob {
+ public:
+ boost::shared_ptr<CPart> pInput;
+ boost::shared_ptr<CPart> pOutput;
+ CProjector3D *pProjector; // For a `global' geometry. It will not match
+ // the geometries of the input and output.
+
+
+ enum {
+ JOB_FP, JOB_BP, JOB_NOP
+ } eType;
+ enum {
+ MODE_ADD, MODE_SET
+ } eMode;
+
+ };
+
+ typedef std::list<SJob> TJobList;
+ // output part -> list of jobs for that output
+ typedef std::map<CPart*, TJobList > TJobSet;
+
+ bool doJobs(TJobList &jobs);
+
+ // Convenience functions for creating and running a single FP or BP job
+ bool doFP(CProjector3D *pProjector, CFloat32VolumeData3DMemory *pVolData,
+ CFloat32ProjectionData3DMemory *pProjData);
+ bool doBP(CProjector3D *pProjector, CFloat32VolumeData3DMemory *pVolData,
+ CFloat32ProjectionData3DMemory *pProjData);
+
+ bool doFP(CProjector3D *pProjector, const std::vector<CFloat32VolumeData3DMemory *>& volData, const std::vector<CFloat32ProjectionData3DMemory *>& projData);
+ bool doBP(CProjector3D *pProjector, const std::vector<CFloat32VolumeData3DMemory *>& volData, const std::vector<CFloat32ProjectionData3DMemory *>& projData);
+
+protected:
+
+ bool splitJobs(TJobSet &jobs, size_t maxSize, int div, TJobSet &split);
+
+};
+
+}
+
+#endif
+
+#endif
diff --git a/include/astra/ConeProjectionGeometry3D.h b/include/astra/ConeProjectionGeometry3D.h
index 00e72ce..dede6e1 100644
--- a/include/astra/ConeProjectionGeometry3D.h
+++ b/include/astra/ConeProjectionGeometry3D.h
@@ -186,9 +186,15 @@ public:
*/
virtual CVector3D getProjectionDirection(int _iProjectionIndex, int _iDetectorIndex) const;
- virtual void projectPoint(float32 fX, float32 fY, float32 fZ,
+ virtual void projectPoint(double fX, double fY, double fZ,
int iAngleIndex,
- float32 &fU, float32 &fV) const;
+ double &fU, double &fV) const;
+ virtual void backprojectPointX(int iAngleIndex, double fU, double fV,
+ double fX, double &fY, double &fZ) const;
+ virtual void backprojectPointY(int iAngleIndex, double fU, double fV,
+ double fY, double &fX, double &fZ) const;
+ virtual void backprojectPointZ(int iAngleIndex, double fU, double fV,
+ double fZ, double &fX, double &fY) const;
};
diff --git a/include/astra/ConeVecProjectionGeometry3D.h b/include/astra/ConeVecProjectionGeometry3D.h
index 71e8010..f76f9dd 100644
--- a/include/astra/ConeVecProjectionGeometry3D.h
+++ b/include/astra/ConeVecProjectionGeometry3D.h
@@ -148,9 +148,16 @@ public:
const SConeProjection* getProjectionVectors() const { return m_pProjectionAngles; }
- virtual void projectPoint(float32 fX, float32 fY, float32 fZ,
+ virtual void projectPoint(double fX, double fY, double fZ,
int iAngleIndex,
- float32 &fU, float32 &fV) const;
+ double &fU, double &fV) const;
+ virtual void backprojectPointX(int iAngleIndex, double fU, double fV,
+ double fX, double &fY, double &fZ) const;
+ virtual void backprojectPointY(int iAngleIndex, double fU, double fV,
+ double fY, double &fX, double &fZ) const;
+ virtual void backprojectPointZ(int iAngleIndex, double fU, double fV,
+ double fZ, double &fX, double &fY) const;
+
};
} // namespace astra
diff --git a/include/astra/CudaBackProjectionAlgorithm.h b/include/astra/CudaBackProjectionAlgorithm.h
index 84899b0..2450376 100644
--- a/include/astra/CudaBackProjectionAlgorithm.h
+++ b/include/astra/CudaBackProjectionAlgorithm.h
@@ -85,13 +85,10 @@ public:
* @param _pProjector Projector Object. (Ignored)
* @param _pSinogram ProjectionData2D object containing the sinogram data.
* @param _pReconstruction VolumeData2D object for storing the reconstructed volume.
- * @param _iGPUindex GPU to use.
- * @param _iPixelSuperSampling Square root of number of samples per voxel, used to compute the backprojection
*/
bool initialize(CProjector2D* _pProjector,
CFloat32ProjectionData2D* _pSinogram,
- CFloat32VolumeData2D* _pReconstruction,
- int _iGPUindex = -1, int _iPixelSuperSampling = 1);
+ CFloat32VolumeData2D* _pReconstruction);
/** Get a description of the class.
*
diff --git a/include/astra/CudaBackProjectionAlgorithm3D.h b/include/astra/CudaBackProjectionAlgorithm3D.h
index 2d98218..74aeec8 100644
--- a/include/astra/CudaBackProjectionAlgorithm3D.h
+++ b/include/astra/CudaBackProjectionAlgorithm3D.h
@@ -147,6 +147,8 @@ protected:
*/
bool m_bSIRTWeighting;
+
+ void initializeFromProjector();
};
// inline functions
diff --git a/include/astra/CudaCglsAlgorithm.h b/include/astra/CudaCglsAlgorithm.h
index c51093c..6aa0343 100644
--- a/include/astra/CudaCglsAlgorithm.h
+++ b/include/astra/CudaCglsAlgorithm.h
@@ -91,18 +91,13 @@ public:
/** Initialize class, use sequential order.
*
- * @param _pProjector Projector Object. (Ignored)
+ * @param _pProjector Projector Object. (Optional)
* @param _pSinogram ProjectionData2D object containing the sinogram
* @param _pReconstruction VolumeData2D for storing the reconstruction
- * @param _iGPUindex Index of GPU to use. (Starting at 0.)
- * @param _iDetectorSuperSampling Supersampling factor for the FP.
- * @param _iPixelSuperSampling Square root of number of samples per voxel, used to compute the backprojection
*/
bool initialize(CProjector2D* _pProjector,
CFloat32ProjectionData2D* _pSinogram,
- CFloat32VolumeData2D* _pReconstruction,
- int _iGPUindex = -1, int _iDetectorSuperSampling = 1,
- int _iPixelSuperSampling = 1);
+ CFloat32VolumeData2D* _pReconstruction);
/** Get a description of the class.
*
diff --git a/include/astra/CudaCglsAlgorithm3D.h b/include/astra/CudaCglsAlgorithm3D.h
index 77c41c1..3e4084b 100644
--- a/include/astra/CudaCglsAlgorithm3D.h
+++ b/include/astra/CudaCglsAlgorithm3D.h
@@ -161,6 +161,8 @@ protected:
bool m_bAstraCGLSInit;
int m_iDetectorSuperSampling;
int m_iVoxelSuperSampling;
+
+ void initializeFromProjector();
};
// inline functions
diff --git a/include/astra/CudaEMAlgorithm.h b/include/astra/CudaEMAlgorithm.h
index 97eb7ca..a9d2711 100644
--- a/include/astra/CudaEMAlgorithm.h
+++ b/include/astra/CudaEMAlgorithm.h
@@ -63,17 +63,13 @@ public:
/** Initialize class.
*
- * @param _pProjector Projector Object. (Ignored)
+ * @param _pProjector Projector Object. (Optional)
* @param _pSinogram ProjectionData2D object containing the sinogram data.
* @param _pReconstruction VolumeData2D object for storing the reconstructed volume.
- * @param _iGPUindex GPU to use.
- * @param _iDetectorSuperSampling Supersampling factor for the FP.
*/
bool initialize(CProjector2D* _pProjector,
- CFloat32ProjectionData2D* _pSinogram,
- CFloat32VolumeData2D* _pReconstruction,
- int _iGPUindex = -1, int _iDetectorSuperSampling = 1,
- int _iPixelSuperSampling = 1);
+ CFloat32ProjectionData2D* _pSinogram,
+ CFloat32VolumeData2D* _pReconstruction);
/** Get a description of the class.
*
diff --git a/include/astra/CudaFDKAlgorithm3D.h b/include/astra/CudaFDKAlgorithm3D.h
index 1b025f1..63f07fd 100644
--- a/include/astra/CudaFDKAlgorithm3D.h
+++ b/include/astra/CudaFDKAlgorithm3D.h
@@ -152,6 +152,8 @@ protected:
int m_iGPUIndex;
int m_iVoxelSuperSampling;
bool m_bShortScan;
+
+ void initializeFromProjector();
};
// inline functions
diff --git a/include/astra/CudaFilteredBackProjectionAlgorithm.h b/include/astra/CudaFilteredBackProjectionAlgorithm.h
index 33445b6..cf1f19f 100644
--- a/include/astra/CudaFilteredBackProjectionAlgorithm.h
+++ b/include/astra/CudaFilteredBackProjectionAlgorithm.h
@@ -85,6 +85,9 @@ protected:
AstraFBP* m_pFBP;
bool m_bAstraFBPInit;
+
+ void initializeFromProjector();
+ virtual bool requiresProjector() const { return false; }
};
// inline functions
diff --git a/include/astra/CudaForwardProjectionAlgorithm.h b/include/astra/CudaForwardProjectionAlgorithm.h
index d172a7a..449a610 100644
--- a/include/astra/CudaForwardProjectionAlgorithm.h
+++ b/include/astra/CudaForwardProjectionAlgorithm.h
@@ -33,16 +33,15 @@ $Id$
#include "Algorithm.h"
-#include "ParallelProjectionGeometry2D.h"
-#include "VolumeGeometry2D.h"
-
-#include "Float32ProjectionData2D.h"
-#include "Float32VolumeData2D.h"
-
#ifdef ASTRA_CUDA
namespace astra {
+class CProjector2D;
+class CProjectionGeometry2D;
+class CFloat32ProjectionData2D;
+class CFloat32VolumeData2D;
+
/**
* \brief
* This class contains a GPU implementation of an algorithm that creates a forward projection
@@ -91,19 +90,15 @@ public:
/** Initialize class.
*
- * @param _pVolumeGeometry Geometry of the volume.
- * @param _pProjectionGeometry Geometry of the projection.
+ * @param _pProjector Projector2D object. (Optional)
* @param _pVolume VolumeData2D object containing the phantom to compute sinogram from
* @param _pSinogram ProjectionData2D object to store sinogram data in.
- * @param _iGPUindex Index of GPU to use. (Starting at 0.)
- * @param _iDetectorSuperSampling Number of samples per detector element, used to compute the forward projection
* @return success
*/
- bool initialize(CProjectionGeometry2D* _pProjectionGeometry,
- CVolumeGeometry2D* _pVolumeGeometry,
- CFloat32VolumeData2D* _pVolume,
- CFloat32ProjectionData2D* _pSinogram,
- int _iGPUindex = -1, int _iDetectorSuperSampling = 1);
+ bool initialize(CProjector2D* _pProjector,
+ CFloat32VolumeData2D* _pVolume,
+ CFloat32ProjectionData2D* _pSinogram);
+
/** Get all information parameters
*
@@ -147,6 +142,9 @@ public:
void setGPUIndex(int _iGPUIndex);
protected:
+ //< Optional Projector2D object
+ CProjector2D* m_pProjector;
+
//< ProjectionData2D object containing the sinogram.
CFloat32ProjectionData2D* m_pSinogram;
//< VolumeData2D object containing the phantom.
@@ -157,6 +155,7 @@ protected:
//< Number of rays per detector element
int m_iDetectorSuperSampling;
+ void initializeFromProjector();
};
// inline functions
diff --git a/include/astra/CudaForwardProjectionAlgorithm3D.h b/include/astra/CudaForwardProjectionAlgorithm3D.h
index bdd1356..4198d56 100644
--- a/include/astra/CudaForwardProjectionAlgorithm3D.h
+++ b/include/astra/CudaForwardProjectionAlgorithm3D.h
@@ -122,6 +122,7 @@ protected:
int m_iGPUIndex;
int m_iDetectorSuperSampling;
+ void initializeFromProjector();
};
// inline functions
diff --git a/include/astra/CudaProjector2D.h b/include/astra/CudaProjector2D.h
index ecfca41..2b4bacb 100644
--- a/include/astra/CudaProjector2D.h
+++ b/include/astra/CudaProjector2D.h
@@ -124,12 +124,14 @@ public:
Cuda2DProjectionKernel getProjectionKernel() const { return m_projectionKernel; }
int getVoxelSuperSampling() const { return m_iVoxelSuperSampling; }
int getDetectorSuperSampling() const { return m_iDetectorSuperSampling; }
+ int getGPUIndex() const { return m_iGPUIndex; }
protected:
Cuda2DProjectionKernel m_projectionKernel;
int m_iVoxelSuperSampling;
int m_iDetectorSuperSampling;
+ int m_iGPUIndex;
};
//----------------------------------------------------------------------------------------
diff --git a/include/astra/CudaProjector3D.h b/include/astra/CudaProjector3D.h
index 1d570fe..da88d6d 100644
--- a/include/astra/CudaProjector3D.h
+++ b/include/astra/CudaProjector3D.h
@@ -117,12 +117,14 @@ public:
Cuda3DProjectionKernel getProjectionKernel() const { return m_projectionKernel; }
int getVoxelSuperSampling() const { return m_iVoxelSuperSampling; }
int getDetectorSuperSampling() const { return m_iDetectorSuperSampling; }
+ int getGPUIndex() const { return m_iGPUIndex; }
protected:
Cuda3DProjectionKernel m_projectionKernel;
int m_iVoxelSuperSampling;
int m_iDetectorSuperSampling;
+ int m_iGPUIndex;
};
diff --git a/include/astra/CudaReconstructionAlgorithm2D.h b/include/astra/CudaReconstructionAlgorithm2D.h
index e19bb8f..dc93a1a 100644
--- a/include/astra/CudaReconstructionAlgorithm2D.h
+++ b/include/astra/CudaReconstructionAlgorithm2D.h
@@ -70,28 +70,13 @@ public:
/** Initialize class.
*
- * @param _pProjector Projector Object. (Ignored)
+ * @param _pProjector Projector Object. (Optional)
* @param _pSinogram ProjectionData2D object containing the sinogram data.
* @param _pReconstruction VolumeData2D object for storing the reconstructed volume.
*/
- bool initialize(CProjector2D* _pProjector,
- CFloat32ProjectionData2D* _pSinogram,
- CFloat32VolumeData2D* _pReconstruction);
-
- /** Initialize class.
- *
- * @param _pProjector Projector Object. (Ignored)
- * @param _pSinogram ProjectionData2D object containing the sinogram data.
- * @param _pReconstruction VolumeData2D object for storing the reconstructed volume.
- * @param _iGPUindex GPU to use.
- * @param _iDetectorSuperSampling Supersampling factor for the FP.
- * @param _iPixelSuperSampling Square root of number of samples per voxel, used to compute the backprojection
- */
virtual bool initialize(CProjector2D* _pProjector,
CFloat32ProjectionData2D* _pSinogram,
- CFloat32VolumeData2D* _pReconstruction,
- int _iGPUindex = -1, int _iDetectorSuperSampling = 1,
- int _iPixelSuperSampling = 1);
+ CFloat32VolumeData2D* _pReconstruction);
/** Clear this class.
@@ -166,6 +151,9 @@ protected:
int m_iGPUIndex;
bool m_bAlgoInit;
+
+ void initializeFromProjector();
+ virtual bool requiresProjector() const { return false; }
};
// inline functions
diff --git a/include/astra/CudaSartAlgorithm.h b/include/astra/CudaSartAlgorithm.h
index b370bd0..c22dc4f 100644
--- a/include/astra/CudaSartAlgorithm.h
+++ b/include/astra/CudaSartAlgorithm.h
@@ -84,16 +84,13 @@ public:
/** Initialize class.
*
- * @param _pProjector Projector Object. (Ignored)
+ * @param _pProjector Projector Object. (Optional)
* @param _pSinogram ProjectionData2D object containing the sinogram data.
* @param _pReconstruction VolumeData2D object for storing the reconstructed volume.
- * @param _iGPUindex GPU to use.
- * @param _iDetectorSuperSampling Supersampling factor for the FP.
*/
bool initialize(CProjector2D* _pProjector,
- CFloat32ProjectionData2D* _pSinogram,
- CFloat32VolumeData2D* _pReconstruction,
- int _iGPUindex = -1, int _iDetectorSuperSampling = 1);
+ CFloat32ProjectionData2D* _pSinogram,
+ CFloat32VolumeData2D* _pReconstruction);
/** Get a description of the class.
*
diff --git a/include/astra/CudaSirtAlgorithm.h b/include/astra/CudaSirtAlgorithm.h
index 607889a..929ac30 100644
--- a/include/astra/CudaSirtAlgorithm.h
+++ b/include/astra/CudaSirtAlgorithm.h
@@ -97,18 +97,13 @@ public:
/** Initialize class.
*
- * @param _pProjector Projector Object. (Ignored)
+ * @param _pProjector Projector Object. (Optional)
* @param _pSinogram ProjectionData2D object containing the sinogram data.
* @param _pReconstruction VolumeData2D object for storing the reconstructed volume.
- * @param _iGPUindex GPU to use.
- * @param _iDetectorSuperSampling Supersampling factor for the FP.
- * @param _iPixelSuperSampling Square root of number of samples per voxel, used to compute the backprojection
*/
bool initialize(CProjector2D* _pProjector,
- CFloat32ProjectionData2D* _pSinogram,
- CFloat32VolumeData2D* _pReconstruction,
- int _iGPUindex = -1, int _iDetectorSuperSampling = 1,
- int _iPixelSuperSampling = 1);
+ CFloat32ProjectionData2D* _pSinogram,
+ CFloat32VolumeData2D* _pReconstruction);
/** Get a description of the class.
*
diff --git a/include/astra/CudaSirtAlgorithm3D.h b/include/astra/CudaSirtAlgorithm3D.h
index fda4635..379720e 100644
--- a/include/astra/CudaSirtAlgorithm3D.h
+++ b/include/astra/CudaSirtAlgorithm3D.h
@@ -175,6 +175,8 @@ protected:
bool m_bAstraSIRTInit;
int m_iDetectorSuperSampling;
int m_iVoxelSuperSampling;
+
+ void initializeFromProjector();
};
// inline functions
diff --git a/include/astra/GeometryUtil3D.h b/include/astra/GeometryUtil3D.h
index 698372e..e4d73e4 100644
--- a/include/astra/GeometryUtil3D.h
+++ b/include/astra/GeometryUtil3D.h
@@ -43,6 +43,33 @@ struct SConeProjection {
// the V-edge of a detector pixel
double fDetVX, fDetVY, fDetVZ;
+
+
+
+
+ void translate(double dx, double dy, double dz) {
+ fSrcX += dx;
+ fSrcY += dy;
+ fSrcZ += dz;
+ fDetSX += dx;
+ fDetSY += dy;
+ fDetSZ += dz;
+
+ }
+ void scale(double factor) {
+ fSrcX *= factor;
+ fSrcY *= factor;
+ fSrcZ *= factor;
+ fDetSX *= factor;
+ fDetSY *= factor;
+ fDetSZ *= factor;
+ fDetUX *= factor;
+ fDetUY *= factor;
+ fDetUZ *= factor;
+ fDetVX *= factor;
+ fDetVY *= factor;
+ fDetVZ *= factor;
+ }
};
struct SPar3DProjection {
@@ -57,6 +84,29 @@ struct SPar3DProjection {
// the V-edge of a detector pixel
double fDetVX, fDetVY, fDetVZ;
+
+
+
+
+ void translate(double dx, double dy, double dz) {
+ fDetSX += dx;
+ fDetSY += dy;
+ fDetSZ += dz;
+ }
+ void scale(double factor) {
+ fRayX *= factor;
+ fRayY *= factor;
+ fRayZ *= factor;
+ fDetSX *= factor;
+ fDetSY *= factor;
+ fDetSZ *= factor;
+ fDetUX *= factor;
+ fDetUY *= factor;
+ fDetUZ *= factor;
+ fDetVX *= factor;
+ fDetVY *= factor;
+ fDetVZ *= factor;
+ }
};
void computeBP_UV_Coeffs(const SPar3DProjection& proj,
@@ -68,6 +118,26 @@ void computeBP_UV_Coeffs(const SConeProjection& proj,
double &fVX, double &fVY, double &fVZ, double &fVC,
double &fDX, double &fDY, double &fDZ, double &fDC);
+
+SConeProjection* genConeProjections(unsigned int iProjAngles,
+ unsigned int iProjU,
+ unsigned int iProjV,
+ double fOriginSourceDistance,
+ double fOriginDetectorDistance,
+ double fDetUSize,
+ double fDetVSize,
+ const float *pfAngles);
+
+SPar3DProjection* genPar3DProjections(unsigned int iProjAngles,
+ unsigned int iProjU,
+ unsigned int iProjV,
+ double fDetUSize,
+ double fDetVSize,
+ const float *pfAngles);
+
+
+
+
}
#endif
diff --git a/include/astra/Globals.h b/include/astra/Globals.h
index 4de07d1..31f1371 100644
--- a/include/astra/Globals.h
+++ b/include/astra/Globals.h
@@ -61,9 +61,9 @@ $Id$
// macro's
#define ASTRA_TOOLBOXVERSION_MAJOR 1
-#define ASTRA_TOOLBOXVERSION_MINOR 6
+#define ASTRA_TOOLBOXVERSION_MINOR 7
#define ASTRA_TOOLBOXVERSION ((ASTRA_TOOLBOXVERSION_MAJOR)*100 + (ASTRA_TOOLBOXVERSION_MINOR))
-#define ASTRA_TOOLBOXVERSION_STRING "1.6"
+#define ASTRA_TOOLBOXVERSION_STRING "1.7"
#define ASTRA_ASSERT(a) assert(a)
@@ -146,6 +146,8 @@ namespace astra {
const float32 PIdiv2 = PI / 2;
const float32 PIdiv4 = PI / 4;
const float32 eps = 1e-7f;
+
+ extern _AstraExport bool running_in_matlab;
}
//----------------------------------------------------------------------------------------
diff --git a/include/astra/ParallelProjectionGeometry3D.h b/include/astra/ParallelProjectionGeometry3D.h
index 72401e5..d95c050 100644
--- a/include/astra/ParallelProjectionGeometry3D.h
+++ b/include/astra/ParallelProjectionGeometry3D.h
@@ -147,9 +147,16 @@ public:
*/
virtual CVector3D getProjectionDirection(int _iProjectionIndex, int _iDetectorIndex) const;
- virtual void projectPoint(float32 fX, float32 fY, float32 fZ,
+ virtual void projectPoint(double fX, double fY, double fZ,
int iAngleIndex,
- float32 &fU, float32 &fV) const;
+ double &fU, double &fV) const;
+ virtual void backprojectPointX(int iAngleIndex, double fU, double fV,
+ double fX, double &fY, double &fZ) const;
+ virtual void backprojectPointY(int iAngleIndex, double fU, double fV,
+ double fY, double &fX, double &fZ) const;
+ virtual void backprojectPointZ(int iAngleIndex, double fU, double fV,
+ double fZ, double &fX, double &fY) const;
+
/**
* Creates (= allocates) a 2D projection geometry used when projecting one slice using a 2D projector
diff --git a/include/astra/ParallelVecProjectionGeometry3D.h b/include/astra/ParallelVecProjectionGeometry3D.h
index 59238c8..ec91086 100644
--- a/include/astra/ParallelVecProjectionGeometry3D.h
+++ b/include/astra/ParallelVecProjectionGeometry3D.h
@@ -149,9 +149,15 @@ public:
const SPar3DProjection* getProjectionVectors() const { return m_pProjectionAngles; }
- virtual void projectPoint(float32 fX, float32 fY, float32 fZ,
+ virtual void projectPoint(double fX, double fY, double fZ,
int iAngleIndex,
- float32 &fU, float32 &fV) const;
+ double &fU, double &fV) const;
+ virtual void backprojectPointX(int iAngleIndex, double fU, double fV,
+ double fX, double &fY, double &fZ) const;
+ virtual void backprojectPointY(int iAngleIndex, double fU, double fV,
+ double fY, double &fX, double &fZ) const;
+ virtual void backprojectPointZ(int iAngleIndex, double fU, double fV,
+ double fZ, double &fX, double &fY) const;
};
} // namespace astra
diff --git a/include/astra/PluginAlgorithm.h b/include/astra/PluginAlgorithm.h
new file mode 100644
index 0000000..667e813
--- /dev/null
+++ b/include/astra/PluginAlgorithm.h
@@ -0,0 +1,90 @@
+/*
+-----------------------------------------------------------------------
+Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp
+ 2014-2015, CWI, Amsterdam
+
+Contact: astra@uantwerpen.be
+Website: http://sf.net/projects/astra-toolbox
+
+This file is part of the ASTRA Toolbox.
+
+
+The ASTRA Toolbox is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+The ASTRA Toolbox is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
+
+-----------------------------------------------------------------------
+$Id$
+*/
+
+#ifndef _INC_ASTRA_PLUGINALGORITHM
+#define _INC_ASTRA_PLUGINALGORITHM
+
+#ifdef ASTRA_PYTHON
+
+#include "astra/Algorithm.h"
+#include "astra/Singleton.h"
+#include "astra/XMLDocument.h"
+#include "astra/XMLNode.h"
+
+// Slightly hackish forward declaration of PyObject
+struct _object;
+typedef _object PyObject;
+
+
+namespace astra {
+class _AstraExport CPluginAlgorithm : public CAlgorithm {
+
+public:
+
+ CPluginAlgorithm(PyObject* pyclass);
+ ~CPluginAlgorithm();
+
+ bool initialize(const Config& _cfg);
+ void run(int _iNrIterations);
+
+private:
+ PyObject * instance;
+
+};
+
+class _AstraExport CPluginAlgorithmFactory : public Singleton<CPluginAlgorithmFactory> {
+
+public:
+
+ CPluginAlgorithmFactory();
+ ~CPluginAlgorithmFactory();
+
+ CPluginAlgorithm * getPlugin(std::string name);
+
+ bool registerPlugin(std::string name, std::string className);
+ bool registerPlugin(std::string className);
+ bool registerPluginClass(std::string name, PyObject * className);
+ bool registerPluginClass(PyObject * className);
+
+ PyObject * getRegistered();
+ std::map<std::string, std::string> getRegisteredMap();
+
+ std::string getHelp(std::string name);
+
+private:
+ PyObject * pluginDict;
+ PyObject *inspect, *six;
+};
+
+PyObject* XMLNode2dict(XMLNode node);
+
+}
+
+#endif
+
+#endif
diff --git a/include/astra/ProjectionGeometry3D.h b/include/astra/ProjectionGeometry3D.h
index 19ac3ab..0b60287 100644
--- a/include/astra/ProjectionGeometry3D.h
+++ b/include/astra/ProjectionGeometry3D.h
@@ -317,9 +317,24 @@ public:
* @param iAngleIndex the index of the angle to use
* @param fU,fV the projected point.
*/
- virtual void projectPoint(float32 fX, float32 fY, float32 fZ,
+ virtual void projectPoint(double fX, double fY, double fZ,
int iAngleIndex,
- float32 &fU, float32 &fV) const = 0;
+ double &fU, double &fV) const = 0;
+
+ /* Backproject a point onto a plane parallel to a coordinate plane.
+ * The 2D point coordinates are the (unrounded) indices of the detector
+ * column and row. The output is in 3D coordinates in units.
+ * are in units. The output fU,fV are the (unrounded) indices of the
+ * detector column and row.
+ * This may fall outside of the actual detector.
+ */
+ virtual void backprojectPointX(int iAngleIndex, double fU, double fV,
+ double fX, double &fY, double &fZ) const = 0;
+ virtual void backprojectPointY(int iAngleIndex, double fU, double fV,
+ double fY, double &fX, double &fZ) const = 0;
+ virtual void backprojectPointZ(int iAngleIndex, double fU, double fV,
+ double fZ, double &fX, double &fY) const = 0;
+
/** Returns true if the type of geometry defined in this class is the one specified in _sType.
*
diff --git a/include/astra/ReconstructionAlgorithm2D.h b/include/astra/ReconstructionAlgorithm2D.h
index 60584e0..ac87c4f 100644
--- a/include/astra/ReconstructionAlgorithm2D.h
+++ b/include/astra/ReconstructionAlgorithm2D.h
@@ -208,6 +208,9 @@ protected:
//< Use the fixed reconstruction mask?
bool m_bUseSinogramMask;
+
+ //< Specify if initialize/check should check for a valid Projector
+ virtual bool requiresProjector() const { return true; }
};
// inline functions