Add removeDataFromArrays.
Fix dataFilter to use transparams.
This commit is contained in:
46
src/common/dataBlockCreation/removeDataFromArrays.cpp
Normal file
46
src/common/dataBlockCreation/removeDataFromArrays.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "removeDataFromArrays.h"
|
||||
#include "Function.h"
|
||||
#include "Function1D.h"
|
||||
#include "Function2D.h"
|
||||
#include "Matrix.h"
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
using namespace Recon;
|
||||
using namespace Aurora;
|
||||
|
||||
Aurora::Matrix Recon::removeDataFromArrays(const Aurora::Matrix& aOutPutMatrix, const Aurora::Matrix& aRemoveList)
|
||||
{
|
||||
// Matrix result = aOutPutMatrix;
|
||||
// int minusNum = 0;
|
||||
// for(int i=0; i<aRemoveList.getDataSize(); ++i)
|
||||
// {
|
||||
// if(aRemoveList[i] == 0)
|
||||
// {
|
||||
// result = deleteColumn(result, i - minusNum);
|
||||
// ++minusNum;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return result;
|
||||
|
||||
size_t columnSize = sum(aRemoveList, FunctionDirection::All)[0];
|
||||
double* resultData = Aurora::malloc(columnSize * aOutPutMatrix.getDimSize(0));
|
||||
Matrix result = Matrix::New(resultData, aOutPutMatrix.getDimSize(0), columnSize);
|
||||
std::vector<std::pair<int,int>> copyList;
|
||||
size_t length = 0;
|
||||
for(size_t i=0; i<aRemoveList.getDataSize(); ++i)
|
||||
{
|
||||
if(aRemoveList[i] == 1)
|
||||
{
|
||||
++length;
|
||||
}
|
||||
|
||||
if(aRemoveList[i] == 0 && length != 0)
|
||||
{
|
||||
copyList.push_back({});
|
||||
length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
src/common/dataBlockCreation/removeDataFromArrays.h
Normal file
11
src/common/dataBlockCreation/removeDataFromArrays.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef REMOVEDATAFROMARRAYS_H
|
||||
#define REMOVEDATAFROMARRAYS_H
|
||||
|
||||
#include "Matrix.h"
|
||||
|
||||
namespace Recon
|
||||
{
|
||||
Aurora::Matrix removeDataFromArrays(const Aurora::Matrix& aOutPutMatrix, const Aurora::Matrix& aRemoveList);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user