|
|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
|
#include "SAFT_TOFI.h"
|
|
|
|
|
#include "saft.hpp"
|
|
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
#include <locale.h> // For German printf output format: Float with , instead of .
|
|
|
|
|
@@ -535,7 +536,7 @@ void preintegrateAscans(
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
float* AscanBuffer;
|
|
|
|
|
AscanBuffer = (float*)mxMalloc(aScanLength * sizeof(float)); // Zweiten AScan-Buffer erzeugen mit Länge eines AScans (z.B. 3000)
|
|
|
|
|
AscanBuffer = (float*)malloc(aScanLength * sizeof(float)); // Zweiten AScan-Buffer erzeugen mit Länge eines AScans (z.B. 3000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //Debuging: Test: Alle Daten uebertragen von Input-Ascans auf AscansOut_ptr[0..aScanLength] ueber AscanBuffer
|
|
|
|
|
@@ -831,26 +832,30 @@ void preintegrateAscans(
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
mxFree(AscanBuffer);
|
|
|
|
|
free(AscanBuffer);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputFunctions
|
|
|
|
|
printf( "<== preintegrateAscans - End\n");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const size_t* GetDimensions(const Matrix_t& matrix)
|
|
|
|
|
{
|
|
|
|
|
return matrix.Dims;
|
|
|
|
|
}
|
|
|
|
|
const void* GetPr(const Matrix_t& matrix){
|
|
|
|
|
return matrix.Data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t GetNumberOfDimensions(const Matrix_t& matrix){
|
|
|
|
|
return matrix.NumberOfDims;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t GetNumberOfElements(const Matrix_t& matrix){
|
|
|
|
|
return matrix.DataSize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
mexFunction is the Interface for Matlab.
|
|
|
|
|
|
|
|
|
|
Check In and Output Parameter and call performReconstruction.
|
|
|
|
|
Also calculate the Sum of reconstructed Volume and the given IMAGE_SUM
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
Matrix_t SAFT_TOFI(std::vector<Matrix_t>& params){
|
|
|
|
|
#ifdef debug_OutputFunctions
|
|
|
|
|
printf( "==> mexFunction - Start\n");
|
|
|
|
|
#endif
|
|
|
|
|
@@ -913,7 +918,7 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
printf( "Number of Arguments: Input(nrhs) = %i Output(nlhs) = %i\n", nrhs, nlhs);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if ((!(nrhs == 19)) || !(nlhs == 3)) // || (nrhs > 9)) // nrhs = Eingabe
|
|
|
|
|
if (params.size() != 19)
|
|
|
|
|
{
|
|
|
|
|
printf( " \n");
|
|
|
|
|
printf( " Inputparameter \n");
|
|
|
|
|
@@ -963,42 +968,36 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
printf( " plhs[1] = Duration = mxCreateDoubleMatrix ( [nGPUs+1, 1] , mxREAL); \n");
|
|
|
|
|
printf( " plhs[2] = Output_Ascans = mxCreateNumericMatrix( [3000?,nAscans], mxSINGLE_CLASS, mxREAL); \n");
|
|
|
|
|
printf( " ================================================================================================= \n");
|
|
|
|
|
}
|
|
|
|
|
if (!(nrhs == 19)) // nrhs = Eingabe
|
|
|
|
|
{
|
|
|
|
|
mexErrMsgTxt("Wrong number of input arguments. Should be 19.");
|
|
|
|
|
}
|
|
|
|
|
if (!(nlhs == 3)){ // plhs = Ausgabe
|
|
|
|
|
mexErrMsgTxt("Wrong number of output arguments. Should be 3.");
|
|
|
|
|
printf("Wrong number of input arguments. Should be 19.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// assign input arguments... // Bestimme die Eingangswerte
|
|
|
|
|
const mxArray *AScan = prhs [0]; // AScan-Data
|
|
|
|
|
const mxArray *pix_vect = prhs [1]; // Image Startpoint (IMAGE_STARTPOINT_S)
|
|
|
|
|
const Matrix_t&AScan = params [0]; // AScan-Data
|
|
|
|
|
const Matrix_t&pix_vect = params [1]; // Image Startpoint (IMAGE_STARTPOINT_S)
|
|
|
|
|
|
|
|
|
|
const mxArray *receiver_index = prhs [2]; // Index Data for Receiver-Position Data
|
|
|
|
|
const mxArray *emitter_index = prhs [3]; // Index Data for Emitter-Position Data
|
|
|
|
|
const mxArray *receiver_list = prhs [4]; // Assignment Index to Receiver-Position Data
|
|
|
|
|
const mxArray *emitter_list = prhs [5]; // Assignment Index to Emitter-Position Data
|
|
|
|
|
const Matrix_t&receiver_index = params [2]; // Index Data for Receiver-Position Data
|
|
|
|
|
const Matrix_t&emitter_index = params [3]; // Index Data for Emitter-Position Data
|
|
|
|
|
const Matrix_t&receiver_list = params [4]; // Assignment Index to Receiver-Position Data
|
|
|
|
|
const Matrix_t&emitter_list = params [5]; // Assignment Index to Emitter-Position Data
|
|
|
|
|
|
|
|
|
|
const mxArray *SAFT_mode = prhs [6]; // SOS?, ATT?
|
|
|
|
|
const mxArray *SAFT_variant = prhs [7]; // Differnt Mode-Parameter for Reconstruction
|
|
|
|
|
const Matrix_t&SAFT_mode = params [6]; // SOS?, ATT?
|
|
|
|
|
const Matrix_t&SAFT_variant = params [7]; // Differnt Mode-Parameter for Reconstruction
|
|
|
|
|
|
|
|
|
|
const mxArray *speed = prhs [8]; // Speed of Sound Data (Single, SoS-Grid)
|
|
|
|
|
const mxArray *sos_startPoint = prhs [9]; // Startpoint of Speed of Sound Grid
|
|
|
|
|
const mxArray *sos_res = prhs [10]; // SoS Grid Resolution
|
|
|
|
|
const Matrix_t&speed = params [8]; // Speed of Sound Data (Single, SoS-Grid)
|
|
|
|
|
const Matrix_t&sos_startPoint = params [9]; // Startpoint of Speed of Sound Grid
|
|
|
|
|
const Matrix_t&sos_res = params [10]; // SoS Grid Resolution
|
|
|
|
|
|
|
|
|
|
const mxArray *attVolume = prhs [11]; // Attenuation Data (Single, SoS-Grid)
|
|
|
|
|
const Matrix_t&attVolume = params [11]; // Attenuation Data (Single, SoS-Grid)
|
|
|
|
|
|
|
|
|
|
const mxArray *res = prhs [12]; // Output Volume Resolution
|
|
|
|
|
const mxArray *timeint = prhs [13]; // 1/Sample-Rate
|
|
|
|
|
const mxArray *IMAGE_XYZ = prhs [14]; // Output Volume Size XYZ
|
|
|
|
|
const mxArray *IMAGE_SUM = prhs [15]; // Volume from previous Call
|
|
|
|
|
const Matrix_t&res = params [12]; // Output Volume Resolution
|
|
|
|
|
const Matrix_t&timeint = params [13]; // 1/Sample-Rate
|
|
|
|
|
const Matrix_t&IMAGE_XYZ = params [14]; // Output Volume Size XYZ
|
|
|
|
|
const Matrix_t&IMAGE_SUM = params [15]; // Volume from previous Call
|
|
|
|
|
|
|
|
|
|
const mxArray *BlockDim = prhs [16]; // Block Dimension to use for GPU
|
|
|
|
|
const mxArray *GPUs = prhs [17]; // Welche GPUs sollen genutzt werden?
|
|
|
|
|
const Matrix_t&BlockDim = params [16]; // Block Dimension to use for GPU
|
|
|
|
|
const Matrix_t&GPUs = params [17]; // Welche GPUs sollen genutzt werden?
|
|
|
|
|
|
|
|
|
|
const mxArray *dbgMode = prhs [18]; // DebugMode and DebugMode-Parameter
|
|
|
|
|
const Matrix_t&dbgMode = params [18]; // DebugMode and DebugMode-Parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check data types and assign variables... // Ueberpruefe die Datentypen und lege Variablen fest
|
|
|
|
|
@@ -1012,8 +1011,8 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 1.Input Parameter - Check AScan
|
|
|
|
|
AScan_Nx = mxGetDimensions(AScan)[0]; // Reihen N ermitteln
|
|
|
|
|
AScan_Mx = mxGetDimensions(AScan)[1]; // Spalten M ermitteln
|
|
|
|
|
AScan_Nx = GetDimensions(AScan)[0]; // Reihen N ermitteln
|
|
|
|
|
AScan_Mx = GetDimensions(AScan)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
aScanCount = AScan_Mx;
|
|
|
|
|
aScanLength = AScan_Nx;
|
|
|
|
|
@@ -1033,10 +1032,10 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( " -> Blockmode with [%i x %i]\n", AScan_Nx, aScanCount);
|
|
|
|
|
#endif
|
|
|
|
|
if(!(mxIsSingle(AScan)))
|
|
|
|
|
mexErrMsgTxt("AScans must be Single");
|
|
|
|
|
// if(!(mxIsSingle(AScan)))
|
|
|
|
|
// printf("AScans must be Single");
|
|
|
|
|
|
|
|
|
|
aScan_ptr = (float*)mxGetPr(AScan);
|
|
|
|
|
aScan_ptr = (float*)GetPr(AScan);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputVariables
|
|
|
|
|
// Ausgabe einzelner AScan-Samples der übergabewerte
|
|
|
|
|
@@ -1050,50 +1049,50 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//====================================================================== 2.Input Parameter - Check IMAGE_STARTPOINT_S / pix_vect
|
|
|
|
|
pix_vect_Nx = mxGetDimensions(pix_vect)[0]; // Reihen N ermitteln
|
|
|
|
|
pix_vect_Mx = mxGetDimensions(pix_vect)[1]; // Spalten M ermitteln
|
|
|
|
|
pix_vect_Nx = GetDimensions(pix_vect)[0]; // Reihen N ermitteln
|
|
|
|
|
pix_vect_Mx = GetDimensions(pix_vect)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
regionOfInterestOffset.x = *((float*)mxGetPr(pix_vect));
|
|
|
|
|
regionOfInterestOffset.y = *((float*)mxGetPr(pix_vect)+1);
|
|
|
|
|
regionOfInterestOffset.z = *((float*)mxGetPr(pix_vect)+2);
|
|
|
|
|
regionOfInterestOffset.x = *((float*)GetPr(pix_vect));
|
|
|
|
|
regionOfInterestOffset.y = *((float*)GetPr(pix_vect)+1);
|
|
|
|
|
regionOfInterestOffset.z = *((float*)GetPr(pix_vect)+2);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[1] IMAGE_STARTPOINT_S [%ix%i] = [%f x %f x %f]\n", pix_vect_Nx , pix_vect_Mx, regionOfInterestOffset.x, regionOfInterestOffset.y, regionOfInterestOffset.z);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(pix_vect_Nx == 1)||!(pix_vect_Mx == 3))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of IMAGE_STARTPOINT_S must be [1 x 3]");
|
|
|
|
|
printf(" -> Dimension of IMAGE_STARTPOINT_S must be [1 x 3]");
|
|
|
|
|
if ((pix_vect_Nx > 1))
|
|
|
|
|
printf( " -> No Blockmode [%i x 3] allowed for IMAGE_STARTPOINT_S\n", pix_vect_Nx);
|
|
|
|
|
if(!(mxIsSingle(pix_vect)))
|
|
|
|
|
mexErrMsgTxt(" -> IMAGE_STARTPOINT_S must be Single");
|
|
|
|
|
// if(!(mxIsSingle(pix_vect)))
|
|
|
|
|
// printf(" -> IMAGE_STARTPOINT_S must be Single");
|
|
|
|
|
|
|
|
|
|
//====================================================================== 3.Input Parameter - Check Receiver Index
|
|
|
|
|
receiver_index_Nx = mxGetDimensions(receiver_index)[0]; // Reihen N ermitteln
|
|
|
|
|
receiver_index_Mx = mxGetDimensions(receiver_index)[1]; // Spalten M ermitteln
|
|
|
|
|
receiver_index_Nx = GetDimensions(receiver_index)[0]; // Reihen N ermitteln
|
|
|
|
|
receiver_index_Mx = GetDimensions(receiver_index)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[2] receiver_index [%ix%i]\n", receiver_index_Nx , receiver_index_Mx);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(receiver_index_Nx == 1))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of receiver_index must be [1 x M]");
|
|
|
|
|
printf(" -> Dimension of receiver_index must be [1 x M]");
|
|
|
|
|
if (!(receiver_index_Mx == aScanCount)){
|
|
|
|
|
printf (" -> aScanCount(%i)!= M(%i)\n", aScanCount, receiver_index_Mx);
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of receiver_index has different size as Ascan-Data\n");
|
|
|
|
|
printf(" -> Dimension of receiver_index has different size as Ascan-Data\n");
|
|
|
|
|
}
|
|
|
|
|
if (!(receiver_index_Mx == 1))
|
|
|
|
|
// if (!(receiver_index_Mx == 1))
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( " -> Blockmode with [1 x %i]\n", receiver_index_Mx);
|
|
|
|
|
#endif
|
|
|
|
|
if(!(mxIsUint16(receiver_index)))
|
|
|
|
|
mexErrMsgTxt(" -> receiver_index must be Uint16");
|
|
|
|
|
// if(!(mxIsUint16(receiver_index)))
|
|
|
|
|
// printf(" -> receiver_index must be Uint16");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Ausgabe einzelner Geometriedaten der Uebergabewerte mit verschiedenen Varianten
|
|
|
|
|
unsigned short *receiver_index_ptr;
|
|
|
|
|
receiver_index_ptr = (unsigned short*)mxGetPr(receiver_index);
|
|
|
|
|
receiver_index_ptr = (unsigned short*)GetPr(receiver_index);
|
|
|
|
|
#ifdef debug_OutputVariables
|
|
|
|
|
|
|
|
|
|
if ((receiver_index_Mx > 1))
|
|
|
|
|
@@ -1107,29 +1106,28 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//====================================================================== 4.Input Parameter - Check Emitter Index
|
|
|
|
|
emitter_index_Nx = mxGetDimensions(emitter_index)[0]; // Reihen N ermitteln
|
|
|
|
|
emitter_index_Mx = mxGetDimensions(emitter_index)[1]; // Spalten M ermitteln
|
|
|
|
|
emitter_index_Nx = GetDimensions(emitter_index)[0]; // Reihen N ermitteln
|
|
|
|
|
emitter_index_Mx = GetDimensions(emitter_index)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[3] emitter_index [%ix%i]\n", emitter_index_Nx , emitter_index_Mx);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(emitter_index_Nx == 1))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of emitter_index must be [1 x M]");
|
|
|
|
|
printf(" -> Dimension of emitter_index must be [1 x M]");
|
|
|
|
|
if (!(emitter_index_Mx == aScanCount)){
|
|
|
|
|
printf (" -> aScanCount(%i)!= M(%i)\n", aScanCount, emitter_index_Mx);
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of emitter_index has different size as Ascan-Data\n");
|
|
|
|
|
printf(" -> Dimension of emitter_index has different size as Ascan-Data\n");
|
|
|
|
|
}
|
|
|
|
|
if (!(emitter_index_Mx == 1))
|
|
|
|
|
// if (!(emitter_index_Mx == 1))
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( " -> Blockmode with [1 x %i]\n", emitter_index_Mx);
|
|
|
|
|
#endif
|
|
|
|
|
if(!(mxIsUint16(emitter_index)))
|
|
|
|
|
mexErrMsgTxt(" -> emitter_index must be Uint16");
|
|
|
|
|
// if(!(mxIsUint16(emitter_index)))
|
|
|
|
|
// printf(" -> emitter_index must be Uint16");
|
|
|
|
|
|
|
|
|
|
// Ausgabe einzelner Geometriedaten der Uebergabewerte mit verschiedenen Varianten
|
|
|
|
|
unsigned short *emitter_index_ptr;
|
|
|
|
|
emitter_index_ptr = (unsigned short*)mxGetPr(emitter_index);
|
|
|
|
|
unsigned short * emitter_index_ptr = (unsigned short*)GetPr(emitter_index);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputVariables
|
|
|
|
|
|
|
|
|
|
@@ -1146,21 +1144,21 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 5.Input Parameter - Check receiver_list
|
|
|
|
|
receiver_list_Nx = mxGetDimensions(receiver_list)[0]; // Reihen N ermitteln
|
|
|
|
|
receiver_list_Mx = mxGetDimensions(receiver_list)[1]; // Spalten M ermitteln
|
|
|
|
|
receiver_list_Nx = GetDimensions(receiver_list)[0]; // Reihen N ermitteln
|
|
|
|
|
receiver_list_Mx = GetDimensions(receiver_list)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[4] receiver_list [%ix%i]\n", receiver_list_Nx , receiver_list_Mx);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(receiver_list_Nx == 3))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of receiver_list must be [3 x M]");
|
|
|
|
|
if(!(mxIsSingle(receiver_list)))
|
|
|
|
|
mexErrMsgTxt(" -> receiver_list must be Single");
|
|
|
|
|
printf(" -> Dimension of receiver_list must be [3 x M]");
|
|
|
|
|
// if(!(mxIsSingle(receiver_list)))
|
|
|
|
|
// printf(" -> receiver_list must be Single");
|
|
|
|
|
|
|
|
|
|
// Ausgabe einzelner Geometriedaten der Uebergabewerte mit verschiedenen Varianten
|
|
|
|
|
float *receiver_list_ptr;
|
|
|
|
|
receiver_list_ptr = (float*)mxGetPr(receiver_list);
|
|
|
|
|
receiver_list_ptr = (float*)GetPr(receiver_list);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputVariables
|
|
|
|
|
|
|
|
|
|
@@ -1177,21 +1175,21 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 6.Input Parameter - Check emitter_list
|
|
|
|
|
emitter_list_Nx = mxGetDimensions(emitter_list)[0]; // Reihen N ermitteln
|
|
|
|
|
emitter_list_Mx = mxGetDimensions(emitter_list)[1]; // Spalten M ermitteln // emitter_list gibt die maximale Anzahl an Emittern die in diesem Block vorkommen können wieder!
|
|
|
|
|
emitter_list_Nx = GetDimensions(emitter_list)[0]; // Reihen N ermitteln
|
|
|
|
|
emitter_list_Mx = GetDimensions(emitter_list)[1]; // Spalten M ermitteln // emitter_list gibt die maximale Anzahl an Emittern die in diesem Block vorkommen können wieder!
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[5] emitter_list [%ix%i]\n", emitter_list_Nx , emitter_list_Mx);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(emitter_list_Nx == 3))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of emitter_list must be [3 x M]");
|
|
|
|
|
if(!(mxIsSingle(receiver_list)))
|
|
|
|
|
mexErrMsgTxt(" -> emitter_list must be Single");
|
|
|
|
|
printf(" -> Dimension of emitter_list must be [3 x M]");
|
|
|
|
|
// if(!(mxIsSingle(receiver_list)))
|
|
|
|
|
// printf(" -> emitter_list must be Single");
|
|
|
|
|
|
|
|
|
|
// Ausgabe einzelner Geometriedaten der übergabewerte mit verschiedenen Varianten
|
|
|
|
|
float *emitter_list_ptr;
|
|
|
|
|
emitter_list_ptr = (float*)mxGetPr(emitter_list);
|
|
|
|
|
emitter_list_ptr = (float*)GetPr(emitter_list);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputVariables
|
|
|
|
|
|
|
|
|
|
@@ -1209,10 +1207,10 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 7.Input Parameter - Check SAFT_mode
|
|
|
|
|
SAFT_mode_Nx = mxGetDimensions(SAFT_mode)[0]; // Reihen N ermitteln
|
|
|
|
|
SAFT_mode_Mx = mxGetDimensions(SAFT_mode)[1]; // Spalten M ermitteln
|
|
|
|
|
SAFT_mode_Nx = GetDimensions(SAFT_mode)[0]; // Reihen N ermitteln
|
|
|
|
|
SAFT_mode_Mx = GetDimensions(SAFT_mode)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
SAFT_MODE = *((int*)mxGetPr(SAFT_mode));
|
|
|
|
|
SAFT_MODE = *((int*)GetPr(SAFT_mode));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
@@ -1220,9 +1218,9 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(SAFT_mode_Nx == 1))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of SAFT_MODE must be [1 x 1]");
|
|
|
|
|
if(!(mxIsUint32(SAFT_mode)))
|
|
|
|
|
mexErrMsgTxt(" -> SAFT_MODE must be Uint32");
|
|
|
|
|
printf(" -> Dimension of SAFT_MODE must be [1 x 1]");
|
|
|
|
|
// if(!(mxIsUint32(SAFT_mode)))
|
|
|
|
|
// printf(" -> SAFT_MODE must be Uint32");
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf ( "\e[7;37m ======================================================================================== \e[0m\n");
|
|
|
|
|
@@ -1233,7 +1231,7 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
case 0:
|
|
|
|
|
SOSMode_3DVolume = false; ATTMode_3DVolume = false;
|
|
|
|
|
//printf ( "\e[7;37m Standard SAFT without correction (-SOS -ATT) (%i,%i) \e[0m", SOSMode_3DVolume, ATTMode_3DVolume);
|
|
|
|
|
mexErrMsgTxt (" -> AscanIndexVersion only make sense with SOS or SOS and ATT Volume => exit");
|
|
|
|
|
printf (" -> AscanIndexVersion only make sense with SOS or SOS and ATT Volume => exit");
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
SOSMode_3DVolume = true; ATTMode_3DVolume = false;
|
|
|
|
|
@@ -1246,12 +1244,12 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
case 3:
|
|
|
|
|
//SOSMode_3DVolume = true; ATTMode_3DVolume = true;
|
|
|
|
|
//printf ( "\e[7;37m SAFT_MODE = 3 \e[0m", SOSMode_3DVolume, ATTMode_3DVolume);
|
|
|
|
|
mexErrMsgTxt(" -> not implemented => exit");
|
|
|
|
|
printf(" -> not implemented => exit");
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
//SOSMode_3DVolume = false; ATTMode_3DVolume = false;
|
|
|
|
|
//printf ( "\e[7;37m SAFT_MODE = 4 \e[0m", SOSMode_3DVolume, ATTMode_3DVolume);
|
|
|
|
|
mexErrMsgTxt(" -> not implemented => exit");
|
|
|
|
|
printf(" -> not implemented => exit");
|
|
|
|
|
break;
|
|
|
|
|
default: SOSMode_3DVolume = false; ATTMode_3DVolume = false;
|
|
|
|
|
//printf ( " -> SAFT_MODE %i is out of range [0..3] => use Standard SAFT\n", SAFT_MODE);
|
|
|
|
|
@@ -1267,10 +1265,10 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 8.Input Parameter - Check SAFT_variant
|
|
|
|
|
SAFT_variant_Nx = mxGetDimensions(SAFT_variant)[0]; // Reihen N ermitteln
|
|
|
|
|
SAFT_variant_Mx = mxGetDimensions(SAFT_variant)[1]; // Spalten M ermitteln
|
|
|
|
|
SAFT_variant_Nx = GetDimensions(SAFT_variant)[0]; // Reihen N ermitteln
|
|
|
|
|
SAFT_variant_Mx = GetDimensions(SAFT_variant)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
SAFT_VARIANT = (int*)mxGetPr(SAFT_variant);
|
|
|
|
|
SAFT_VARIANT = (int*)GetPr(SAFT_variant);
|
|
|
|
|
SAFT_VARIANT_Size = SAFT_variant_Mx;
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
@@ -1283,10 +1281,10 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
printf(" -> Sum up over boarder Indices not yet = [%i]\n", SAFT_VARIANT[SAFT_VARIANT_SumUpOverBoarderIndices]);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if(!(mxIsUint32(SAFT_variant)))
|
|
|
|
|
mexErrMsgTxt(" -> SAFT_VARIANT must be Uint32");
|
|
|
|
|
// if(!(mxIsUint32(SAFT_variant)))
|
|
|
|
|
// printf(" -> SAFT_VARIANT must be Uint32");
|
|
|
|
|
if (!(SAFT_variant_Nx == 1)||!(SAFT_variant_Mx == 6))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of SAFT_VARIANT must be [1 x 6]");
|
|
|
|
|
printf(" -> Dimension of SAFT_VARIANT must be [1 x 6]");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1294,44 +1292,44 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 9.Input Parameter - Check for SOS volume
|
|
|
|
|
speed_Nx = mxGetDimensions(speed)[0]; // Reihen N ermitteln
|
|
|
|
|
speed_Mx = mxGetDimensions(speed)[1]; // Spalten M ermitteln
|
|
|
|
|
float Sos = *((float*)mxGetPr(speed));
|
|
|
|
|
speed_Nx = GetDimensions(speed)[0]; // Reihen N ermitteln
|
|
|
|
|
speed_Mx = GetDimensions(speed)[1]; // Spalten M ermitteln
|
|
|
|
|
float Sos = *((float*)GetPr(speed));
|
|
|
|
|
|
|
|
|
|
float *speed_vec_ptr;
|
|
|
|
|
speed_vec_ptr = (float*)mxGetPr(speed); // Pointer für SoSDaten ermitteln
|
|
|
|
|
speed_vec_ptr = (float*)GetPr(speed); // Pointer für SoSDaten ermitteln
|
|
|
|
|
|
|
|
|
|
if(!(mxIsSingle(speed)))
|
|
|
|
|
mexErrMsgTxt(" -> SOSVolume must be Single");
|
|
|
|
|
// if(!(mxIsSingle(speed)))
|
|
|
|
|
// printf(" -> SOSVolume must be Single");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (SOSMode_3DVolume == true) // SOS correction need 3D Volume
|
|
|
|
|
{
|
|
|
|
|
if (mxGetNumberOfDimensions(speed) == 3){
|
|
|
|
|
if (GetNumberOfDimensions(speed) == 3){
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[8] SOSVolume [%ix%ix%i]\n", mxGetDimensions(speed)[0] , mxGetDimensions(speed)[1], mxGetDimensions(speed)[2]);
|
|
|
|
|
printf( " -> use SoS-Mode with SoS-Correction per Path with SOS 3D Volume\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!( (speed_Nx > 1)&&(speed_Mx > 1) )){
|
|
|
|
|
mexErrMsgTxt( " -> SOSGrid_XYZ.x and SOSGrid_XYZ.y must be > 1 for SOS Correction with 3D Volume!!!");
|
|
|
|
|
printf( " -> SOSGrid_XYZ.x and SOSGrid_XYZ.y must be > 1 for SOS Correction with 3D Volume!!!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (mxGetNumberOfDimensions(speed) == 2){
|
|
|
|
|
printf ( "prhs[8] SOSVolume [%ix%i]\n", mxGetDimensions(speed)[0] , mxGetDimensions(speed)[1]);
|
|
|
|
|
mexErrMsgTxt( " -> SOSVolume is not a 3D Volume as expected!");
|
|
|
|
|
else if (GetNumberOfDimensions(speed) == 2){
|
|
|
|
|
printf ( "prhs[8] SOSVolume [%ix%i]\n",(int)GetDimensions(speed)[0] , (int)GetDimensions(speed)[1]);
|
|
|
|
|
printf( " -> SOSVolume is not a 3D Volume as expected!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SOSGrid_Xx = mxGetDimensions(speed)[0]; // SOSGrid_X ermitteln
|
|
|
|
|
SOSGrid_Yx = mxGetDimensions(speed)[1]; // SOSGrid_Y ermitteln
|
|
|
|
|
SOSGrid_Zx = mxGetDimensions(speed)[2]; // SOSGrid_Z ermitteln
|
|
|
|
|
SOSGrid_Xx = GetDimensions(speed)[0]; // SOSGrid_X ermitteln
|
|
|
|
|
SOSGrid_Yx = GetDimensions(speed)[1]; // SOSGrid_Y ermitteln
|
|
|
|
|
SOSGrid_Zx = GetDimensions(speed)[2]; // SOSGrid_Z ermitteln
|
|
|
|
|
|
|
|
|
|
SOSGrid_XYZ.x = SOSGrid_Xx;
|
|
|
|
|
SOSGrid_XYZ.y = SOSGrid_Yx;
|
|
|
|
|
SOSGrid_XYZ.z = SOSGrid_Zx;
|
|
|
|
|
|
|
|
|
|
if ((SOSGrid_XYZ.x > 128)||(SOSGrid_XYZ.y > 128)|| (SOSGrid_XYZ.z > 128)){
|
|
|
|
|
printf ( " -> SOSGrid_XYZ [%i x %i x %i]\n", SOSGrid_Xx, SOSGrid_Yx, SOSGrid_Zx);
|
|
|
|
|
printf ( " -> SOSGrid_XYZ [%i x %i x %i]\n", (int)SOSGrid_Xx, (int)SOSGrid_Yx, (int)SOSGrid_Zx);
|
|
|
|
|
printf ( " Warning -> SOSGrid_XYZ.x, SOSGrid_XYZ.y, SOSGrid_XYZ.z > 128!!! --> can be problematic due to memory requirement\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1353,12 +1351,12 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 10.Input Parameter - Check SoS Startpoint
|
|
|
|
|
sos_startPoint_Nx = mxGetDimensions(sos_startPoint)[0]; // Reihen N ermitteln
|
|
|
|
|
sos_startPoint_Mx = mxGetDimensions(sos_startPoint)[1]; // Spalten M ermitteln
|
|
|
|
|
sos_startPoint_Nx = GetDimensions(sos_startPoint)[0]; // Reihen N ermitteln
|
|
|
|
|
sos_startPoint_Mx = GetDimensions(sos_startPoint)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
sosOffset.x = *((float*)mxGetPr(sos_startPoint));
|
|
|
|
|
sosOffset.y = *((float*)mxGetPr(sos_startPoint)+1);
|
|
|
|
|
sosOffset.z = *((float*)mxGetPr(sos_startPoint)+2);
|
|
|
|
|
sosOffset.x = *((float*)GetPr(sos_startPoint));
|
|
|
|
|
sosOffset.y = *((float*)GetPr(sos_startPoint)+1);
|
|
|
|
|
sosOffset.z = *((float*)GetPr(sos_startPoint)+2);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[9] SOS_STARTPOINT_S [%ix%i] = [%f x %f x %f]\n", sos_startPoint_Nx , sos_startPoint_Mx, sosOffset.x, sosOffset.y, sosOffset.z);
|
|
|
|
|
@@ -1366,18 +1364,18 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!(sos_startPoint_Nx == 1)||!(sos_startPoint_Mx == 3))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of SOS_STARTPOINT_S must be [1 x 3]");
|
|
|
|
|
printf(" -> Dimension of SOS_STARTPOINT_S must be [1 x 3]");
|
|
|
|
|
if ((sos_startPoint_Nx > 1))
|
|
|
|
|
printf( " -> No Blockmode [%i x 3] allowed for SOS_STARTPOINT_S\n", sos_startPoint_Nx);
|
|
|
|
|
if(!(mxIsSingle(sos_startPoint)))
|
|
|
|
|
mexErrMsgTxt(" -> SOS_STARTPOINT_S must be Single");
|
|
|
|
|
// if(!(mxIsSingle(sos_startPoint)))
|
|
|
|
|
// printf(" -> SOS_STARTPOINT_S must be Single");
|
|
|
|
|
|
|
|
|
|
//====================================================================== 11.Input Parameter - Check SoS_RESOLUTION / sos_res
|
|
|
|
|
if (SOSMode_3DVolume == true){
|
|
|
|
|
sos_res_Nx = mxGetDimensions(sos_res)[0]; // Reihen N ermitteln
|
|
|
|
|
sos_res_Mx = mxGetDimensions(sos_res)[1]; // Spalten M ermitteln
|
|
|
|
|
sos_res_Nx = GetDimensions(sos_res)[0]; // Reihen N ermitteln
|
|
|
|
|
sos_res_Mx = GetDimensions(sos_res)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
SOS_RESOLUTION = *((float*)mxGetPr(sos_res));
|
|
|
|
|
SOS_RESOLUTION = *((float*)GetPr(sos_res));
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[10] SOS_RESOLUTION_S [%ix%i] = [%f]\n", sos_res_Nx , sos_res_Mx, SOS_RESOLUTION);
|
|
|
|
|
@@ -1385,46 +1383,46 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!(sos_res_Nx == 1))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of SOS_RESOLUTION_S must be [1 x 1]");
|
|
|
|
|
printf(" -> Dimension of SOS_RESOLUTION_S must be [1 x 1]");
|
|
|
|
|
if ((sos_res_Mx > 1))
|
|
|
|
|
printf( " -> No Blockmode allowed for SOS_RESOLUTION_S! [1 x %i]\n", sos_res_Mx);
|
|
|
|
|
if(!(mxIsSingle(sos_res)))
|
|
|
|
|
mexErrMsgTxt(" -> SOS_RESOLUTION_S must be Single");
|
|
|
|
|
// if(!(mxIsSingle(sos_res)))
|
|
|
|
|
// printf(" -> SOS_RESOLUTION_S must be Single");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//====================================================================== 12.Input Parameter - Check for ATTVolume / Attenuation-Data
|
|
|
|
|
|
|
|
|
|
attVolume_Nx = mxGetDimensions(attVolume)[0]; // Reihen N ermitteln
|
|
|
|
|
attVolume_Mx = mxGetDimensions(attVolume)[1]; // Spalten M ermitteln
|
|
|
|
|
attVolume_Nx = GetDimensions(attVolume)[0]; // Reihen N ermitteln
|
|
|
|
|
attVolume_Mx = GetDimensions(attVolume)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
float *att_vec_ptr;
|
|
|
|
|
att_vec_ptr = (float*)mxGetPr(attVolume); // Pointer für ATT-Daten ermitteln
|
|
|
|
|
att_vec_ptr = (float*)GetPr(attVolume); // Pointer für ATT-Daten ermitteln
|
|
|
|
|
|
|
|
|
|
if(!(mxIsSingle(attVolume)))
|
|
|
|
|
mexErrMsgTxt(" -> attVolume must be Single");
|
|
|
|
|
// if(!(mxIsSingle(attVolume)))
|
|
|
|
|
// printf(" -> attVolume must be Single");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mxGetNumberOfDimensions(attVolume) == 3){
|
|
|
|
|
if (GetNumberOfDimensions(attVolume) == 3){
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[11] attVolume [%ix%ix%i]\n", mxGetDimensions(attVolume)[0] , mxGetDimensions(attVolume)[1], mxGetDimensions(attVolume)[2]);
|
|
|
|
|
printf( " -> use ATT-Mode with ATT-Correction per Path with ATT 3D Volume\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!( (attVolume_Nx > 1)&&(attVolume_Mx > 1) )){
|
|
|
|
|
mexErrMsgTxt( " -> ATTGrid_XYZ.x and ATTGrid_XYZ.y must be > 1 for ATT Correction with 3D Volume!!!");
|
|
|
|
|
printf( " -> ATTGrid_XYZ.x and ATTGrid_XYZ.y must be > 1 for ATT Correction with 3D Volume!!!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (mxGetNumberOfDimensions(attVolume) == 2){
|
|
|
|
|
else if (GetNumberOfDimensions(attVolume) == 2){
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf ( "prhs[11] attVolume [%ix%i]\n", mxGetDimensions(attVolume)[0] , mxGetDimensions(attVolume)[1]);
|
|
|
|
|
mexErrMsgTxt( " -> attVolume is not a 3D Volume as expected!");
|
|
|
|
|
printf( " -> attVolume is not a 3D Volume as expected!");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((SOSMode_3DVolume == true)&&(ATTMode_3DVolume == true)){ // 3D Volume muss bei SOS und ATT angegeben sein damit ATT Korrektur durchgefuehrt werden kann
|
|
|
|
|
ATTGrid_Xx = mxGetDimensions(attVolume)[0]; // ATTGrid_X ermitteln
|
|
|
|
|
ATTGrid_Yx = mxGetDimensions(attVolume)[1]; // ATTGrid_Y ermitteln
|
|
|
|
|
ATTGrid_Zx = mxGetDimensions(attVolume)[2]; // ATTGrid_Z ermitteln
|
|
|
|
|
ATTGrid_Xx = GetDimensions(attVolume)[0]; // ATTGrid_X ermitteln
|
|
|
|
|
ATTGrid_Yx = GetDimensions(attVolume)[1]; // ATTGrid_Y ermitteln
|
|
|
|
|
ATTGrid_Zx = GetDimensions(attVolume)[2]; // ATTGrid_Z ermitteln
|
|
|
|
|
|
|
|
|
|
ATTGrid_XYZ.x = ATTGrid_Xx;
|
|
|
|
|
ATTGrid_XYZ.y = ATTGrid_Yx;
|
|
|
|
|
@@ -1437,7 +1435,7 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
if ((ATTGrid_XYZ.x != SOSGrid_XYZ.x) || (ATTGrid_XYZ.y != SOSGrid_XYZ.y) || (ATTGrid_XYZ.z != SOSGrid_XYZ.z)){ // Restriction: Volume parameter of ATT & SOS must be the same
|
|
|
|
|
printf( " -> ATTGrid[%i %i %i] != SOSGrid[%i %i %i]!\n", ATTGrid_XYZ.x , ATTGrid_XYZ.y, ATTGrid_XYZ.z, SOSGrid_XYZ.x , SOSGrid_XYZ.y, SOSGrid_XYZ.z);
|
|
|
|
|
mexErrMsgTxt(" -> ATTGrid must have the same size as SOSGrid \n");
|
|
|
|
|
printf(" -> ATTGrid must have the same size as SOSGrid \n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputVariables
|
|
|
|
|
@@ -1472,97 +1470,97 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 13.Input Parameter - Check IMAGE_RESOLUTION_S / res
|
|
|
|
|
res_Nx = mxGetDimensions(res)[0]; // Reihen N ermitteln
|
|
|
|
|
res_Mx = mxGetDimensions(res)[1]; // Spalten M ermitteln
|
|
|
|
|
res_Nx = GetDimensions(res)[0]; // Reihen N ermitteln
|
|
|
|
|
res_Mx = GetDimensions(res)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
IMAGE_RESOLUTION = *((float*)mxGetPr(res));
|
|
|
|
|
IMAGE_RESOLUTION = *((float*)GetPr(res));
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[12] IMAGE_RESOLUTION_S [%ix%i] = [%f]\n", res_Nx , res_Mx, IMAGE_RESOLUTION);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(res_Nx == 1))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of IMAGE_RESOLUTION must be [1 x 1]");
|
|
|
|
|
printf(" -> Dimension of IMAGE_RESOLUTION must be [1 x 1]");
|
|
|
|
|
if ((res_Mx > 1))
|
|
|
|
|
printf( " -> No Blockmode allowed for IMAGE_RESOLUTION! [1 x %i]\n", res_Mx);
|
|
|
|
|
if(!(mxIsSingle(res)))
|
|
|
|
|
mexErrMsgTxt(" -> IMAGE_RESOLUTION must be Single");
|
|
|
|
|
// if(!(mxIsSingle(res)))
|
|
|
|
|
// printf(" -> IMAGE_RESOLUTION must be Single");
|
|
|
|
|
|
|
|
|
|
if (SOSMode_3DVolume == true){
|
|
|
|
|
if(IMAGE_RESOLUTION > SOS_RESOLUTION){
|
|
|
|
|
printf( " -> IMAGE_RESOLUTION (%f) > SOS_RESOLUTION (%f)\n", IMAGE_RESOLUTION, SOS_RESOLUTION);
|
|
|
|
|
mexErrMsgTxt(" -> IMAGE_RESOLUTION must not > SOS_RESOLUTION !!!");
|
|
|
|
|
printf(" -> IMAGE_RESOLUTION must not > SOS_RESOLUTION !!!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 14.Input Parameter - Check TimeInterval_S / Timeint
|
|
|
|
|
timeint_Nx = mxGetDimensions(timeint)[0]; // Reihen N ermitteln
|
|
|
|
|
timeint_Mx = mxGetDimensions(timeint)[1]; // Spalten M ermitteln
|
|
|
|
|
timeint_Nx = GetDimensions(timeint)[0]; // Reihen N ermitteln
|
|
|
|
|
timeint_Mx = GetDimensions(timeint)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
sampleRate = *((float*)mxGetPr(timeint));
|
|
|
|
|
sampleRate = *((float*)GetPr(timeint));
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[13] TimeInterval_S [%ix%i] = [%e]\n", timeint_Nx , timeint_Mx, sampleRate);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(timeint_Nx == 1))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of TimeInterval_S must be [1 x 1]");
|
|
|
|
|
printf(" -> Dimension of TimeInterval_S must be [1 x 1]");
|
|
|
|
|
if ((timeint_Mx > 1))
|
|
|
|
|
printf( " -> No Blockmode allowed for TimeInterval_S! [1 x %i]\n", timeint_Mx);
|
|
|
|
|
if(!(mxIsSingle(timeint)))
|
|
|
|
|
mexErrMsgTxt(" -> TimeInterval_S must be Single");
|
|
|
|
|
// if(!(mxIsSingle(timeint)))
|
|
|
|
|
// printf(" -> TimeInterval_S must be Single");
|
|
|
|
|
|
|
|
|
|
//====================================================================== 15.Input Parameter - Check IMAGE_XYZ_UI32 / IMAGE_XYZ
|
|
|
|
|
IMAGE_XYZ_Nx = mxGetDimensions(IMAGE_XYZ)[0]; // Reihen N ermitteln
|
|
|
|
|
IMAGE_XYZ_Mx = mxGetDimensions(IMAGE_XYZ)[1]; // Spalten M ermitteln
|
|
|
|
|
IMAGE_XYZ_Nx = GetDimensions(IMAGE_XYZ)[0]; // Reihen N ermitteln
|
|
|
|
|
IMAGE_XYZ_Mx = GetDimensions(IMAGE_XYZ)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
IMAGE_SIZE_XYZ.x = *((int*)mxGetPr(IMAGE_XYZ));
|
|
|
|
|
IMAGE_SIZE_XYZ.y = *((int*)mxGetPr(IMAGE_XYZ)+1);
|
|
|
|
|
IMAGE_SIZE_XYZ.z = *((int*)mxGetPr(IMAGE_XYZ)+2);
|
|
|
|
|
IMAGE_SIZE_XYZ.x = *((int*)GetPr(IMAGE_XYZ));
|
|
|
|
|
IMAGE_SIZE_XYZ.y = *((int*)GetPr(IMAGE_XYZ)+1);
|
|
|
|
|
IMAGE_SIZE_XYZ.z = *((int*)GetPr(IMAGE_XYZ)+2);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[14] IMAGE_XYZ [%ix%i] = [%ix%ix%i]\n", IMAGE_XYZ_Nx , IMAGE_XYZ_Mx,IMAGE_SIZE_XYZ.x, IMAGE_SIZE_XYZ.y, IMAGE_SIZE_XYZ.z);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(IMAGE_XYZ_Nx == 1)||!(IMAGE_XYZ_Mx == 3))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of IMAGE_XYZ must be [1 x 3]");
|
|
|
|
|
printf(" -> Dimension of IMAGE_XYZ must be [1 x 3]");
|
|
|
|
|
if ((IMAGE_XYZ_Nx > 1))
|
|
|
|
|
printf( " -> No Blockmode allowed for IMAGE_XYZ! [%i x 3]\n", IMAGE_XYZ_Nx);
|
|
|
|
|
if(!(mxIsUint32(IMAGE_XYZ)))
|
|
|
|
|
mexErrMsgTxt(" -> IMAGE_XYZ must be UINT32");
|
|
|
|
|
// if(!(mxIsUint32(IMAGE_XYZ)))
|
|
|
|
|
// printf(" -> IMAGE_XYZ must be UINT32");
|
|
|
|
|
|
|
|
|
|
if ((IMAGE_SIZE_XYZ.x > 8192)||(IMAGE_SIZE_XYZ.y > 8192)) // Aufteilung in BlockDim 512,1,1 passt für 5632x5632. Es würde etwas weiter gehen aber dann muss Y kleiner sein.
|
|
|
|
|
mexErrMsgTxt(" -> IMAGE_XYZ must not > [8192 x 8192 x N]!!!");
|
|
|
|
|
printf(" -> IMAGE_XYZ must not > [8192 x 8192 x N]!!!");
|
|
|
|
|
|
|
|
|
|
//====================================================================== 16.Input Parameter - Check Env / IMAGE_SUM
|
|
|
|
|
IMAGE_SUM_Xx = mxGetDimensions(IMAGE_SUM)[0]; // Spalten M ermitteln X
|
|
|
|
|
IMAGE_SUM_Yx = mxGetDimensions(IMAGE_SUM)[1]; // Reihen N ermitteln Y
|
|
|
|
|
IMAGE_SUM_Xx = GetDimensions(IMAGE_SUM)[0]; // Spalten M ermitteln X
|
|
|
|
|
IMAGE_SUM_Yx = GetDimensions(IMAGE_SUM)[1]; // Reihen N ermitteln Y
|
|
|
|
|
|
|
|
|
|
if (mxGetNumberOfDimensions(IMAGE_SUM) > 2)
|
|
|
|
|
IMAGE_SUM_Zx = mxGetDimensions(IMAGE_SUM)[2]; // Z-Schichten ermitteln Z
|
|
|
|
|
else if (mxGetNumberOfDimensions(IMAGE_SUM) == 2)
|
|
|
|
|
if (GetNumberOfDimensions(IMAGE_SUM) > 2)
|
|
|
|
|
IMAGE_SUM_Zx = GetDimensions(IMAGE_SUM)[2]; // Z-Schichten ermitteln Z
|
|
|
|
|
else if (GetNumberOfDimensions(IMAGE_SUM) == 2)
|
|
|
|
|
IMAGE_SUM_Zx = 1; // Z-Schichten = 1
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf( " -> mxGetNumberOfDimensions of IMAGE_SUM = %i\n", mxGetNumberOfDimensions(IMAGE_SUM));
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of IMAGE_SUM must be 3: [X x Y x Z]");
|
|
|
|
|
printf( " -> mxGetNumberOfDimensions of IMAGE_SUM = %i\n", (int)GetNumberOfDimensions(IMAGE_SUM));
|
|
|
|
|
printf(" -> Dimension of IMAGE_SUM must be 3: [X x Y x Z]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[15] IMAGE_SUM [%ix%ix%i]\n", IMAGE_SUM_Xx , IMAGE_SUM_Yx, IMAGE_SUM_Zx);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if(!(mxIsDouble(IMAGE_SUM)))
|
|
|
|
|
mexErrMsgTxt(" -> IMAGE_SUM must be Double");
|
|
|
|
|
if(!(mxGetNumberOfElements(IMAGE_SUM) == ((size_t)IMAGE_SIZE_XYZ.x * (size_t)IMAGE_SIZE_XYZ.y * (size_t)IMAGE_SIZE_XYZ.z)))
|
|
|
|
|
{
|
|
|
|
|
printf( " -> IMAGE_SUM and the Number of Voxels don't match: %lld = [%lldx%lldx%lld]\n",mxGetNumberOfElements(IMAGE_SUM), IMAGE_SIZE_XYZ.x, IMAGE_SIZE_XYZ.y, IMAGE_SIZE_XYZ.z);
|
|
|
|
|
mexErrMsgTxt(" -> Make sure that they have the same size");
|
|
|
|
|
}
|
|
|
|
|
// if(!(mxIsDouble(IMAGE_SUM)))
|
|
|
|
|
// printf(" -> IMAGE_SUM must be Double");
|
|
|
|
|
// if(!(mxGetNumberOfElements(IMAGE_SUM) == ((size_t)IMAGE_SIZE_XYZ.x * (size_t)IMAGE_SIZE_XYZ.y * (size_t)IMAGE_SIZE_XYZ.z)))
|
|
|
|
|
// {
|
|
|
|
|
// printf( " -> IMAGE_SUM and the Number of Voxels don't match: %lld = [%lldx%lldx%lld]\n",(int)GetNumberOfElements(IMAGE_SUM), IMAGE_SIZE_XYZ.x, IMAGE_SIZE_XYZ.y, IMAGE_SIZE_XYZ.z);
|
|
|
|
|
// printf(" -> Make sure that they have the same size");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
uint64_t IMAGE_SUM_Count = mxGetNumberOfElements(IMAGE_SUM);
|
|
|
|
|
double *IMAGE_SUM_vec_ptr = (double*)mxGetPr(IMAGE_SUM);
|
|
|
|
|
uint64_t IMAGE_SUM_Count = GetNumberOfElements(IMAGE_SUM);
|
|
|
|
|
double *IMAGE_SUM_vec_ptr = (double*)GetPr(IMAGE_SUM);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputVariables
|
|
|
|
|
printf( " -> IMAGE_SUM: %i = [%f %f %f]\n",0 , IMAGE_SUM_vec_ptr[0], IMAGE_SUM_vec_ptr[1], IMAGE_SUM_vec_ptr[2]);
|
|
|
|
|
@@ -1573,23 +1571,23 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
//====================================================================== 17.Input Parameter - Check BlockDimension for GPU
|
|
|
|
|
|
|
|
|
|
BlockDim_XYZ_Nx = mxGetDimensions(BlockDim)[0]; // Reihen N ermitteln
|
|
|
|
|
BlockDim_XYZ_Mx = mxGetDimensions(BlockDim)[1]; // Spalten M ermitteln
|
|
|
|
|
BlockDim_XYZ_Nx = GetDimensions(BlockDim)[0]; // Reihen N ermitteln
|
|
|
|
|
BlockDim_XYZ_Mx = GetDimensions(BlockDim)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
BlockDim_XYZ.x = *((int*)mxGetPr(BlockDim));
|
|
|
|
|
BlockDim_XYZ.y = *((int*)mxGetPr(BlockDim)+1);
|
|
|
|
|
BlockDim_XYZ.z = *((int*)mxGetPr(BlockDim)+2);
|
|
|
|
|
BlockDim_XYZ.x = *((int*)GetPr(BlockDim));
|
|
|
|
|
BlockDim_XYZ.y = *((int*)GetPr(BlockDim)+1);
|
|
|
|
|
BlockDim_XYZ.z = *((int*)GetPr(BlockDim)+2);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[16] BlockDim_XYZ (GPU) [%ix%i] = [%ix%ix%i]\n", BlockDim_XYZ_Nx , BlockDim_XYZ_Mx, BlockDim_XYZ.x, BlockDim_XYZ.y, BlockDim_XYZ.z);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(BlockDim_XYZ_Nx == 1)||!(BlockDim_XYZ_Mx == 3))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of BlockDim_XYZ must be [1 x 3]");
|
|
|
|
|
printf(" -> Dimension of BlockDim_XYZ must be [1 x 3]");
|
|
|
|
|
if ((BlockDim_XYZ_Nx > 1))
|
|
|
|
|
printf( " -> No Blockmode! [%i x 3]\n", BlockDim_XYZ_Nx);
|
|
|
|
|
if(!(mxIsUint32(BlockDim)))
|
|
|
|
|
mexErrMsgTxt(" -> BlockDim_XYZ must be UINT32");
|
|
|
|
|
printf( " -> No Blockmode! [%i x 3]\n", (int)BlockDim_XYZ_Nx);
|
|
|
|
|
// if(!(mxIsUint32(BlockDim)))
|
|
|
|
|
// printf(" -> BlockDim_XYZ must be UINT32");
|
|
|
|
|
|
|
|
|
|
if ((BlockDim_XYZ.x * BlockDim_XYZ.y * BlockDim_XYZ.z) > 1024){ // BlockSize limited to 1024. Perhaps newer GPUs will support more Threads per Block
|
|
|
|
|
printf( " -> BlockDim_XYZ.x * BlockDim_XYZ.y * BlockDim_XYZ.z must not > 1024!!!");
|
|
|
|
|
@@ -1607,14 +1605,14 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
int *enableGPUs_ptr;
|
|
|
|
|
|
|
|
|
|
GPUs_Nx = mxGetDimensions(GPUs)[0]; // Reihen N ermitteln
|
|
|
|
|
GPUs_Mx = mxGetDimensions(GPUs)[1]; // Spalten M ermitteln
|
|
|
|
|
GPUs_Nx = GetDimensions(GPUs)[0]; // Reihen N ermitteln
|
|
|
|
|
GPUs_Mx = GetDimensions(GPUs)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[17] GPUs [%ix%i] \n", GPUs_Nx , GPUs_Mx);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
enableGPUs_ptr = (int*)mxGetPr(GPUs);
|
|
|
|
|
enableGPUs_ptr = (int*)GetPr(GPUs);
|
|
|
|
|
selectedNumberGPUs = GPUs_Mx;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1654,7 +1652,7 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
if (enableGPUs_ptr[gpuNr] > (num_devices-1)){ // Check if more GPUs are selected then available in System
|
|
|
|
|
printf( "\n enableGPUs_ptr[gpuNr=%i] = %i !!!\n", gpuNr, enableGPUs_ptr[gpuNr]);
|
|
|
|
|
mexErrMsgTxt(" -> selected number of GPU > available Devices is not allowed!");
|
|
|
|
|
printf(" -> selected number of GPU > available Devices is not allowed!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (gpuNrCheck = 0; gpuNrCheck < gpuNr; ++gpuNrCheck){
|
|
|
|
|
@@ -1662,7 +1660,7 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
printf( "\n enableGPUs_ptr[gpuNrCheck %i] = %i, enableGPUs_ptr[gpuNr %i] = %i\n",gpuNrCheck, enableGPUs_ptr[gpuNrCheck], gpuNr, enableGPUs_ptr[gpuNr]);
|
|
|
|
|
#endif
|
|
|
|
|
if (enableGPUs_ptr[gpuNrCheck] == enableGPUs_ptr[gpuNr])
|
|
|
|
|
mexErrMsgTxt(" -> GPU Device can only be used once!!!");
|
|
|
|
|
printf(" -> GPU Device can only be used once!!!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1671,29 +1669,29 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(GPUs_Nx == 1)||!(GPUs_Mx < 10))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of GPUs must be [1 x <10]");
|
|
|
|
|
printf(" -> Dimension of GPUs must be [1 x <10]");
|
|
|
|
|
if ((pix_vect_Nx > 1))
|
|
|
|
|
printf( " -> No Blockmode [%i x n] allowed for GPUs\n", GPUs_Nx);
|
|
|
|
|
if(!(mxIsUint32(GPUs)))
|
|
|
|
|
mexErrMsgTxt(" -> GPUs must be UINT32");
|
|
|
|
|
// if(!(mxIsUint32(GPUs)))
|
|
|
|
|
// printf(" -> GPUs must be UINT32");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================================== 19.Input Parameter - debugMode, debugModeParameter
|
|
|
|
|
dbgMode_Nx = mxGetDimensions(dbgMode)[0]; // Reihen N ermitteln
|
|
|
|
|
dbgMode_Mx = mxGetDimensions(dbgMode)[1]; // Spalten M ermitteln
|
|
|
|
|
dbgMode_Nx = GetDimensions(dbgMode)[0]; // Reihen N ermitteln
|
|
|
|
|
dbgMode_Mx = GetDimensions(dbgMode)[1]; // Spalten M ermitteln
|
|
|
|
|
|
|
|
|
|
debugMode = *((float*)mxGetPr(dbgMode) );
|
|
|
|
|
debugModeParameter = *((float*)mxGetPr(dbgMode)+1);
|
|
|
|
|
debugMode = *((float*)GetPr(dbgMode) );
|
|
|
|
|
debugModeParameter = *((float*)GetPr(dbgMode)+1);
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "prhs[18] debugMode [%ix%i] = [%f %f]\n", dbgMode_Nx , dbgMode_Mx, debugMode, debugModeParameter);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if ((dbgMode_Nx != 1)||(dbgMode_Mx != 2))
|
|
|
|
|
mexErrMsgTxt(" -> Dimension of debugMode must be [1 x 2]\n");
|
|
|
|
|
if(!(mxIsSingle(dbgMode)))
|
|
|
|
|
mexErrMsgTxt(" -> debugMode must be single");
|
|
|
|
|
printf(" -> Dimension of debugMode must be [1 x 2]\n");
|
|
|
|
|
// if(!(mxIsSingle(dbgMode)))
|
|
|
|
|
// printf(" -> debugMode must be single");
|
|
|
|
|
if(debugMode != 0.0)
|
|
|
|
|
printf (" -> debugMode = [%f], debugModeParameter = [%f]\n", debugMode, debugModeParameter);
|
|
|
|
|
|
|
|
|
|
@@ -1724,17 +1722,21 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
|
|
|
|
|
// ~~~~ Create 3D-Matrix for the Output-Values
|
|
|
|
|
// Output-Dimension is {IMAGE_XYZ_X, IMAGE_XYZ_Y, IMAGE_XYZ_Z}
|
|
|
|
|
const mwSize dims[]={IMAGE_SIZE_XYZ.x, IMAGE_SIZE_XYZ.y, IMAGE_SIZE_XYZ.z};
|
|
|
|
|
mwSize ndim = 3;
|
|
|
|
|
const int dims[]={IMAGE_SIZE_XYZ.x, IMAGE_SIZE_XYZ.y, IMAGE_SIZE_XYZ.z};
|
|
|
|
|
int ndim = 3;
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "plhs[0] = Output_Voxels = mxCreateNumericArray( ndim(%i), dims{%i %i %i}, mxDOUBLE_CLASS, mxREAL);\n", ndim, dims[0], dims[1], dims[2]);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
plhs[0] = mxCreateNumericArray(ndim, dims, mxDOUBLE_CLASS, mxREAL);
|
|
|
|
|
const mxArray *Output_Voxels = plhs[0];
|
|
|
|
|
Matrix_t Output_Voxels;
|
|
|
|
|
Output_Voxels.NumberOfDims = ndim;
|
|
|
|
|
Output_Voxels.Dims[0] = dims[0];
|
|
|
|
|
Output_Voxels.Dims[1] = dims[1];
|
|
|
|
|
Output_Voxels.Dims[2] = dims[2];
|
|
|
|
|
Output_Voxels.Data = new double[dims[0]*dims[1]*(dims[2]?dims[2]:1)];
|
|
|
|
|
|
|
|
|
|
double *Output_Voxels_ptr = (double*)mxGetPr(Output_Voxels);
|
|
|
|
|
double *Output_Voxels_ptr = (double*)GetPr(Output_Voxels);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ~~~~ Create Pointer to return value from Duration of Kernel
|
|
|
|
|
@@ -1744,7 +1746,7 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
// 2: Total Durationtime GPU 2
|
|
|
|
|
// n: Total Durationtime GPU n
|
|
|
|
|
|
|
|
|
|
mwSize
|
|
|
|
|
int
|
|
|
|
|
m = (1 + selectedNumberGPUs),
|
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
|
|
@@ -1752,28 +1754,24 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
printf( "plhs[1] = Duration = mxCreateDoubleMatrix( m(%i), n(%i), mxREAL);\n", m, n);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
plhs[1] = mxCreateDoubleMatrix(m, n, mxREAL);
|
|
|
|
|
const mxArray *Duration = plhs[1];
|
|
|
|
|
double *Duration_ptr = (double*)mxGetPr(Duration);
|
|
|
|
|
double *Duration_ptr = new double[m*n];
|
|
|
|
|
|
|
|
|
|
// ~~~~ Create Pointer to return Error/Abortvalue of each multithread
|
|
|
|
|
//int *Abort_ptr = (int*) malloc(num_workingPackages * sizeof(int));
|
|
|
|
|
int *Abort_ptr = (int*) mxMalloc(selectedNumberGPUs*sizeof(int));
|
|
|
|
|
int *Abort_ptr = (int*) malloc(selectedNumberGPUs*sizeof(int));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ~~~~ Erstelle Array fuer Testrueckgabe der integrierten Ascans
|
|
|
|
|
//AScan_Nx = mxGetDimensions(AScan)[0]; // Reihen N ermitteln
|
|
|
|
|
//AScan_Mx = mxGetDimensions(AScan)[1]; // Spalten M ermitteln
|
|
|
|
|
//mwSize
|
|
|
|
|
//int
|
|
|
|
|
m = aScanCount; // 1
|
|
|
|
|
n = AScan_Nx; //z.B. 3000
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
printf( "plhs[2] = Ascans = mxCreateNumericMatrix( m(%i), n(%i), mxREAL);\n", m, n);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
plhs[2] = mxCreateNumericMatrix(n, m, mxSINGLE_CLASS, mxREAL);
|
|
|
|
|
const mxArray *AscansOut = plhs[2];
|
|
|
|
|
float *AscansOut_ptr = (float*)mxGetPr(AscansOut);
|
|
|
|
|
float *AscansOut_ptr = new float[m*n];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef debug_OutputParameter
|
|
|
|
|
@@ -1794,10 +1792,10 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
if (SAFT_VARIANT[SAFT_VARIANT_AscanPreintegration] == 1){
|
|
|
|
|
//printf( "(SAFT_VARIANT[0] == 1) => perform preintegrateAscans\n\n");
|
|
|
|
|
|
|
|
|
|
speed_vec_ptr = (float*)mxGetPr(speed);
|
|
|
|
|
speed_vec_ptr = (float*)GetPr(speed);
|
|
|
|
|
// printf( " speed_vec_ptr[%3i] = %12.10f\n",0,speed_vec_ptr[0]);
|
|
|
|
|
if (speed_vec_ptr[0] == 0){
|
|
|
|
|
mexErrMsgTxt("First value in SOS Volume = 0 --> preintegrateAscans can't be performed!!! --> Exit");
|
|
|
|
|
printf("First value in SOS Volume = 0 --> preintegrateAscans can't be performed!!! --> Exit");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//================================================================================================================
|
|
|
|
|
@@ -1885,9 +1883,9 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
AbortedThreads = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mxFree(Abort_ptr);
|
|
|
|
|
free(Abort_ptr);
|
|
|
|
|
if (AbortedThreads)
|
|
|
|
|
mexErrMsgTxt(" Aborted Thread occurred -> see output history");
|
|
|
|
|
printf(" Aborted Thread occurred -> see output history");
|
|
|
|
|
|
|
|
|
|
//================================================================================================================
|
|
|
|
|
//================================================================================================================
|
|
|
|
|
@@ -1936,10 +1934,14 @@ void SAFT_TOFI(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
|
|
|
|
|
#ifdef debug_OutputFunctions
|
|
|
|
|
printf( "<== mexFunction - End\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
delete [] AscansOut_ptr;
|
|
|
|
|
delete [] Duration_ptr;
|
|
|
|
|
return Output_Voxels;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|