Add precalcImageParameters.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#include "precalcImageParameters.h"
|
||||
#include "Matrix.h"
|
||||
#include "common/getGeometryInfo.h"
|
||||
#include "src/config/config.h"
|
||||
|
||||
#include "Function.h"
|
||||
#include "Function2D.h"
|
||||
#include <cmath>
|
||||
|
||||
using namespace Recon;
|
||||
using namespace Aurora;
|
||||
|
||||
void Recon::precalcImageParameters(const GeometryInfo& aGeom)
|
||||
{
|
||||
Matrix maxSize = aGeom.maxSize;
|
||||
maxSize.forceReshape(2, 1, 1);
|
||||
Matrix minSize = aGeom.minSize;
|
||||
minSize.forceReshape(2, 1, 1);
|
||||
reflectParams::imageResolution = max(maxSize - minSize, FunctionDirection::All)[0] / reflectParams::pixelResolutionX;
|
||||
reflectParams::pixelResolutionZ = std::floor((aGeom.maxSize[2] - aGeom.minSize[2]) / reflectParams::imageResolution) + 1;
|
||||
double* imageXYZData = Aurora::malloc(3);
|
||||
imageXYZData[0] = ceil(reflectParams::pixelResolutionX * (reflectParams::imageEndpoint[0] - reflectParams::imageStartpoint[0]) /
|
||||
(aGeom.maxSize[0] - aGeom.minSize[0]));
|
||||
imageXYZData[1] = ceil(reflectParams::pixelResolutionY * (reflectParams::imageEndpoint[1] - reflectParams::imageStartpoint[1]) /
|
||||
(aGeom.maxSize[1] - aGeom.minSize[1]));
|
||||
imageXYZData[2] = ceil(reflectParams::pixelResolutionZ * (reflectParams::imageEndpoint[2] - reflectParams::imageStartpoint[2]) /
|
||||
(aGeom.maxSize[2] - aGeom.minSize[2]));
|
||||
reflectParams::imageXYZ = Matrix::New(imageXYZData, 1, 3);
|
||||
|
||||
reflectParams::imageEndpoint.getData()[0] = reflectParams::imageStartpoint[0] + (reflectParams::imageXYZ[0] * reflectParams::imageResolution)
|
||||
- reflectParams::imageResolution;
|
||||
reflectParams::imageEndpoint.getData()[1] = reflectParams::imageStartpoint[1] + (reflectParams::imageXYZ[1] * reflectParams::imageResolution)
|
||||
- reflectParams::imageResolution;
|
||||
reflectParams::imageEndpoint.getData()[2] = reflectParams::imageStartpoint[2] + (reflectParams::imageXYZ[2] * reflectParams::imageResolution)
|
||||
- reflectParams::imageResolution;
|
||||
|
||||
if(reflectParams::imageXYZ[0] <= 1)
|
||||
{
|
||||
reflectParams::imageXYZ[0] = 2;
|
||||
}
|
||||
|
||||
if(reflectParams::imageXYZ[1] <= 0)
|
||||
{
|
||||
reflectParams::imageXYZ[1] = 1;
|
||||
}
|
||||
|
||||
if(reflectParams::imageXYZ[2] <= 0)
|
||||
{
|
||||
reflectParams::imageXYZ[2] = 1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef PRECALC_IMAGE_PARAMETERS_H
|
||||
#define PRECALC_IMAGE_PARAMETERS_H
|
||||
|
||||
#include "Matrix.h"
|
||||
#include "src/common/getGeometryInfo.h"
|
||||
|
||||
namespace Recon
|
||||
{
|
||||
void precalcImageParameters(const GeometryInfo& aGeom);
|
||||
}
|
||||
|
||||
|
||||
#endif // PRECALC_IMAGE_PARAMETERS_H
|
||||
Reference in New Issue
Block a user