diff --git a/CMakeLists.txt b/CMakeLists.txt index 96f3740..7bc1c26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ endif() # ------------------ # # Set CXX options -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/cmake/FetchPybind11.cmake b/cmake/FetchPybind11.cmake index 8d63251..a0e72c6 100644 --- a/cmake/FetchPybind11.cmake +++ b/cmake/FetchPybind11.cmake @@ -3,8 +3,8 @@ # -------------- # # Set Pybind11 Version -set(Pybind11Version 2.10.3) -set(Pybind11SHA256 5d8c4c5dda428d3a944ba3d2a5212cb988c2fae4670d58075a5a49075a6ca315) +set(Pybind11Version 2.13.6) +set(Pybind11SHA256 e08cb87f4773da97fa7b5f035de8763abc656d87d5773e62f6da0587d1f0ec20) # Set Pybdin11 fetch location FetchContent_Declare( @@ -16,6 +16,5 @@ FetchContent_Declare( # Fetch and source Pybind11 FetchContent_GetProperties(pybind11) if(NOT pybind11_POPULATED) - FetchContent_Populate(pybind11) - add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR}) + FetchContent_MakeAvailable(pybind11) endif() \ No newline at end of file diff --git a/src/astro_wl/libwl/shearinversions.cc b/src/astro_wl/libwl/shearinversions.cc index 18b75ec..ca12a56 100644 --- a/src/astro_wl/libwl/shearinversions.cc +++ b/src/astro_wl/libwl/shearinversions.cc @@ -197,7 +197,7 @@ void ShearInversions::kappa2gamma(double* pt_kappa, double* pt_gamma1, double* p } -void ShearInversions::kappa2gamma(to_array< double, true >& kappa, to_array< double, true >& gamma1, to_array< double, true >& gamma2) +void ShearInversions::kappa2gamma(convert_to_array< double, true >& kappa, convert_to_array< double, true >& gamma1, convert_to_array< double, true >& gamma2) { double *pt_gamma1 = gamma1.buffer(); double *pt_gamma2 = gamma2.buffer(); @@ -210,7 +210,7 @@ void ShearInversions::kappa2gamma(to_array< double, true >& kappa, to_array< dou kappa2gamma(pt_kappa,pt_gamma1,pt_gamma2,Nx,Ny,Nz+1); } -void ShearInversions::kappa2flexion(double pixel_size, to_array< double, true >& kappa, to_array< double, true >& F1, to_array< double, true >& F2) +void ShearInversions::kappa2flexion(double pixel_size, convert_to_array< double, true >& kappa, convert_to_array< double, true >& F1, convert_to_array< double, true >& F2) { double *pt_F1 = F1.buffer(); double *pt_F2 = F2.buffer(); @@ -280,7 +280,7 @@ void ShearInversions::kappa2flexion(double pixel_size, double* pt_kappa, double* } -void ShearInversions::flexion2kappa(double pixel_size,to_array< double, true >& F1, to_array< double, true >& F2, to_array< double, true >& kappa) +void ShearInversions::flexion2kappa(double pixel_size,convert_to_array< double, true >& F1, convert_to_array< double, true >& F2, convert_to_array< double, true >& kappa) { double *pt_F1 = F1.buffer(); double *pt_F2 = F2.buffer(); @@ -342,7 +342,7 @@ void ShearInversions::flexion2kappa(double pixel_size, double* pt_F1, double* pt } -void ShearInversions::gamma_flexion2kappa(double pixel_size, to_array< double, true >& gamma1, to_array< double, true >& gamma2, to_array< double, true >& F1, to_array< double, true >& F2, to_array< double, true >& kappa) +void ShearInversions::gamma_flexion2kappa(double pixel_size, convert_to_array< double, true >& gamma1, convert_to_array< double, true >& gamma2, convert_to_array< double, true >& F1, convert_to_array< double, true >& F2, convert_to_array< double, true >& kappa) { double *pt_gamma1 = gamma1.buffer(); double *pt_gamma2 = gamma2.buffer(); diff --git a/src/mr/libmr2d/Wavelet_wmir.h b/src/mr/libmr2d/Wavelet_wmir.h index 8907b99..8b62f5b 100644 --- a/src/mr/libmr2d/Wavelet_wmir.h +++ b/src/mr/libmr2d/Wavelet_wmir.h @@ -64,17 +64,17 @@ class OrthogonalWaveletTransform // (I)DWT 1D along a certain axis // only used by (I)DWT3D // axis = 0, 1, 2 : X, Y, Z - static void transformXYZ (to_array &data, dblarray &dfilterh, dblarray &dfilterg, to_array &ca, to_array &cd, int axis, type_border BORDERTYPE); - static void reconstructionXYZ (to_array &ca, to_array &cd, dblarray &rfilterh, dblarray &rfilterg, to_array &data, int axis); + static void transformXYZ (convert_to_array &data, dblarray &dfilterh, dblarray &dfilterg, convert_to_array &ca, convert_to_array &cd, int axis, type_border BORDERTYPE); + static void reconstructionXYZ (convert_to_array &ca, convert_to_array &cd, dblarray &rfilterh, dblarray &rfilterg, convert_to_array &data, int axis); public: // orthogonal wavelet types static const int HAAR=0, DAUB4=4, SYML4=16; // resize the data to the same size of the reference - static void resizeData (to_array &data, to_array &ref, type_border BORDERTYPE=I_ZERO); + static void resizeData (convert_to_array &data, convert_to_array &ref, type_border BORDERTYPE=I_ZERO); // resize the data to [nx], [nx, ny] or [nx, ny, nz] according to the dimension of the data - static void resizeData (to_array &data, int nx, int ny, int nz, type_border BORDERTYPE=I_ZERO); + static void resizeData (convert_to_array &data, int nx, int ny, int nz, type_border BORDERTYPE=I_ZERO); // get the decomposition filters, i.e. \bar{h}, \bar{g} // where h is considered to start from the origin @@ -83,88 +83,88 @@ class OrthogonalWaveletTransform static void getWaveletReconsFilter (int filterName, dblarray &rfilterh, dblarray &rfilterg); // DWT 1D - static void dwt1D (to_array &data, \ + static void dwt1D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); - static void dwt1D (to_array &data, \ + static void dwt1D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); // IDWT 1D - static void idwt1D (to_array &ca, to_array &cd, \ + static void idwt1D (convert_to_array &ca, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data); - static void idwt1D (to_array &ca, to_array &cd, \ + convert_to_array &data); + static void idwt1D (convert_to_array &ca, convert_to_array &cd, \ int filterName, \ - to_array &data); + convert_to_array &data); // DWT 2D - static void dwt2D (to_array &data, \ + static void dwt2D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); - static void dwt2D (to_array &data, \ + static void dwt2D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); // IDWT 2D - static void idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + static void idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data); - static void idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &data); + static void idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ int filterName, \ - to_array &data); + convert_to_array &data); // DWT 3D - static void dwt3D (to_array &data, \ + static void dwt3D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE=I_MIRROR); - static void dwt3D (to_array &data, \ + static void dwt3D (convert_to_array &data, \ int filterName, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE=I_MIRROR); // IDWT 3D static void idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data); + convert_to_array &data); static void idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ int filterName, \ - to_array &data); + convert_to_array &data); }; template @@ -177,19 +177,19 @@ template const int OrthogonalWaveletTransform::SYML4; template -void OrthogonalWaveletTransform::resizeData(to_array &data, to_array &ref, type_border BORDERTYPE) +void OrthogonalWaveletTransform::resizeData(convert_to_array &data, convert_to_array &ref, type_border BORDERTYPE) { resizeData(data, ref.nx(), ref.ny(), ref.nz(), BORDERTYPE); } template -void OrthogonalWaveletTransform::resizeData(to_array &data, int nx, int ny, int nz, type_border BORDERTYPE) +void OrthogonalWaveletTransform::resizeData(convert_to_array &data, int nx, int ny, int nz, type_border BORDERTYPE) { int dnx = data.nx(), dny = data.ny(), dnz = data.nz(); if ((nx == dnx) && (ny == dny) && (nz == dnz)) return; int dim = data.naxis(); - to_array *temp = new to_array(dnx, dny, dnz); + convert_to_array *temp = new convert_to_array(dnx, dny, dnz); *temp = data; if (dim == 1) { @@ -272,9 +272,9 @@ void OrthogonalWaveletTransform::getWaveletReconsFilter (int filterNam } template -void OrthogonalWaveletTransform::transformXYZ (to_array &data, dblarray &dfilterh, dblarray &dfilterg, to_array &ca, to_array &cd, int axis, type_border BORDERTYPE) +void OrthogonalWaveletTransform::transformXYZ (convert_to_array &data, dblarray &dfilterh, dblarray &dfilterg, convert_to_array &ca, convert_to_array &cd, int axis, type_border BORDERTYPE) { - to_array *line = NULL, *linea = NULL, *lined = NULL; + convert_to_array *line = NULL, *linea = NULL, *lined = NULL; int lenx, leny, lenz, dlenx, dleny, dlenz; if (axis == 0) @@ -283,9 +283,9 @@ void OrthogonalWaveletTransform::transformXYZ (to_array(lenx); - linea = new to_array(dlenx); - lined = new to_array(dlenx); + line = new convert_to_array(lenx); + linea = new convert_to_array(dlenx); + lined = new convert_to_array(dlenx); for (int z=0; z::transformXYZ (to_array(leny); - linea = new to_array(dleny); - lined = new to_array(dleny); + line = new convert_to_array(leny); + linea = new convert_to_array(dleny); + lined = new convert_to_array(dleny); for (int z=0; z::transformXYZ (to_array(lenz); - linea = new to_array(dlenz); - lined = new to_array(dlenz); + line = new convert_to_array(lenz); + linea = new convert_to_array(dlenz); + lined = new convert_to_array(dlenz); for (int y=0; y::transformXYZ (to_array -void OrthogonalWaveletTransform::reconstructionXYZ (to_array &ca, to_array &cd, dblarray &rfilterh, dblarray &rfilterg, to_array &data, int axis) +void OrthogonalWaveletTransform::reconstructionXYZ (convert_to_array &ca, convert_to_array &cd, dblarray &rfilterh, dblarray &rfilterg, convert_to_array &data, int axis) { - to_array *line = NULL, *linea = NULL, *lined = NULL; + convert_to_array *line = NULL, *linea = NULL, *lined = NULL; int lenx, leny, lenz, rlenx, rleny, rlenz; if (axis == 0) { lenx = ca.nx(); leny = ca.ny(); lenz = ca.nz(); rlenx = getReconsResultLength(lenx, rfilterh.n_elem()); - line = new to_array(rlenx); - linea = new to_array(lenx); - lined = new to_array(lenx); + line = new convert_to_array(rlenx); + linea = new convert_to_array(lenx); + lined = new convert_to_array(lenx); data.resize(rlenx, leny, lenz); for (int z=0; z::reconstructionXYZ (to_array(rleny); - linea = new to_array(leny); - lined = new to_array(leny); + line = new convert_to_array(rleny); + linea = new convert_to_array(leny); + lined = new convert_to_array(leny); data.resize(lenx, rleny, lenz); for (int z=0; z::reconstructionXYZ (to_array(rlenz); - linea = new to_array(lenz); - lined = new to_array(lenz); + line = new convert_to_array(rlenz); + linea = new convert_to_array(lenz); + lined = new convert_to_array(lenz); data.resize(lenx, leny, rlenz); for (int y=0; y::reconstructionXYZ (to_array -void OrthogonalWaveletTransform::dwt1D (to_array &data, \ +void OrthogonalWaveletTransform::dwt1D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE) { int datalen = data.nx(); @@ -465,9 +465,9 @@ void OrthogonalWaveletTransform::dwt1D (to_array &data } template -void OrthogonalWaveletTransform::dwt1D (to_array &data, \ +void OrthogonalWaveletTransform::dwt1D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE) { dblarray filterh, filterg; @@ -476,9 +476,9 @@ void OrthogonalWaveletTransform::dwt1D (to_array &data } template -void OrthogonalWaveletTransform::idwt1D (to_array &ca, to_array &cd, \ +void OrthogonalWaveletTransform::idwt1D (convert_to_array &ca, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data) + convert_to_array &data) { int calen = ca.nx(), cdlen = cd.nx(); if (calen != cdlen) @@ -511,9 +511,9 @@ void OrthogonalWaveletTransform::idwt1D (to_array &ca, } template -void OrthogonalWaveletTransform::idwt1D (to_array &ca, to_array &cd, \ +void OrthogonalWaveletTransform::idwt1D (convert_to_array &ca, convert_to_array &cd, \ int filterName, \ - to_array &data) + convert_to_array &data) { dblarray filterh, filterg; getWaveletReconsFilter(filterName, filterh, filterg); @@ -521,9 +521,9 @@ void OrthogonalWaveletTransform::idwt1D (to_array &ca, } template -void OrthogonalWaveletTransform::dwt2D (to_array &data, \ +void OrthogonalWaveletTransform::dwt2D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE) { int datalenx = data.nx(), dataleny = data.ny(); @@ -535,11 +535,11 @@ void OrthogonalWaveletTransform::dwt2D (to_array &data ca.resize(reslenx, resleny); ch.resize(reslenx, resleny); cv.resize(reslenx, resleny); cd.resize(reslenx, resleny); - to_array *temph = new to_array(reslenx, dataleny); - to_array *tempg = new to_array(reslenx, dataleny); - to_array *line = new to_array(datalenx); - to_array *atempline = new to_array(reslenx); - to_array *dtempline = new to_array(reslenx); + convert_to_array *temph = new convert_to_array(reslenx, dataleny); + convert_to_array *tempg = new convert_to_array(reslenx, dataleny); + convert_to_array *line = new convert_to_array(datalenx); + convert_to_array *atempline = new convert_to_array(reslenx); + convert_to_array *dtempline = new convert_to_array(reslenx); for (int y=0; y::dwt2D (to_array &data if (atempline != NULL) { delete atempline; atempline = NULL; } if (dtempline != NULL) { delete dtempline; dtempline = NULL; } - to_array *col1 = new to_array(dataleny); - to_array *col2 = new to_array(dataleny); - to_array *atempcol = new to_array(resleny); - to_array *dtempcol = new to_array(resleny); + convert_to_array *col1 = new convert_to_array(dataleny); + convert_to_array *col2 = new convert_to_array(dataleny); + convert_to_array *atempcol = new convert_to_array(resleny); + convert_to_array *dtempcol = new convert_to_array(resleny); for (int x=0; x::dwt2D (to_array &data } template -void OrthogonalWaveletTransform::dwt2D (to_array &data, \ +void OrthogonalWaveletTransform::dwt2D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE) { dblarray filterh, filterg; @@ -598,9 +598,9 @@ void OrthogonalWaveletTransform::dwt2D (to_array &data } template -void OrthogonalWaveletTransform::idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ +void OrthogonalWaveletTransform::idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data) + convert_to_array &data) { int calenx = ca.nx(), caleny = ca.ny(); int chlenx = ch.nx(), chleny = ch.ny(); @@ -617,14 +617,14 @@ void OrthogonalWaveletTransform::idwt2D (to_array &ca, int resleny = getReconsResultLength(caleny, hlen); data.resize(reslenx, resleny); - to_array *temph = new to_array(calenx, resleny); - to_array *tempg = new to_array(calenx, resleny); - to_array *cola = new to_array(caleny); - to_array *colh = new to_array(chleny); - to_array *colv = new to_array(cvleny); - to_array *cold = new to_array(cdleny); - to_array *coltemph = new to_array(resleny); - to_array *coltempg = new to_array(resleny); + convert_to_array *temph = new convert_to_array(calenx, resleny); + convert_to_array *tempg = new convert_to_array(calenx, resleny); + convert_to_array *cola = new convert_to_array(caleny); + convert_to_array *colh = new convert_to_array(chleny); + convert_to_array *colv = new convert_to_array(cvleny); + convert_to_array *cold = new convert_to_array(cdleny); + convert_to_array *coltemph = new convert_to_array(resleny); + convert_to_array *coltempg = new convert_to_array(resleny); for (int x=0; x::idwt2D (to_array &ca, if (coltemph != NULL) { delete coltemph; coltemph = NULL; } if (coltempg != NULL) { delete coltempg; coltempg = NULL; } - to_array *lineh = new to_array(calenx); - to_array *lineg = new to_array(calenx); - to_array *line = new to_array(reslenx); + convert_to_array *lineh = new convert_to_array(calenx); + convert_to_array *lineg = new convert_to_array(calenx); + convert_to_array *line = new convert_to_array(reslenx); for (int y=0; y::idwt2D (to_array &ca, } template -void OrthogonalWaveletTransform::idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ +void OrthogonalWaveletTransform::idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ int filterName, \ - to_array &data) + convert_to_array &data) { dblarray filterh, filterg; getWaveletReconsFilter(filterName, filterh, filterg); @@ -682,16 +682,16 @@ void OrthogonalWaveletTransform::idwt2D (to_array &ca, template void OrthogonalWaveletTransform::dwt3D ( \ - to_array &data, \ + convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE) { int hlen = dfilterh.n_elem(), glen = dfilterg.n_elem(); @@ -707,18 +707,18 @@ void OrthogonalWaveletTransform::dwt3D ( \ cggh.resize(reslenx, resleny, reslenz); cggg.resize(reslenx, resleny, reslenz); // X - to_array *temph = new to_array; - to_array *tempg = new to_array; + convert_to_array *temph = new convert_to_array; + convert_to_array *tempg = new convert_to_array; transformXYZ(data, dfilterh, dfilterg, *temph, *tempg, 0, BORDERTYPE); // Y - to_array *temphh = new to_array; - to_array *temphg = new to_array; + convert_to_array *temphh = new convert_to_array; + convert_to_array *temphg = new convert_to_array; transformXYZ(*temph, dfilterh, dfilterg, *temphh, *temphg, 1, BORDERTYPE); if (temph != NULL) { delete temph; temph = NULL; } - to_array *tempgh = new to_array; - to_array *tempgg = new to_array; + convert_to_array *tempgh = new convert_to_array; + convert_to_array *tempgg = new convert_to_array; transformXYZ(*tempg, dfilterh, dfilterg, *tempgh, *tempgg, 1, BORDERTYPE); if (tempg != NULL) { delete tempg; tempg = NULL; } @@ -736,16 +736,16 @@ void OrthogonalWaveletTransform::dwt3D ( \ template void OrthogonalWaveletTransform::dwt3D ( \ - to_array &data, \ + convert_to_array &data, \ int filterName, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE) { dblarray filterh, filterg; @@ -755,16 +755,16 @@ void OrthogonalWaveletTransform::dwt3D ( \ template void OrthogonalWaveletTransform::idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data) + convert_to_array &data) { int hlen = rfilterh.n_elem(), glen = rfilterg.n_elem(); if (hlen != glen) @@ -791,18 +791,18 @@ void OrthogonalWaveletTransform::idwt3D ( \ data.resize(reslenx, resleny, reslenz); // Z - to_array *temphh = new to_array; - to_array *temphg = new to_array; - to_array *tempgh = new to_array; - to_array *tempgg = new to_array; + convert_to_array *temphh = new convert_to_array; + convert_to_array *temphg = new convert_to_array; + convert_to_array *tempgh = new convert_to_array; + convert_to_array *tempgg = new convert_to_array; reconstructionXYZ(ca, chhg, rfilterh, rfilterg, *temphh, 2); reconstructionXYZ(chgh, chgg, rfilterh, rfilterg, *temphg, 2); reconstructionXYZ(cghh, cghg, rfilterh, rfilterg, *tempgh, 2); reconstructionXYZ(cggh, cggg, rfilterh, rfilterg, *tempgg, 2); // Y - to_array *temph = new to_array; - to_array *tempg = new to_array; + convert_to_array *temph = new convert_to_array; + convert_to_array *tempg = new convert_to_array; reconstructionXYZ(*temphh, *temphg, rfilterh, rfilterg, *temph, 1); if (temphh != NULL) { delete temphh; temphh = NULL; } if (temphg != NULL) { delete temphg; temphg = NULL; } @@ -819,16 +819,16 @@ void OrthogonalWaveletTransform::idwt3D ( \ template void OrthogonalWaveletTransform::idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ int filterName, \ - to_array &data) + convert_to_array &data) { dblarray filterh, filterg; getWaveletReconsFilter(filterName, filterh, filterg); @@ -894,7 +894,7 @@ class WaveletShrinkage public: // gaussian noise standard deviation MAD estimation // sigma = median (abs(waveletdata)) / 0.6745 - double gaussianStdDevEstim (to_array &waveletData); + double gaussianStdDevEstim (convert_to_array &waveletData); // Denoise gaussian noise // Hard threshold = k * sigma; sup use -sigma / sigma (>=0) to indicate the insignificant/significant coef. region @@ -902,8 +902,8 @@ class WaveletShrinkage // alpha is the preset p-value of the significance level when DEFAULT is not set // DEFAULT indicates to use the universal threshold // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double gaussHardThreshold (to_array &waveletData, int scale[], \ - double alpha, double sigma, to_array *sup = NULL, int N = 1, bool DEFAULT = false); + double gaussHardThreshold (convert_to_array &waveletData, int scale[], \ + double alpha, double sigma, convert_to_array *sup = NULL, int N = 1, bool DEFAULT = false); // Denoise gaussian noise // Soft threshold = k * sigma; sup use -sigma / sigma (>=0) to indicate the insignificant/significant coef. region @@ -911,15 +911,15 @@ class WaveletShrinkage // alpha is the preset p-value of the significance level when DEFAULT is not set // DEFAULT indicates to use the universal threshold // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double gaussSoftThreshold (to_array &waveletData, int scale[], \ - double alpha, double sigma, to_array *sup = NULL, int N = 1, bool DEFAULT = false); + double gaussSoftThreshold (convert_to_array &waveletData, int scale[], \ + double alpha, double sigma, convert_to_array *sup = NULL, int N = 1, bool DEFAULT = false); // Denoise gaussian noise // FDR threshold; sup use -sigma / sigma (>=0) to indicate the insignificant/significant coef. region // alpha is the preset FDR // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double gaussFDRThreshold (to_array &waveletData, \ - double sigma, double alpha, bool indep = true, to_array *sup = NULL); + double gaussFDRThreshold (convert_to_array &waveletData, \ + double sigma, double alpha, bool indep = true, convert_to_array *sup = NULL); // Direct Haar hard threshold in using Kolaczyk's approximation for Poisson noise // The transform data is assumed to use L1-normalized Haar filter, @@ -929,7 +929,7 @@ class WaveletShrinkage // alpha is the preset p-value of the significance level when DEFAULT is not set // DEFAULT indicates to use the universal threshold // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarKolaThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup = NULL, int N = 1, bool DEFAULT = false); + double haarKolaThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup = NULL, int N = 1, bool DEFAULT = false); // Direct Haar hard threshold in using modified Kolaczyk's approximation (Fisher approx.) for Poisson noise // The transform data is assumed to use L1-normalized Haar filter, @@ -939,7 +939,7 @@ class WaveletShrinkage // alpha is the preset p-value of the significance level when DEFAULT is not set // DEFAULT indicates to use the universal threshold // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarMKolaThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup = NULL, int N = 1, bool DEFAULT = false); + double haarMKolaThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup = NULL, int N = 1, bool DEFAULT = false); // Direct Haar hard threshold based on Bijaoui-Jammal's thresholding table for Poisson noise // The transform data is assumed to use L1-normalized Haar filter, @@ -947,7 +947,7 @@ class WaveletShrinkage // scale[] is the scale along each direction // alpha is the preset p-value of the significance level // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarBJThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup = NULL); + double haarBJThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup = NULL); // Direct Haar hard threshold based on FDR (false discovery rate) for Poisson noise // for a band @@ -956,7 +956,7 @@ class WaveletShrinkage // scale[] is the scale along each direction // alpha is the preset FDR // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarFDRThreshold (to_array &ca, to_array &cd, int scale[], double alpha, bool indep = true, to_array *sup = NULL); + double haarFDRThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, bool indep = true, convert_to_array *sup = NULL); // Direct Haar hard threshold based on FDR (false discovery rate) for Poisson noise // for the bands of a scale @@ -965,7 +965,7 @@ class WaveletShrinkage // scale[] is the scale along each direction // alpha is the preset FDR // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarFDRThreshold (to_array &ca, to_array cd[], int len, int scale[], double alpha, bool indep = true, to_array *sup = NULL); + double haarFDRThreshold (convert_to_array &ca, convert_to_array cd[], int len, int scale[], double alpha, bool indep = true, convert_to_array *sup = NULL); // Model (prior) based Haar coef. threshold for Poisson noise // The transform data is assumed to use L1-normalized Haar filter, @@ -978,9 +978,9 @@ class WaveletShrinkage // N is the length of the original data // DEFAULT indicates to use the universal threshold // the thresholding p-value is returned - double haarModelThreshold (to_array &caModel, \ - to_array &cdModel, to_array &cd, \ - int scale[], double alpha, to_array *sup = NULL, \ + double haarModelThreshold (convert_to_array &caModel, \ + convert_to_array &cdModel, convert_to_array &cd, \ + int scale[], double alpha, convert_to_array *sup = NULL, \ int N = 1, bool DEFAULT = false); // Model (prior) based Haar coef. FDR threshold for Poisson noise @@ -992,13 +992,13 @@ class WaveletShrinkage // scale[] is the scale along each direction // alpha is the preset FDR // the thresholding p-value is returned - double haarModelFDRThreshold (to_array &caModel, \ - to_array &cdModel, to_array &cd, \ - int scale[], double alpha, bool indep = true, to_array *sup = NULL); + double haarModelFDRThreshold (convert_to_array &caModel, \ + convert_to_array &cdModel, convert_to_array &cd, \ + int scale[], double alpha, bool indep = true, convert_to_array *sup = NULL); }; template -double WaveletShrinkage::gaussianStdDevEstim (to_array &waveletData) +double WaveletShrinkage::gaussianStdDevEstim (convert_to_array &waveletData) { double med = Utils::absMedian(waveletData); @@ -1006,7 +1006,7 @@ double WaveletShrinkage::gaussianStdDevEstim (to_array -double WaveletShrinkage::gaussHardThreshold (to_array &waveletData, int scale[], double alpha, double sigma, to_array *sup, int N, bool DEFAULT) +double WaveletShrinkage::gaussHardThreshold (convert_to_array &waveletData, int scale[], double alpha, double sigma, convert_to_array *sup, int N, bool DEFAULT) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -1071,7 +1071,7 @@ double WaveletShrinkage::gaussHardThreshold (to_array -double WaveletShrinkage::gaussSoftThreshold (to_array &waveletData, int scale[], double alpha, double sigma, to_array *sup, int N, bool DEFAULT) +double WaveletShrinkage::gaussSoftThreshold (convert_to_array &waveletData, int scale[], double alpha, double sigma, convert_to_array *sup, int N, bool DEFAULT) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -1149,8 +1149,8 @@ double WaveletShrinkage::gaussSoftThreshold (to_array::cumNormal(cthresh))) : alpha); } template -double WaveletShrinkage::gaussFDRThreshold (to_array &waveletData, \ - double sigma, double alpha, bool indep, to_array *sup) +double WaveletShrinkage::gaussFDRThreshold (convert_to_array &waveletData, \ + double sigma, double alpha, bool indep, convert_to_array *sup) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -1159,7 +1159,7 @@ double WaveletShrinkage::gaussFDRThreshold (to_arrayresize(nx); - to_array *pvals = new to_array(nx); + convert_to_array *pvals = new convert_to_array(nx); for (int x=0; x::gaussFDRThreshold (to_arrayresize(nx, ny); - to_array *pvals = new to_array(nx, ny); + convert_to_array *pvals = new convert_to_array(nx, ny); for (int x=0; x::gaussFDRThreshold (to_arrayresize(nx, ny, nz); - to_array *pvals = new to_array(nx, ny, nz); + convert_to_array *pvals = new convert_to_array(nx, ny, nz); for (int x=0; x::gaussFDRThreshold (to_array -double WaveletShrinkage::haarKolaThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup, int N, bool DEFAULT) +double WaveletShrinkage::haarKolaThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup, int N, bool DEFAULT) { int nx, ny, nz; double coeff, lambda, thresh, zalpha2; @@ -1348,8 +1348,8 @@ double WaveletShrinkage::haarKolaThreshold (to_array -double WaveletShrinkage::haarMKolaThreshold (to_array &ca, \ - to_array &cd, int scale[], double alpha, to_array *sup, int N, bool DEFAULT) +double WaveletShrinkage::haarMKolaThreshold (convert_to_array &ca, \ + convert_to_array &cd, int scale[], double alpha, convert_to_array *sup, int N, bool DEFAULT) { int nx, ny, nz, rn; double coeff, pcoef[5], pm[4], pmi[4], lambda, thresh, zalpha2; @@ -1473,7 +1473,7 @@ double WaveletShrinkage::haarMKolaThreshold (to_array -double WaveletShrinkage::haarBJThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup) +double WaveletShrinkage::haarBJThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup) { int nx, ny, nz; double coeff, lambda, thresh, alpha2 = alpha / 2.; @@ -1558,7 +1558,7 @@ double WaveletShrinkage::haarBJThreshold (to_array -double WaveletShrinkage::haarFDRThreshold (to_array &ca, to_array &cd, int scale[], double alpha, bool indep, to_array *sup) +double WaveletShrinkage::haarFDRThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, bool indep, convert_to_array *sup) { int nx, ny, nz; double coeff, lambda, fdrp; @@ -1573,7 +1573,7 @@ double WaveletShrinkage::haarFDRThreshold (to_arrayresize(nx); - to_array *pvals = new to_array(nx); + convert_to_array *pvals = new convert_to_array(nx); for (int x=0; x::haarFDRThreshold (to_arrayresize(nx, ny); - to_array *pvals = new to_array(nx, ny); + convert_to_array *pvals = new convert_to_array(nx, ny); for (int x=0; x::haarFDRThreshold (to_arrayresize(nx, ny, nz); - to_array *pvals = new to_array(nx, ny, nz); + convert_to_array *pvals = new convert_to_array(nx, ny, nz); for (int x=0; x::haarFDRThreshold (to_array -double WaveletShrinkage::haarFDRThreshold (to_array &ca, to_array cd[], int len, int scale[], double alpha, bool indep, to_array *sup) +double WaveletShrinkage::haarFDRThreshold (convert_to_array &ca, convert_to_array cd[], int len, int scale[], double alpha, bool indep, convert_to_array *sup) { int nx, ny, nz; double coeff, lambda, fdrp; @@ -1703,7 +1703,7 @@ double WaveletShrinkage::haarFDRThreshold (to_array *pvals = new to_array(len, nx); + convert_to_array *pvals = new convert_to_array(len, nx); for (int l=0; l::haarFDRThreshold (to_array *pvals = new to_array(len, nx, ny); + convert_to_array *pvals = new convert_to_array(len, nx, ny); for (int l=0; l::haarFDRThreshold (to_array *pvals = new to_array(len*nx, ny, nz); + convert_to_array *pvals = new convert_to_array(len*nx, ny, nz); for (int l=0; l::haarFDRThreshold (to_array -double WaveletShrinkage::haarModelThreshold (to_array &caModel, \ - to_array &cdModel, to_array &cd, \ - int scale[], double alpha, to_array *sup, \ +double WaveletShrinkage::haarModelThreshold (convert_to_array &caModel, \ + convert_to_array &cdModel, convert_to_array &cd, \ + int scale[], double alpha, convert_to_array *sup, \ int N, bool DEFAULT) { int nx, ny, nz; @@ -1915,9 +1915,9 @@ double WaveletShrinkage::haarModelThreshold (to_array double WaveletShrinkage::haarModelFDRThreshold \ - (to_array &caModel, \ - to_array &cdModel, to_array &cd, \ - int scale[], double alpha, bool indep, to_array *sup) + (convert_to_array &caModel, \ + convert_to_array &cdModel, convert_to_array &cd, \ + int scale[], double alpha, bool indep, convert_to_array *sup) { int nx, ny, nz; double coefobs, lambda1, lambda2, p, fdrp; @@ -1931,7 +1931,7 @@ double WaveletShrinkage::haarModelFDRThreshold \ { nx = cd.nx(); if (sup != NULL) sup->resize(nx); - to_array *pvals = new to_array(nx); + convert_to_array *pvals = new convert_to_array(nx); for (int x=0; x::haarModelFDRThreshold \ { nx = cd.nx(); ny = cd.ny(); if (sup != NULL) sup->resize(nx, ny); - to_array *pvals = new to_array(nx, ny); + convert_to_array *pvals = new convert_to_array(nx, ny); for (int x=0; x::haarModelFDRThreshold \ { nx = cd.nx(); ny = cd.ny(); nz = cd.nz(); if (sup != NULL) sup->resize(nx, ny, nz); - to_array *pvals = new to_array(nx, ny, nz); + convert_to_array *pvals = new convert_to_array(nx, ny, nz); for (int x=0; x FaceIndices;//Index of each pixel in a face in Healpix Ring format - to_array Nest2Ring_indices;//Index of each pixel in a face in Healpix Ring format - to_array Ring2Nest_indices;//Index of each pixel in a face in Healpix Ring format + convert_to_array FaceIndices;//Index of each pixel in a face in Healpix Ring format + convert_to_array Nest2Ring_indices;//Index of each pixel in a face in Healpix Ring format + convert_to_array Ring2Nest_indices;//Index of each pixel in a face in Healpix Ring format bool Verbose; bool Debug; diff --git a/src/msvst/libmsvst/Fisz.h b/src/msvst/libmsvst/Fisz.h index acd7d23..0e2b426 100755 --- a/src/msvst/libmsvst/Fisz.h +++ b/src/msvst/libmsvst/Fisz.h @@ -22,27 +22,27 @@ class FiszTransform // dimension of the nearest power of two, // if the data size is not of power two; // ext is an array of 6 elements (extension information of 6 directions) - void dataExtension (to_array &data, int ext[], type_border BORDERTYPE=I_MIRROR); + void dataExtension (convert_to_array &data, int ext[], type_border BORDERTYPE=I_MIRROR); // extract the original data in using the extension information - void dataExtraction (to_array &data, int ext[]); + void dataExtraction (convert_to_array &data, int ext[]); // Fisz transform 1D / 2D / 3D // the data size MUST be power of two, // otherwise, a DataSizeException will be thrown out - void fisz1D (to_array &data); - void fisz2D (to_array &data); - void fisz3D (to_array &data); + void fisz1D (convert_to_array &data); + void fisz2D (convert_to_array &data); + void fisz3D (convert_to_array &data); // Inverse Fisz transform 1D / 2D / 3D // data size MUST be power of two. // otherwise, a DataSizeException will be thrown out - void ifisz1D (to_array &data); - void ifisz2D (to_array &data); - void ifisz3D (to_array &data); + void ifisz1D (convert_to_array &data); + void ifisz2D (convert_to_array &data); + void ifisz3D (convert_to_array &data); }; template -void FiszTransform::dataExtension (to_array &data, int ext[], type_border BORDERTYPE) +void FiszTransform::dataExtension (convert_to_array &data, int ext[], type_border BORDERTYPE) { int lext = 0, rext = 0, uext = 0, dext = 0, bext = 0, fext = 0; int dim = data.naxis(); @@ -54,7 +54,7 @@ void FiszTransform::dataExtension (to_array &data, int lext = (newlen - len1) / 2; rext = (newlen - len1) - lext; - to_array *temp = new to_array(newlen); + convert_to_array *temp = new convert_to_array(newlen); for (int x=0; x::dataExtension (to_array &data, int lext = (newlen1 - len1) / 2; rext = (newlen1 - len1) - lext; uext = (newlen2 - len2) / 2; dext = (newlen2 - len2) - uext; - to_array *temp = new to_array(newlen1, newlen2); + convert_to_array *temp = new convert_to_array(newlen1, newlen2); for (int y=0; y::dataExtension (to_array &data, int uext = (newlen2 - len2) / 2; dext = (newlen2 - len2) - uext; bext = (newlen3 - len3) / 2; fext = (newlen3 - len3) - fext; - to_array *temp = new to_array(newlen1, newlen2, newlen3); + convert_to_array *temp = new convert_to_array(newlen1, newlen2, newlen3); for (int z=0; z::dataExtension (to_array &data, int } template -void FiszTransform::dataExtraction (to_array &data, int ext[]) +void FiszTransform::dataExtraction (convert_to_array &data, int ext[]) { int dim = data.naxis(); int lext = ext[0], rext = ext[1], uext = ext[2]; @@ -115,7 +115,7 @@ void FiszTransform::dataExtraction (to_array &data, in if ((dim == 1) && ((lext != 0) || (rext != 0))) { int finallen = data.nx() - lext - rext; - to_array *tdata = new to_array(finallen); + convert_to_array *tdata = new convert_to_array(finallen); for (int x=0; x::dataExtraction (to_array &data, in { int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; - to_array *tdata = new to_array(finallen1, finallen2); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2); for (int x=0; x::dataExtraction (to_array &data, in int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; int finallen3 = data.nz() - bext - fext; - to_array *tdata = new to_array(finallen1, finallen2, finallen3); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2, finallen3); for (int x=0; x::dataExtraction (to_array &data, in } template -void FiszTransform::fisz1D (to_array &data) +void FiszTransform::fisz1D (convert_to_array &data) { double ca, cd; int len = data.nx(); if (len <= 1) return; else if (!is_power_of_2(len)) throw DataSizeException(len, "data size not of power of two"); - to_array *temp = new to_array(len); + convert_to_array *temp = new convert_to_array(len); // decomposition by Haar transform and modification of detail coefficients while (len > 1) @@ -193,14 +193,14 @@ void FiszTransform::fisz1D (to_array &data) } template -void FiszTransform::ifisz1D (to_array &data) +void FiszTransform::ifisz1D (convert_to_array &data) { double ca, cd; int len = data.nx(); if (len <= 1) return; else if (!is_power_of_2(len)) throw DataSizeException(len, "data size not of power of two"); - to_array *temp = new to_array(len); + convert_to_array *temp = new convert_to_array(len); // decomposition by Haar transform while (len > 1) @@ -232,7 +232,7 @@ void FiszTransform::ifisz1D (to_array &data) } template -void FiszTransform::fisz2D (to_array &data) +void FiszTransform::fisz2D (convert_to_array &data) { double ca, dh, dv, dd; int s, offsetx, offsety; @@ -242,7 +242,7 @@ void FiszTransform::fisz2D (to_array &data) throw DataSizeException(len1, "data size not of power of two"); else if (!is_power_of_2(len2)) throw DataSizeException(len2, "data size not of power of two"); - to_array *temp = new to_array(len1, len2); + convert_to_array *temp = new convert_to_array(len1, len2); // decomposition by Haar transform and modification of detail coefficients while ((len1 > 1) && (len2 > 1)) @@ -318,7 +318,7 @@ void FiszTransform::fisz2D (to_array &data) } template -void FiszTransform::ifisz2D (to_array &data) +void FiszTransform::ifisz2D (convert_to_array &data) { double ca, dh, dv, dd; int s, offsetx, offsety; @@ -328,7 +328,7 @@ void FiszTransform::ifisz2D (to_array &data) throw DataSizeException(len1, "data size not of power of two"); else if (!is_power_of_2(len2)) throw DataSizeException(len2, "data size not of power of two"); - to_array *temp = new to_array(len1, len2); + convert_to_array *temp = new convert_to_array(len1, len2); // decomposition by Haar transform while ((len1 > 1) && (len2 > 1)) @@ -396,7 +396,7 @@ void FiszTransform::ifisz2D (to_array &data) } template -void FiszTransform::fisz3D (to_array &data) +void FiszTransform::fisz3D (convert_to_array &data) { int len1 = data.nx(), len2 = data.ny(), len3 = data.nz(); int len = MIN(MIN(len1, len2), len3); @@ -409,7 +409,7 @@ void FiszTransform::fisz3D (to_array &data) throw DataSizeException(len3, "data size not of power of two"); int s = iilog2(len); - to_array *coef = new to_array[7*s + 1]; + convert_to_array *coef = new convert_to_array[7*s + 1]; dblarray dfilterh(2), dfilterg(2), rfilterh(2), rfilterg(2); dfilterh(0) = .5; dfilterh(1) = .5; dfilterg(0) = -.5; dfilterg(1) = .5; @@ -449,7 +449,7 @@ void FiszTransform::fisz3D (to_array &data) } template -void FiszTransform::ifisz3D (to_array &data) +void FiszTransform::ifisz3D (convert_to_array &data) { int len1 = data.nx(), len2 = data.ny(), len3 = data.nz(); int len = MIN(MIN(len1, len2), len3); @@ -462,7 +462,7 @@ void FiszTransform::ifisz3D (to_array &data) throw DataSizeException(len3, "data size not of power of two"); int s = iilog2(len); - to_array *coef = new to_array[7*s + 1]; + convert_to_array *coef = new convert_to_array[7*s + 1]; dblarray dfilterh(2), dfilterg(2), rfilterh(2), rfilterg(2); dfilterh(0) = .5; dfilterh(1) = .5; dfilterg(0) = -.5; dfilterg(1) = .5; diff --git a/src/msvst/libmsvst/ImLib_msvst.h b/src/msvst/libmsvst/ImLib_msvst.h index 0bf757e..077dad4 100644 --- a/src/msvst/libmsvst/ImLib_msvst.h +++ b/src/msvst/libmsvst/ImLib_msvst.h @@ -97,27 +97,27 @@ class Utils public: // median value of the absolute value of a given data set - static DATATYPE absMedian (to_array &data); + static DATATYPE absMedian (convert_to_array &data); // critical threshold for standard normal distribution, tailProba <= 0.5 static double criticalThreshGauss (double tailProba); // cumulative of the normal distribution static double cumNormal (double x); // Anscombe transform of a data set - static void anscombeTransform (to_array &data); + static void anscombeTransform (convert_to_array &data); // Inverse Anscombe transform of a data set // bias correction is recommended while reconstruct the data after estimation - static void invAnscombeTransform (to_array &data, bool cbias); + static void invAnscombeTransform (convert_to_array &data, bool cbias); // generate Donoho's clipped block 1D signal - static void blockSignal (int len, double scaling, to_array &signal1D); + static void blockSignal (int len, double scaling, convert_to_array &signal1D); // generate a 1D signal with a Gaussian form - static void regularSignal (int cx, double sigma, double peakIntense, double backIntense, to_array &signal1D); + static void regularSignal (int cx, double sigma, double peakIntense, double backIntense, convert_to_array &signal1D); // generate a 3D signal with a regional evolutionary Gaussian form static void regularSignal (int cx, int cy, double sigma0, double sigma1, double k, \ - double peakIntense, double backIntense, to_array &signal3D, double flow[]); + double peakIntense, double backIntense, convert_to_array &signal3D, double flow[]); // calculate the source flow of a Gaussian form signal - static void gaussianSourceFlow (to_array &signal3D, double cx, double cy, \ + static void gaussianSourceFlow (convert_to_array &signal3D, double cx, double cy, \ double sigma0, double sigma1, double k, double backIntense, double flow[]); // mean of a vector @@ -125,9 +125,9 @@ class Utils // standard deviation of a vector static double std (DATATYPE vec[], int len); // Normalized Integrated Square Error where the noise is Poissonian - static double NISE (to_array &orig, to_array &estim); + static double NISE (convert_to_array &orig, convert_to_array &estim); // Integrated Square Error where the noise has a spatially stable variance - static double ISE (to_array &orig, to_array &estim); + static double ISE (convert_to_array &orig, convert_to_array &estim); // return the combinatorial number C(n, k) static double Cnk (int n, int k); @@ -141,7 +141,7 @@ class Utils // ndet record for each pixel, the number of detection among NExp experiences // ndlen is the length of the array ndet // NITER is max. number of iteration - static void EMMixBinomialParam (double &alpha, double &pa, double &pi, int NExp, to_array ndet[], int ndlen, int NITER); + static void EMMixBinomialParam (double &alpha, double &pa, double &pi, int NExp, convert_to_array ndet[], int ndlen, int NITER); // ROC area where [alpha0, alpha1] is the valid H0 portion interval // static double rocArea (int len, double alpha[], double pa[], double pi[], double alpha0, double alpha1); // ROC area @@ -187,7 +187,7 @@ class Utils }; template -DATATYPE Utils::absMedian (to_array &data) +DATATYPE Utils::absMedian (convert_to_array &data) { DATATYPE medv; int less, greater, equal; @@ -257,7 +257,7 @@ double Utils::cumNormal (double x) } template -void Utils::anscombeTransform (to_array &data) +void Utils::anscombeTransform (convert_to_array &data) { int nlen = data.n_elem(); for (int i=0; i::anscombeTransform (to_array &data) } template -void Utils::invAnscombeTransform (to_array &data, bool cbias) +void Utils::invAnscombeTransform (convert_to_array &data, bool cbias) { double cb = cbias ? 1. : 0.; int nlen = data.n_elem(); @@ -274,7 +274,7 @@ void Utils::invAnscombeTransform (to_array &data, bool } template -void Utils::blockSignal (int len, double scaling, to_array &signal1D) +void Utils::blockSignal (int len, double scaling, convert_to_array &signal1D) { signal1D.resize(len); @@ -292,7 +292,7 @@ void Utils::blockSignal (int len, double scaling, to_array -void Utils::regularSignal (int cx, double sigma, double peakIntense, double backIntense, to_array &signal1D) +void Utils::regularSignal (int cx, double sigma, double peakIntense, double backIntense, convert_to_array &signal1D) { int nx = signal1D.nx(); double sig = 2. * sigma * sigma; @@ -303,7 +303,7 @@ void Utils::regularSignal (int cx, double sigma, double peakIntense, d template void Utils::regularSignal (int cx, int cy, double sigma0, double sigma1, double k, \ - double peakIntense, double backIntense, to_array &signal3D, double flow[]) + double peakIntense, double backIntense, convert_to_array &signal3D, double flow[]) { int nx = signal3D.nx(), ny = signal3D.ny(), nz = signal3D.nz(); double dsig = (sigma1 - sigma0) / (nz - 1), sig = sigma0; @@ -333,7 +333,7 @@ void Utils::regularSignal (int cx, int cy, double sigma0, double sigma } template -void Utils::gaussianSourceFlow (to_array &signal3D, double cx, double cy, \ +void Utils::gaussianSourceFlow (convert_to_array &signal3D, double cx, double cy, \ double sigma0, double sigma1, double k, double backIntense, double flow[]) { int nx = signal3D.nx(), ny = signal3D.ny(), nz = signal3D.nz(); @@ -376,7 +376,7 @@ double Utils::std (DATATYPE vec[], int len) } template -double Utils::NISE (to_array &orig, to_array &estim) +double Utils::NISE (convert_to_array &orig, convert_to_array &estim) { int dlen = orig.n_elem(); double sum = 0., lambda, temp; @@ -392,7 +392,7 @@ double Utils::NISE (to_array &orig, to_array -double Utils::ISE (to_array &orig, to_array &estim) +double Utils::ISE (convert_to_array &orig, convert_to_array &estim) { int dlen = orig.n_elem(); double sum = 0., temp; @@ -439,7 +439,7 @@ double Utils::binomial (int n, int k, double p) } template -void Utils::EMMixBinomialParam (double &alpha, double &pa, double &pi, int NExp, to_array ndet[], int ndlen, int NITER) +void Utils::EMMixBinomialParam (double &alpha, double &pa, double &pi, int NExp, convert_to_array ndet[], int ndlen, int NITER) { long N = 0; int k; diff --git a/src/msvst/libmsvst/Wavelet_msvst.h b/src/msvst/libmsvst/Wavelet_msvst.h index 41da56c..fa0ea15 100644 --- a/src/msvst/libmsvst/Wavelet_msvst.h +++ b/src/msvst/libmsvst/Wavelet_msvst.h @@ -20,42 +20,42 @@ class WaveletShrinkage // Hard threshold = k * sigma; sup use -1 / 1 to indicate the insignificant/significant coef. region // alpha is the preset two-sided p-value of the significance level // alpha as the significance level is returned - double gaussHardThreshold (to_array &waveletData, \ - double alpha, double sigma, to_array *sup = NULL); + double gaussHardThreshold (convert_to_array &waveletData, \ + double alpha, double sigma, convert_to_array *sup = NULL); // Denoise gaussian noise // Soft threshold = k * sigma; sup use -1 / 1 to indicate the insignificant/significant coef. region // alpha is the preset two-sided p-value of the significance level // alpha as the significance level is returned - double gaussSoftThreshold (to_array &waveletData, \ - double alpha, double sigma, to_array *sup = NULL); + double gaussSoftThreshold (convert_to_array &waveletData, \ + double alpha, double sigma, convert_to_array *sup = NULL); // Denoise gaussian noise // FDR threshold; sup use -1 / 1 to indicate the insignificant/significant coef. region // alpha is the preset FDR // the thresholding two-sided p-value is returned - double gaussFDRThreshold (to_array &waveletData, \ - double sigma, double alpha, bool indep = true, to_array *sup = NULL); + double gaussFDRThreshold (convert_to_array &waveletData, \ + double sigma, double alpha, bool indep = true, convert_to_array *sup = NULL); // hard threshold in Corrected Coupled MSVST - double ccHardThreshold (to_array &waveletData, to_array &appData, int scale, \ - double alpha, to_array *sup = NULL); + double ccHardThreshold (convert_to_array &waveletData, convert_to_array &appData, int scale, \ + double alpha, convert_to_array *sup = NULL); // FDR threshold in Corrected Coupled MSVST - double ccFDRThreshold (to_array &waveletData, to_array &appData, int scale, \ - double alpha, bool indep = true, to_array *sup = NULL); + double ccFDRThreshold (convert_to_array &waveletData, convert_to_array &appData, int scale, \ + double alpha, bool indep = true, convert_to_array *sup = NULL); // hard threshold in direct estimation - double dirHardThreshold (to_array &waveletData, to_array &appData, int scale, \ - double alpha, to_array *sup = NULL); + double dirHardThreshold (convert_to_array &waveletData, convert_to_array &appData, int scale, \ + double alpha, convert_to_array *sup = NULL); // FDR threshold direct estimation - double dirFDRThreshold (to_array &waveletData, to_array &appData, int scale, \ - double alpha, bool indep = true, to_array *sup = NULL); + double dirFDRThreshold (convert_to_array &waveletData, convert_to_array &appData, int scale, \ + double alpha, bool indep = true, convert_to_array *sup = NULL); }; template -double WaveletShrinkage::gaussHardThreshold (to_array &waveletData, double alpha, double sigma, to_array *sup) +double WaveletShrinkage::gaussHardThreshold (convert_to_array &waveletData, double alpha, double sigma, convert_to_array *sup) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -115,7 +115,7 @@ double WaveletShrinkage::gaussHardThreshold (to_array -double WaveletShrinkage::gaussSoftThreshold (to_array &waveletData, double alpha, double sigma, to_array *sup) +double WaveletShrinkage::gaussSoftThreshold (convert_to_array &waveletData, double alpha, double sigma, convert_to_array *sup) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -188,8 +188,8 @@ double WaveletShrinkage::gaussSoftThreshold (to_array -double WaveletShrinkage::gaussFDRThreshold (to_array &waveletData, \ - double sigma, double alpha, bool indep, to_array *sup) +double WaveletShrinkage::gaussFDRThreshold (convert_to_array &waveletData, \ + double sigma, double alpha, bool indep, convert_to_array *sup) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -198,7 +198,7 @@ double WaveletShrinkage::gaussFDRThreshold (to_arrayresize(nx); - to_array *pvals = new to_array(nx); + convert_to_array *pvals = new convert_to_array(nx); for (int x=0; x::gaussFDRThreshold (to_arrayresize(nx, ny); - to_array *pvals = new to_array(nx, ny); + convert_to_array *pvals = new convert_to_array(nx, ny); for (int x=0; x::gaussFDRThreshold (to_arrayresize(nx, ny, nz); - to_array *pvals = new to_array(nx, ny, nz); + convert_to_array *pvals = new convert_to_array(nx, ny, nz); for (int x=0; x::gaussFDRThreshold (to_array -double WaveletShrinkage::ccHardThreshold (to_array &waveletData, to_array &appData, int scale, \ - double alpha, to_array *sup) +double WaveletShrinkage::ccHardThreshold (convert_to_array &waveletData, convert_to_array &appData, int scale, \ + double alpha, convert_to_array *sup) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -329,8 +329,8 @@ double WaveletShrinkage::ccHardThreshold (to_array -double WaveletShrinkage::ccFDRThreshold (to_array &waveletData, to_array &appData, int scale, \ - double alpha, bool indep, to_array *sup) +double WaveletShrinkage::ccFDRThreshold (convert_to_array &waveletData, convert_to_array &appData, int scale, \ + double alpha, bool indep, convert_to_array *sup) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -339,7 +339,7 @@ double WaveletShrinkage::ccFDRThreshold (to_arrayresize(nx, ny, nz); - to_array *pvals = new to_array(nx, ny, nz); + convert_to_array *pvals = new convert_to_array(nx, ny, nz); for (int x=0; x::ccFDRThreshold (to_array -double WaveletShrinkage::dirHardThreshold (to_array &waveletData, to_array &appData, int scale, \ - double alpha, to_array *sup) +double WaveletShrinkage::dirHardThreshold (convert_to_array &waveletData, convert_to_array &appData, int scale, \ + double alpha, convert_to_array *sup) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -405,8 +405,8 @@ double WaveletShrinkage::dirHardThreshold (to_array -double WaveletShrinkage::dirFDRThreshold (to_array &waveletData, to_array &appData, int scale, \ - double alpha, bool indep, to_array *sup) +double WaveletShrinkage::dirFDRThreshold (convert_to_array &waveletData, convert_to_array &appData, int scale, \ + double alpha, bool indep, convert_to_array *sup) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -415,7 +415,7 @@ double WaveletShrinkage::dirFDRThreshold (to_arrayresize(nx, ny, nz); - to_array *pvals = new to_array(nx, ny, nz); + convert_to_array *pvals = new convert_to_array(nx, ny, nz); for (int x=0; x &data, dblarray &dfilterh, dblarray &dfilterg, to_array &ca, to_array &cd, int axis, type_border BORDERTYPE); - static void reconstructionXYZ (to_array &ca, to_array &cd, dblarray &rfilterh, dblarray &rfilterg, to_array &data, int axis); + static void transformXYZ (convert_to_array &data, dblarray &dfilterh, dblarray &dfilterg, convert_to_array &ca, convert_to_array &cd, int axis, type_border BORDERTYPE); + static void reconstructionXYZ (convert_to_array &ca, convert_to_array &cd, dblarray &rfilterh, dblarray &rfilterg, convert_to_array &data, int axis); public: // orthogonal wavelet types static const int HAAR=0, DAUB4=4, SYML4=16; // resize the data to the same size of the reference - static void resizeData (to_array &data, to_array &ref, type_border BORDERTYPE=I_ZERO); + static void resizeData (convert_to_array &data, convert_to_array &ref, type_border BORDERTYPE=I_ZERO); // resize the data to [nx], [nx, ny] or [nx, ny, nz] according to the dimension of the data - static void resizeData (to_array &data, int nx, int ny, int nz, type_border BORDERTYPE=I_ZERO); + static void resizeData (convert_to_array &data, int nx, int ny, int nz, type_border BORDERTYPE=I_ZERO); // get the decomposition filters, i.e. \bar{h}, \bar{g} // where h is considered to start from the origin @@ -515,88 +515,88 @@ class OrthogonalWaveletTransform static void getWaveletReconsFilter (int filterName, dblarray &rfilterh, dblarray &rfilterg); // DWT 1D - static void dwt1D (to_array &data, \ + static void dwt1D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); - static void dwt1D (to_array &data, \ + static void dwt1D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); // IDWT 1D - static void idwt1D (to_array &ca, to_array &cd, \ + static void idwt1D (convert_to_array &ca, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data); - static void idwt1D (to_array &ca, to_array &cd, \ + convert_to_array &data); + static void idwt1D (convert_to_array &ca, convert_to_array &cd, \ int filterName, \ - to_array &data); + convert_to_array &data); // DWT 2D - static void dwt2D (to_array &data, \ + static void dwt2D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); - static void dwt2D (to_array &data, \ + static void dwt2D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); // IDWT 2D - static void idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + static void idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data); - static void idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &data); + static void idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ int filterName, \ - to_array &data); + convert_to_array &data); // DWT 3D - static void dwt3D (to_array &data, \ + static void dwt3D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE=I_MIRROR); - static void dwt3D (to_array &data, \ + static void dwt3D (convert_to_array &data, \ int filterName, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE=I_MIRROR); // IDWT 3D static void idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data); + convert_to_array &data); static void idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ int filterName, \ - to_array &data); + convert_to_array &data); }; template @@ -609,19 +609,19 @@ template const int OrthogonalWaveletTransform::SYML4; template -void OrthogonalWaveletTransform::resizeData(to_array &data, to_array &ref, type_border BORDERTYPE) +void OrthogonalWaveletTransform::resizeData(convert_to_array &data, convert_to_array &ref, type_border BORDERTYPE) { resizeData(data, ref.nx(), ref.ny(), ref.nz(), BORDERTYPE); } template -void OrthogonalWaveletTransform::resizeData(to_array &data, int nx, int ny, int nz, type_border BORDERTYPE) +void OrthogonalWaveletTransform::resizeData(convert_to_array &data, int nx, int ny, int nz, type_border BORDERTYPE) { int dnx = data.nx(), dny = data.ny(), dnz = data.nz(); if ((nx == dnx) && (ny == dny) && (nz == dnz)) return; int dim = data.naxis(); - to_array *temp = new to_array(dnx, dny, dnz); + convert_to_array *temp = new convert_to_array(dnx, dny, dnz); *temp = data; if (dim == 1) { @@ -704,9 +704,9 @@ void OrthogonalWaveletTransform::getWaveletReconsFilter (int filterNam } template -void OrthogonalWaveletTransform::transformXYZ (to_array &data, dblarray &dfilterh, dblarray &dfilterg, to_array &ca, to_array &cd, int axis, type_border BORDERTYPE) +void OrthogonalWaveletTransform::transformXYZ (convert_to_array &data, dblarray &dfilterh, dblarray &dfilterg, convert_to_array &ca, convert_to_array &cd, int axis, type_border BORDERTYPE) { - to_array *line = NULL, *linea = NULL, *lined = NULL; + convert_to_array *line = NULL, *linea = NULL, *lined = NULL; int lenx, leny, lenz, dlenx, dleny, dlenz; if (axis == 0) @@ -715,9 +715,9 @@ void OrthogonalWaveletTransform::transformXYZ (to_array(lenx); - linea = new to_array(dlenx); - lined = new to_array(dlenx); + line = new convert_to_array(lenx); + linea = new convert_to_array(dlenx); + lined = new convert_to_array(dlenx); for (int z=0; z::transformXYZ (to_array(leny); - linea = new to_array(dleny); - lined = new to_array(dleny); + line = new convert_to_array(leny); + linea = new convert_to_array(dleny); + lined = new convert_to_array(dleny); for (int z=0; z::transformXYZ (to_array(lenz); - linea = new to_array(dlenz); - lined = new to_array(dlenz); + line = new convert_to_array(lenz); + linea = new convert_to_array(dlenz); + lined = new convert_to_array(dlenz); for (int y=0; y::transformXYZ (to_array -void OrthogonalWaveletTransform::reconstructionXYZ (to_array &ca, to_array &cd, dblarray &rfilterh, dblarray &rfilterg, to_array &data, int axis) +void OrthogonalWaveletTransform::reconstructionXYZ (convert_to_array &ca, convert_to_array &cd, dblarray &rfilterh, dblarray &rfilterg, convert_to_array &data, int axis) { - to_array *line = NULL, *linea = NULL, *lined = NULL; + convert_to_array *line = NULL, *linea = NULL, *lined = NULL; int lenx, leny, lenz, rlenx, rleny, rlenz; if (axis == 0) { lenx = ca.nx(); leny = ca.ny(); lenz = ca.nz(); rlenx = getReconsResultLength(lenx, rfilterh.n_elem()); - line = new to_array(rlenx); - linea = new to_array(lenx); - lined = new to_array(lenx); + line = new convert_to_array(rlenx); + linea = new convert_to_array(lenx); + lined = new convert_to_array(lenx); data.resize(rlenx, leny, lenz); for (int z=0; z::reconstructionXYZ (to_array(rleny); - linea = new to_array(leny); - lined = new to_array(leny); + line = new convert_to_array(rleny); + linea = new convert_to_array(leny); + lined = new convert_to_array(leny); data.resize(lenx, rleny, lenz); for (int z=0; z::reconstructionXYZ (to_array(rlenz); - linea = new to_array(lenz); - lined = new to_array(lenz); + line = new convert_to_array(rlenz); + linea = new convert_to_array(lenz); + lined = new convert_to_array(lenz); data.resize(lenx, leny, rlenz); for (int y=0; y::reconstructionXYZ (to_array -void OrthogonalWaveletTransform::dwt1D (to_array &data, \ +void OrthogonalWaveletTransform::dwt1D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE) { int datalen = data.nx(); @@ -897,9 +897,9 @@ void OrthogonalWaveletTransform::dwt1D (to_array &data } template -void OrthogonalWaveletTransform::dwt1D (to_array &data, \ +void OrthogonalWaveletTransform::dwt1D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE) { dblarray filterh, filterg; @@ -908,9 +908,9 @@ void OrthogonalWaveletTransform::dwt1D (to_array &data } template -void OrthogonalWaveletTransform::idwt1D (to_array &ca, to_array &cd, \ +void OrthogonalWaveletTransform::idwt1D (convert_to_array &ca, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data) + convert_to_array &data) { int calen = ca.nx(), cdlen = cd.nx(); if (calen != cdlen) @@ -943,9 +943,9 @@ void OrthogonalWaveletTransform::idwt1D (to_array &ca, } template -void OrthogonalWaveletTransform::idwt1D (to_array &ca, to_array &cd, \ +void OrthogonalWaveletTransform::idwt1D (convert_to_array &ca, convert_to_array &cd, \ int filterName, \ - to_array &data) + convert_to_array &data) { dblarray filterh, filterg; getWaveletReconsFilter(filterName, filterh, filterg); @@ -953,9 +953,9 @@ void OrthogonalWaveletTransform::idwt1D (to_array &ca, } template -void OrthogonalWaveletTransform::dwt2D (to_array &data, \ +void OrthogonalWaveletTransform::dwt2D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE) { int datalenx = data.nx(), dataleny = data.ny(); @@ -967,11 +967,11 @@ void OrthogonalWaveletTransform::dwt2D (to_array &data ca.resize(reslenx, resleny); ch.resize(reslenx, resleny); cv.resize(reslenx, resleny); cd.resize(reslenx, resleny); - to_array *temph = new to_array(reslenx, dataleny); - to_array *tempg = new to_array(reslenx, dataleny); - to_array *line = new to_array(datalenx); - to_array *atempline = new to_array(reslenx); - to_array *dtempline = new to_array(reslenx); + convert_to_array *temph = new convert_to_array(reslenx, dataleny); + convert_to_array *tempg = new convert_to_array(reslenx, dataleny); + convert_to_array *line = new convert_to_array(datalenx); + convert_to_array *atempline = new convert_to_array(reslenx); + convert_to_array *dtempline = new convert_to_array(reslenx); for (int y=0; y::dwt2D (to_array &data if (atempline != NULL) { delete atempline; atempline = NULL; } if (dtempline != NULL) { delete dtempline; dtempline = NULL; } - to_array *col1 = new to_array(dataleny); - to_array *col2 = new to_array(dataleny); - to_array *atempcol = new to_array(resleny); - to_array *dtempcol = new to_array(resleny); + convert_to_array *col1 = new convert_to_array(dataleny); + convert_to_array *col2 = new convert_to_array(dataleny); + convert_to_array *atempcol = new convert_to_array(resleny); + convert_to_array *dtempcol = new convert_to_array(resleny); for (int x=0; x::dwt2D (to_array &data } template -void OrthogonalWaveletTransform::dwt2D (to_array &data, \ +void OrthogonalWaveletTransform::dwt2D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE) { dblarray filterh, filterg; @@ -1030,9 +1030,9 @@ void OrthogonalWaveletTransform::dwt2D (to_array &data } template -void OrthogonalWaveletTransform::idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ +void OrthogonalWaveletTransform::idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data) + convert_to_array &data) { int calenx = ca.nx(), caleny = ca.ny(); int chlenx = ch.nx(), chleny = ch.ny(); @@ -1049,14 +1049,14 @@ void OrthogonalWaveletTransform::idwt2D (to_array &ca, int resleny = getReconsResultLength(caleny, hlen); data.resize(reslenx, resleny); - to_array *temph = new to_array(calenx, resleny); - to_array *tempg = new to_array(calenx, resleny); - to_array *cola = new to_array(caleny); - to_array *colh = new to_array(chleny); - to_array *colv = new to_array(cvleny); - to_array *cold = new to_array(cdleny); - to_array *coltemph = new to_array(resleny); - to_array *coltempg = new to_array(resleny); + convert_to_array *temph = new convert_to_array(calenx, resleny); + convert_to_array *tempg = new convert_to_array(calenx, resleny); + convert_to_array *cola = new convert_to_array(caleny); + convert_to_array *colh = new convert_to_array(chleny); + convert_to_array *colv = new convert_to_array(cvleny); + convert_to_array *cold = new convert_to_array(cdleny); + convert_to_array *coltemph = new convert_to_array(resleny); + convert_to_array *coltempg = new convert_to_array(resleny); for (int x=0; x::idwt2D (to_array &ca, if (coltemph != NULL) { delete coltemph; coltemph = NULL; } if (coltempg != NULL) { delete coltempg; coltempg = NULL; } - to_array *lineh = new to_array(calenx); - to_array *lineg = new to_array(calenx); - to_array *line = new to_array(reslenx); + convert_to_array *lineh = new convert_to_array(calenx); + convert_to_array *lineg = new convert_to_array(calenx); + convert_to_array *line = new convert_to_array(reslenx); for (int y=0; y::idwt2D (to_array &ca, } template -void OrthogonalWaveletTransform::idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ +void OrthogonalWaveletTransform::idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ int filterName, \ - to_array &data) + convert_to_array &data) { dblarray filterh, filterg; getWaveletReconsFilter(filterName, filterh, filterg); @@ -1114,16 +1114,16 @@ void OrthogonalWaveletTransform::idwt2D (to_array &ca, template void OrthogonalWaveletTransform::dwt3D ( \ - to_array &data, \ + convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE) { int hlen = dfilterh.n_elem(), glen = dfilterg.n_elem(); @@ -1139,18 +1139,18 @@ void OrthogonalWaveletTransform::dwt3D ( \ cggh.resize(reslenx, resleny, reslenz); cggg.resize(reslenx, resleny, reslenz); // X - to_array *temph = new to_array; - to_array *tempg = new to_array; + convert_to_array *temph = new convert_to_array; + convert_to_array *tempg = new convert_to_array; transformXYZ(data, dfilterh, dfilterg, *temph, *tempg, 0, BORDERTYPE); // Y - to_array *temphh = new to_array; - to_array *temphg = new to_array; + convert_to_array *temphh = new convert_to_array; + convert_to_array *temphg = new convert_to_array; transformXYZ(*temph, dfilterh, dfilterg, *temphh, *temphg, 1, BORDERTYPE); if (temph != NULL) { delete temph; temph = NULL; } - to_array *tempgh = new to_array; - to_array *tempgg = new to_array; + convert_to_array *tempgh = new convert_to_array; + convert_to_array *tempgg = new convert_to_array; transformXYZ(*tempg, dfilterh, dfilterg, *tempgh, *tempgg, 1, BORDERTYPE); if (tempg != NULL) { delete tempg; tempg = NULL; } @@ -1168,16 +1168,16 @@ void OrthogonalWaveletTransform::dwt3D ( \ template void OrthogonalWaveletTransform::dwt3D ( \ - to_array &data, \ + convert_to_array &data, \ int filterName, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE) { dblarray filterh, filterg; @@ -1187,16 +1187,16 @@ void OrthogonalWaveletTransform::dwt3D ( \ template void OrthogonalWaveletTransform::idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data) + convert_to_array &data) { int hlen = rfilterh.n_elem(), glen = rfilterg.n_elem(); if (hlen != glen) @@ -1223,18 +1223,18 @@ void OrthogonalWaveletTransform::idwt3D ( \ data.resize(reslenx, resleny, reslenz); // Z - to_array *temphh = new to_array; - to_array *temphg = new to_array; - to_array *tempgh = new to_array; - to_array *tempgg = new to_array; + convert_to_array *temphh = new convert_to_array; + convert_to_array *temphg = new convert_to_array; + convert_to_array *tempgh = new convert_to_array; + convert_to_array *tempgg = new convert_to_array; reconstructionXYZ(ca, chhg, rfilterh, rfilterg, *temphh, 2); reconstructionXYZ(chgh, chgg, rfilterh, rfilterg, *temphg, 2); reconstructionXYZ(cghh, cghg, rfilterh, rfilterg, *tempgh, 2); reconstructionXYZ(cggh, cggg, rfilterh, rfilterg, *tempgg, 2); // Y - to_array *temph = new to_array; - to_array *tempg = new to_array; + convert_to_array *temph = new convert_to_array; + convert_to_array *tempg = new convert_to_array; reconstructionXYZ(*temphh, *temphg, rfilterh, rfilterg, *temph, 1); if (temphh != NULL) { delete temphh; temphh = NULL; } if (temphg != NULL) { delete temphg; temphg = NULL; } @@ -1251,16 +1251,16 @@ void OrthogonalWaveletTransform::idwt3D ( \ template void OrthogonalWaveletTransform::idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ int filterName, \ - to_array &data) + convert_to_array &data) { dblarray filterh, filterg; getWaveletReconsFilter(filterName, filterh, filterg); diff --git a/src/msvst/msvstmain/msvst_2d1d.cc b/src/msvst/msvstmain/msvst_2d1d.cc index 4228c45..72ab959 100755 --- a/src/msvst/msvstmain/msvst_2d1d.cc +++ b/src/msvst/msvstmain/msvst_2d1d.cc @@ -293,7 +293,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { int dim = data.naxis(); if (VERBOSE) @@ -333,7 +333,7 @@ void display (to_array &data) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); int len = ref.n_elem(); @@ -345,7 +345,7 @@ void setConst (to_array &dest, to_array &ref, do // denoise a band template -void bandDenoise(fltarray &band, double sigma, to_array *ms, int sxy, int sz) +void bandDenoise(fltarray &band, double sigma, convert_to_array *ms, int sxy, int sz) { WaveletShrinkage ws; double pr, fdrp; // threshold p-value and FDR-threshold p-value @@ -389,7 +389,7 @@ void bandDenoise(fltarray &band, double sigma, to_array *ms, int // B3 Wavelet denoising - general process template -void b3SplineDenoise (fltarray &data, to_array *multiSup) +void b3SplineDenoise (fltarray &data, convert_to_array *multiSup) { double sigma; double corr; @@ -491,7 +491,7 @@ void b3SplineDenoise (fltarray &data, to_array *multiSup) // for different modes of iteration template -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda, int itr) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda, int itr) { int n = data.n_elem(); diff --git a/src/msvst/msvstmain/msvst_iwt2d.cc b/src/msvst/msvstmain/msvst_iwt2d.cc index 9eb0716..329e9d4 100755 --- a/src/msvst/msvstmain/msvst_iwt2d.cc +++ b/src/msvst/msvstmain/msvst_iwt2d.cc @@ -248,7 +248,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { int dim = data.naxis(); if (VERBOSE) @@ -288,7 +288,7 @@ void display (to_array &data) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); int len = ref.n_elem(); @@ -300,7 +300,7 @@ void setConst (to_array &dest, to_array &ref, do // Wavelet denoising - general process template -void b3SplineDenoise (fltarray &data, to_array *multiSup) +void b3SplineDenoise (fltarray &data, convert_to_array *multiSup) { int dim = data.naxis(); double pr, fdrp; // threshold p-value and FDR-threshold p-value @@ -354,7 +354,7 @@ void b3SplineDenoise (fltarray &data, to_array *multiSup) // for different modes of iteration template -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda, int itr) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda, int itr) { int n = data.n_elem(); diff --git a/src/msvst/msvstmain/msvst_iwt2d_coupled.cc b/src/msvst/msvstmain/msvst_iwt2d_coupled.cc index a9e0c84..419fe48 100755 --- a/src/msvst/msvstmain/msvst_iwt2d_coupled.cc +++ b/src/msvst/msvstmain/msvst_iwt2d_coupled.cc @@ -280,7 +280,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { int dim = data.naxis(); if (VERBOSE) @@ -320,7 +320,7 @@ void display (to_array &data) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); int len = ref.n_elem(); @@ -332,7 +332,7 @@ void setConst (to_array &dest, to_array &ref, do // Wavelet denoising - general process template -void b3SplineDenoise (fltarray &data, to_array *multiSup) +void b3SplineDenoise (fltarray &data, convert_to_array *multiSup) { int dim = data.naxis(); double pr, fdrp; // threshold p-value and FDR-threshold p-value @@ -420,7 +420,7 @@ void b3SplineDenoise (fltarray &data, to_array *multiSup) // for different modes of iteration template -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda) { int n = data.n_elem(); diff --git a/src/msvst/msvstmain/msvst_uwt2d.cc b/src/msvst/msvstmain/msvst_uwt2d.cc index da4cc66..7b9b599 100755 --- a/src/msvst/msvstmain/msvst_uwt2d.cc +++ b/src/msvst/msvstmain/msvst_uwt2d.cc @@ -221,7 +221,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { int dim = data.naxis(); if (VERBOSE) @@ -261,7 +261,7 @@ void display (to_array &data) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); int len = ref.n_elem(); @@ -275,7 +275,7 @@ void setConst (to_array &dest, to_array &ref, do // maxlen is the max. length of the filters // this function garantees the even number of samples along each direction when decimated transform is used. template -void extData(to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) +void extData(convert_to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) { int nx = data.nx(), ny = data.ny(), nz = data.nz(); int dim = data.naxis(); @@ -309,7 +309,7 @@ void extData(to_array &data, int maxlen[], type_border BORDERTYP { int newlen = nx + lext + rext; if ((newlen % 2 != 0) && dec[0]) { newlen++; ext[1]++; rext++; } - to_array *temp = new to_array(newlen); + convert_to_array *temp = new convert_to_array(newlen); for (int x=0; x &data, int maxlen[], type_border BORDERTYP if ((newlen1 % 2 != 0) && dec[0]) { newlen1++; ext[1]++; rext++; } if ((newlen2 % 2 != 0) && dec[1]) { newlen2++; ext[3]++; dext++; } - to_array *temp = new to_array(newlen1, newlen2); + convert_to_array *temp = new convert_to_array(newlen1, newlen2); for (int y=0; y &data, int maxlen[], type_border BORDERTYP if ((newlen2 % 2 != 0) && dec[1]) { newlen2++; ext[3]++; dext++; } if ((newlen3 % 2 != 0) && dec[2]) { newlen3++; ext[5]++; fext++; } - to_array *temp = new to_array(newlen1, newlen2, newlen3); + convert_to_array *temp = new convert_to_array(newlen1, newlen2, newlen3); for (int z=0; z &data, int maxlen[], type_border BORDERTYP // extract the data from the extension version template -void extractData (to_array &data, int ext[6]) +void extractData (convert_to_array &data, int ext[6]) { int dim = data.naxis(); int lext = ext[0], rext = ext[1], uext = ext[2]; @@ -357,7 +357,7 @@ void extractData (to_array &data, int ext[6]) if ((dim == 1) && ((lext != 0) || (rext != 0))) { int finallen = data.nx() - lext - rext; - to_array *tdata = new to_array(finallen); + convert_to_array *tdata = new convert_to_array(finallen); for (int x=0; x &data, int ext[6]) { int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; - to_array *tdata = new to_array(finallen1, finallen2); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2); for (int x=0; x &data, int ext[6]) int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; int finallen3 = data.nz() - bext - fext; - to_array *tdata = new to_array(finallen1, finallen2, finallen3); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2, finallen3); for (int x=0; x -void msvst (to_array &data, to_array &vstData, int scale) +void msvst (convert_to_array &data, convert_to_array &vstData, int scale) { double b, c; int dim = data.naxis(); @@ -464,7 +464,7 @@ void msvst (to_array &data, to_array &vstData, i // Wavelet denoising - general process template void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], \ - to_array *multiSup = NULL) + convert_to_array *multiSup = NULL) { int dim = data.naxis(); int ext[NSCALE][6]; @@ -848,7 +848,7 @@ void fiszDenoise (fltarray &data, int DX, int DY, int DZ) } template -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda, int itr) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda, int itr) { int n = data.n_elem(); diff --git a/src/mwir/libmwir/Fisz.h b/src/mwir/libmwir/Fisz.h index acd7d23..0e2b426 100755 --- a/src/mwir/libmwir/Fisz.h +++ b/src/mwir/libmwir/Fisz.h @@ -22,27 +22,27 @@ class FiszTransform // dimension of the nearest power of two, // if the data size is not of power two; // ext is an array of 6 elements (extension information of 6 directions) - void dataExtension (to_array &data, int ext[], type_border BORDERTYPE=I_MIRROR); + void dataExtension (convert_to_array &data, int ext[], type_border BORDERTYPE=I_MIRROR); // extract the original data in using the extension information - void dataExtraction (to_array &data, int ext[]); + void dataExtraction (convert_to_array &data, int ext[]); // Fisz transform 1D / 2D / 3D // the data size MUST be power of two, // otherwise, a DataSizeException will be thrown out - void fisz1D (to_array &data); - void fisz2D (to_array &data); - void fisz3D (to_array &data); + void fisz1D (convert_to_array &data); + void fisz2D (convert_to_array &data); + void fisz3D (convert_to_array &data); // Inverse Fisz transform 1D / 2D / 3D // data size MUST be power of two. // otherwise, a DataSizeException will be thrown out - void ifisz1D (to_array &data); - void ifisz2D (to_array &data); - void ifisz3D (to_array &data); + void ifisz1D (convert_to_array &data); + void ifisz2D (convert_to_array &data); + void ifisz3D (convert_to_array &data); }; template -void FiszTransform::dataExtension (to_array &data, int ext[], type_border BORDERTYPE) +void FiszTransform::dataExtension (convert_to_array &data, int ext[], type_border BORDERTYPE) { int lext = 0, rext = 0, uext = 0, dext = 0, bext = 0, fext = 0; int dim = data.naxis(); @@ -54,7 +54,7 @@ void FiszTransform::dataExtension (to_array &data, int lext = (newlen - len1) / 2; rext = (newlen - len1) - lext; - to_array *temp = new to_array(newlen); + convert_to_array *temp = new convert_to_array(newlen); for (int x=0; x::dataExtension (to_array &data, int lext = (newlen1 - len1) / 2; rext = (newlen1 - len1) - lext; uext = (newlen2 - len2) / 2; dext = (newlen2 - len2) - uext; - to_array *temp = new to_array(newlen1, newlen2); + convert_to_array *temp = new convert_to_array(newlen1, newlen2); for (int y=0; y::dataExtension (to_array &data, int uext = (newlen2 - len2) / 2; dext = (newlen2 - len2) - uext; bext = (newlen3 - len3) / 2; fext = (newlen3 - len3) - fext; - to_array *temp = new to_array(newlen1, newlen2, newlen3); + convert_to_array *temp = new convert_to_array(newlen1, newlen2, newlen3); for (int z=0; z::dataExtension (to_array &data, int } template -void FiszTransform::dataExtraction (to_array &data, int ext[]) +void FiszTransform::dataExtraction (convert_to_array &data, int ext[]) { int dim = data.naxis(); int lext = ext[0], rext = ext[1], uext = ext[2]; @@ -115,7 +115,7 @@ void FiszTransform::dataExtraction (to_array &data, in if ((dim == 1) && ((lext != 0) || (rext != 0))) { int finallen = data.nx() - lext - rext; - to_array *tdata = new to_array(finallen); + convert_to_array *tdata = new convert_to_array(finallen); for (int x=0; x::dataExtraction (to_array &data, in { int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; - to_array *tdata = new to_array(finallen1, finallen2); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2); for (int x=0; x::dataExtraction (to_array &data, in int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; int finallen3 = data.nz() - bext - fext; - to_array *tdata = new to_array(finallen1, finallen2, finallen3); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2, finallen3); for (int x=0; x::dataExtraction (to_array &data, in } template -void FiszTransform::fisz1D (to_array &data) +void FiszTransform::fisz1D (convert_to_array &data) { double ca, cd; int len = data.nx(); if (len <= 1) return; else if (!is_power_of_2(len)) throw DataSizeException(len, "data size not of power of two"); - to_array *temp = new to_array(len); + convert_to_array *temp = new convert_to_array(len); // decomposition by Haar transform and modification of detail coefficients while (len > 1) @@ -193,14 +193,14 @@ void FiszTransform::fisz1D (to_array &data) } template -void FiszTransform::ifisz1D (to_array &data) +void FiszTransform::ifisz1D (convert_to_array &data) { double ca, cd; int len = data.nx(); if (len <= 1) return; else if (!is_power_of_2(len)) throw DataSizeException(len, "data size not of power of two"); - to_array *temp = new to_array(len); + convert_to_array *temp = new convert_to_array(len); // decomposition by Haar transform while (len > 1) @@ -232,7 +232,7 @@ void FiszTransform::ifisz1D (to_array &data) } template -void FiszTransform::fisz2D (to_array &data) +void FiszTransform::fisz2D (convert_to_array &data) { double ca, dh, dv, dd; int s, offsetx, offsety; @@ -242,7 +242,7 @@ void FiszTransform::fisz2D (to_array &data) throw DataSizeException(len1, "data size not of power of two"); else if (!is_power_of_2(len2)) throw DataSizeException(len2, "data size not of power of two"); - to_array *temp = new to_array(len1, len2); + convert_to_array *temp = new convert_to_array(len1, len2); // decomposition by Haar transform and modification of detail coefficients while ((len1 > 1) && (len2 > 1)) @@ -318,7 +318,7 @@ void FiszTransform::fisz2D (to_array &data) } template -void FiszTransform::ifisz2D (to_array &data) +void FiszTransform::ifisz2D (convert_to_array &data) { double ca, dh, dv, dd; int s, offsetx, offsety; @@ -328,7 +328,7 @@ void FiszTransform::ifisz2D (to_array &data) throw DataSizeException(len1, "data size not of power of two"); else if (!is_power_of_2(len2)) throw DataSizeException(len2, "data size not of power of two"); - to_array *temp = new to_array(len1, len2); + convert_to_array *temp = new convert_to_array(len1, len2); // decomposition by Haar transform while ((len1 > 1) && (len2 > 1)) @@ -396,7 +396,7 @@ void FiszTransform::ifisz2D (to_array &data) } template -void FiszTransform::fisz3D (to_array &data) +void FiszTransform::fisz3D (convert_to_array &data) { int len1 = data.nx(), len2 = data.ny(), len3 = data.nz(); int len = MIN(MIN(len1, len2), len3); @@ -409,7 +409,7 @@ void FiszTransform::fisz3D (to_array &data) throw DataSizeException(len3, "data size not of power of two"); int s = iilog2(len); - to_array *coef = new to_array[7*s + 1]; + convert_to_array *coef = new convert_to_array[7*s + 1]; dblarray dfilterh(2), dfilterg(2), rfilterh(2), rfilterg(2); dfilterh(0) = .5; dfilterh(1) = .5; dfilterg(0) = -.5; dfilterg(1) = .5; @@ -449,7 +449,7 @@ void FiszTransform::fisz3D (to_array &data) } template -void FiszTransform::ifisz3D (to_array &data) +void FiszTransform::ifisz3D (convert_to_array &data) { int len1 = data.nx(), len2 = data.ny(), len3 = data.nz(); int len = MIN(MIN(len1, len2), len3); @@ -462,7 +462,7 @@ void FiszTransform::ifisz3D (to_array &data) throw DataSizeException(len3, "data size not of power of two"); int s = iilog2(len); - to_array *coef = new to_array[7*s + 1]; + convert_to_array *coef = new convert_to_array[7*s + 1]; dblarray dfilterh(2), dfilterg(2), rfilterh(2), rfilterg(2); dfilterh(0) = .5; dfilterh(1) = .5; dfilterg(0) = -.5; dfilterg(1) = .5; diff --git a/src/mwir/libmwir/ImLib_mwir.h b/src/mwir/libmwir/ImLib_mwir.h index c599300..a59ec9f 100644 --- a/src/mwir/libmwir/ImLib_mwir.h +++ b/src/mwir/libmwir/ImLib_mwir.h @@ -20,25 +20,25 @@ class Utils public: // median value of the absolute value of a given data set - static DATATYPE absMedian (to_array &data); + static DATATYPE absMedian (convert_to_array &data); // critical threshold for standard normal distribution, tailProba <= 0.5 static double criticalThreshGauss (double tailProba); // cumulative of the normal distribution static double cumNormal (double x); // Anscombe transform of a data set - static void anscombeTransform (to_array &data); - static void invAnscombeTransform (to_array &data); + static void anscombeTransform (convert_to_array &data); + static void invAnscombeTransform (convert_to_array &data); // generate Donoho's clipped block 1D signal - static void blockSignal (int len, double scaling, to_array &signal1D); + static void blockSignal (int len, double scaling, convert_to_array &signal1D); // generate a 1D signal with a Gaussian form - static void regularSignal (int cx, double sigma, double peakIntense, double backIntense, to_array &signal1D); + static void regularSignal (int cx, double sigma, double peakIntense, double backIntense, convert_to_array &signal1D); // generate a 3D signal with a regional evalutionary Gaussian form static void regularSignal (int cx, int cy, double sigma0, double sigma1, double k, \ - double peakIntense, double backIntense, to_array &signal3D, double flow[]); + double peakIntense, double backIntense, convert_to_array &signal3D, double flow[]); // calculate the source flow of a Gaussian form signal - static void gaussianSourceFlow (to_array &signal3D, double cx, double cy, \ + static void gaussianSourceFlow (convert_to_array &signal3D, double cx, double cy, \ double sigma0, double sigma1, double k, double backIntense, double flow[]); // mean of a vector @@ -46,9 +46,9 @@ class Utils // standard deviation of a vector static double std (DATATYPE vec[], int len); // Normalized Integrated Square Error where the noise is Poissonian - static double NISE (to_array &orig, to_array &estim); + static double NISE (convert_to_array &orig, convert_to_array &estim); // Integrated Square Error where the noise has a spatially stable variance - static double ISE (to_array &orig, to_array &estim); + static double ISE (convert_to_array &orig, convert_to_array &estim); // return the combinatorial number C(n, k) static double Cnk (int n, int k); @@ -62,7 +62,7 @@ class Utils // ndet record for each pixel, the number of detection among NExp experiences // ndlen is the length of the array ndet // NITER is max. number of iteration - static void EMMixBinomialParam (double &alpha, double &pa, double &pi, int NExp, to_array ndet[], int ndlen, int NITER); + static void EMMixBinomialParam (double &alpha, double &pa, double &pi, int NExp, convert_to_array ndet[], int ndlen, int NITER); // // ROC area where [alpha0, alpha1] is the valid H0 portion interval // static double rocArea (int len, double alpha[], double pa[], double pi[], double alpha0, double alpha1); // ROC area @@ -70,7 +70,7 @@ class Utils }; template -DATATYPE Utils::absMedian (to_array &data) +DATATYPE Utils::absMedian (convert_to_array &data) { DATATYPE medv; int less, greater, equal; @@ -140,7 +140,7 @@ double Utils::cumNormal (double x) } template -void Utils::anscombeTransform (to_array &data) +void Utils::anscombeTransform (convert_to_array &data) { int nlen = data.n_elem(); for (int i=0; i::anscombeTransform (to_array &data) } template -void Utils::invAnscombeTransform (to_array &data) +void Utils::invAnscombeTransform (convert_to_array &data) { int nlen = data.n_elem(); for (int i=0; i::invAnscombeTransform (to_array &data) } template -void Utils::blockSignal (int len, double scaling, to_array &signal1D) +void Utils::blockSignal (int len, double scaling, convert_to_array &signal1D) { signal1D.resize(len); @@ -174,7 +174,7 @@ void Utils::blockSignal (int len, double scaling, to_array -void Utils::regularSignal (int cx, double sigma, double peakIntense, double backIntense, to_array &signal1D) +void Utils::regularSignal (int cx, double sigma, double peakIntense, double backIntense, convert_to_array &signal1D) { int nx = signal1D.nx(); double sig = 2. * sigma * sigma; @@ -185,7 +185,7 @@ void Utils::regularSignal (int cx, double sigma, double peakIntense, d template void Utils::regularSignal (int cx, int cy, double sigma0, double sigma1, double k, \ - double peakIntense, double backIntense, to_array &signal3D, double flow[]) + double peakIntense, double backIntense, convert_to_array &signal3D, double flow[]) { int nx = signal3D.nx(), ny = signal3D.ny(), nz = signal3D.nz(); double dsig = (sigma1 - sigma0) / (nz - 1), sig = sigma0; @@ -215,7 +215,7 @@ void Utils::regularSignal (int cx, int cy, double sigma0, double sigma } template -void Utils::gaussianSourceFlow (to_array &signal3D, double cx, double cy, \ +void Utils::gaussianSourceFlow (convert_to_array &signal3D, double cx, double cy, \ double sigma0, double sigma1, double k, double backIntense, double flow[]) { int nx = signal3D.nx(), ny = signal3D.ny(), nz = signal3D.nz(); @@ -258,7 +258,7 @@ double Utils::std (DATATYPE vec[], int len) } template -double Utils::NISE (to_array &orig, to_array &estim) +double Utils::NISE (convert_to_array &orig, convert_to_array &estim) { int dlen = orig.n_elem(); double sum = 0., lambda, temp; @@ -274,7 +274,7 @@ double Utils::NISE (to_array &orig, to_array -double Utils::ISE (to_array &orig, to_array &estim) +double Utils::ISE (convert_to_array &orig, convert_to_array &estim) { int dlen = orig.n_elem(); double sum = 0., temp; @@ -321,7 +321,7 @@ double Utils::binomial (int n, int k, double p) } template -void Utils::EMMixBinomialParam (double &alpha, double &pa, double &pi, int NExp, to_array ndet[], int ndlen, int NITER) +void Utils::EMMixBinomialParam (double &alpha, double &pa, double &pi, int NExp, convert_to_array ndet[], int ndlen, int NITER) { long N = 0; int k; diff --git a/src/mwir/libmwir/Wavelet_wmir.h b/src/mwir/libmwir/Wavelet_wmir.h index 8907b99..8b62f5b 100644 --- a/src/mwir/libmwir/Wavelet_wmir.h +++ b/src/mwir/libmwir/Wavelet_wmir.h @@ -64,17 +64,17 @@ class OrthogonalWaveletTransform // (I)DWT 1D along a certain axis // only used by (I)DWT3D // axis = 0, 1, 2 : X, Y, Z - static void transformXYZ (to_array &data, dblarray &dfilterh, dblarray &dfilterg, to_array &ca, to_array &cd, int axis, type_border BORDERTYPE); - static void reconstructionXYZ (to_array &ca, to_array &cd, dblarray &rfilterh, dblarray &rfilterg, to_array &data, int axis); + static void transformXYZ (convert_to_array &data, dblarray &dfilterh, dblarray &dfilterg, convert_to_array &ca, convert_to_array &cd, int axis, type_border BORDERTYPE); + static void reconstructionXYZ (convert_to_array &ca, convert_to_array &cd, dblarray &rfilterh, dblarray &rfilterg, convert_to_array &data, int axis); public: // orthogonal wavelet types static const int HAAR=0, DAUB4=4, SYML4=16; // resize the data to the same size of the reference - static void resizeData (to_array &data, to_array &ref, type_border BORDERTYPE=I_ZERO); + static void resizeData (convert_to_array &data, convert_to_array &ref, type_border BORDERTYPE=I_ZERO); // resize the data to [nx], [nx, ny] or [nx, ny, nz] according to the dimension of the data - static void resizeData (to_array &data, int nx, int ny, int nz, type_border BORDERTYPE=I_ZERO); + static void resizeData (convert_to_array &data, int nx, int ny, int nz, type_border BORDERTYPE=I_ZERO); // get the decomposition filters, i.e. \bar{h}, \bar{g} // where h is considered to start from the origin @@ -83,88 +83,88 @@ class OrthogonalWaveletTransform static void getWaveletReconsFilter (int filterName, dblarray &rfilterh, dblarray &rfilterg); // DWT 1D - static void dwt1D (to_array &data, \ + static void dwt1D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); - static void dwt1D (to_array &data, \ + static void dwt1D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); // IDWT 1D - static void idwt1D (to_array &ca, to_array &cd, \ + static void idwt1D (convert_to_array &ca, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data); - static void idwt1D (to_array &ca, to_array &cd, \ + convert_to_array &data); + static void idwt1D (convert_to_array &ca, convert_to_array &cd, \ int filterName, \ - to_array &data); + convert_to_array &data); // DWT 2D - static void dwt2D (to_array &data, \ + static void dwt2D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); - static void dwt2D (to_array &data, \ + static void dwt2D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE=I_MIRROR); // IDWT 2D - static void idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + static void idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data); - static void idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &data); + static void idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ int filterName, \ - to_array &data); + convert_to_array &data); // DWT 3D - static void dwt3D (to_array &data, \ + static void dwt3D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE=I_MIRROR); - static void dwt3D (to_array &data, \ + static void dwt3D (convert_to_array &data, \ int filterName, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE=I_MIRROR); // IDWT 3D static void idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data); + convert_to_array &data); static void idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ int filterName, \ - to_array &data); + convert_to_array &data); }; template @@ -177,19 +177,19 @@ template const int OrthogonalWaveletTransform::SYML4; template -void OrthogonalWaveletTransform::resizeData(to_array &data, to_array &ref, type_border BORDERTYPE) +void OrthogonalWaveletTransform::resizeData(convert_to_array &data, convert_to_array &ref, type_border BORDERTYPE) { resizeData(data, ref.nx(), ref.ny(), ref.nz(), BORDERTYPE); } template -void OrthogonalWaveletTransform::resizeData(to_array &data, int nx, int ny, int nz, type_border BORDERTYPE) +void OrthogonalWaveletTransform::resizeData(convert_to_array &data, int nx, int ny, int nz, type_border BORDERTYPE) { int dnx = data.nx(), dny = data.ny(), dnz = data.nz(); if ((nx == dnx) && (ny == dny) && (nz == dnz)) return; int dim = data.naxis(); - to_array *temp = new to_array(dnx, dny, dnz); + convert_to_array *temp = new convert_to_array(dnx, dny, dnz); *temp = data; if (dim == 1) { @@ -272,9 +272,9 @@ void OrthogonalWaveletTransform::getWaveletReconsFilter (int filterNam } template -void OrthogonalWaveletTransform::transformXYZ (to_array &data, dblarray &dfilterh, dblarray &dfilterg, to_array &ca, to_array &cd, int axis, type_border BORDERTYPE) +void OrthogonalWaveletTransform::transformXYZ (convert_to_array &data, dblarray &dfilterh, dblarray &dfilterg, convert_to_array &ca, convert_to_array &cd, int axis, type_border BORDERTYPE) { - to_array *line = NULL, *linea = NULL, *lined = NULL; + convert_to_array *line = NULL, *linea = NULL, *lined = NULL; int lenx, leny, lenz, dlenx, dleny, dlenz; if (axis == 0) @@ -283,9 +283,9 @@ void OrthogonalWaveletTransform::transformXYZ (to_array(lenx); - linea = new to_array(dlenx); - lined = new to_array(dlenx); + line = new convert_to_array(lenx); + linea = new convert_to_array(dlenx); + lined = new convert_to_array(dlenx); for (int z=0; z::transformXYZ (to_array(leny); - linea = new to_array(dleny); - lined = new to_array(dleny); + line = new convert_to_array(leny); + linea = new convert_to_array(dleny); + lined = new convert_to_array(dleny); for (int z=0; z::transformXYZ (to_array(lenz); - linea = new to_array(dlenz); - lined = new to_array(dlenz); + line = new convert_to_array(lenz); + linea = new convert_to_array(dlenz); + lined = new convert_to_array(dlenz); for (int y=0; y::transformXYZ (to_array -void OrthogonalWaveletTransform::reconstructionXYZ (to_array &ca, to_array &cd, dblarray &rfilterh, dblarray &rfilterg, to_array &data, int axis) +void OrthogonalWaveletTransform::reconstructionXYZ (convert_to_array &ca, convert_to_array &cd, dblarray &rfilterh, dblarray &rfilterg, convert_to_array &data, int axis) { - to_array *line = NULL, *linea = NULL, *lined = NULL; + convert_to_array *line = NULL, *linea = NULL, *lined = NULL; int lenx, leny, lenz, rlenx, rleny, rlenz; if (axis == 0) { lenx = ca.nx(); leny = ca.ny(); lenz = ca.nz(); rlenx = getReconsResultLength(lenx, rfilterh.n_elem()); - line = new to_array(rlenx); - linea = new to_array(lenx); - lined = new to_array(lenx); + line = new convert_to_array(rlenx); + linea = new convert_to_array(lenx); + lined = new convert_to_array(lenx); data.resize(rlenx, leny, lenz); for (int z=0; z::reconstructionXYZ (to_array(rleny); - linea = new to_array(leny); - lined = new to_array(leny); + line = new convert_to_array(rleny); + linea = new convert_to_array(leny); + lined = new convert_to_array(leny); data.resize(lenx, rleny, lenz); for (int z=0; z::reconstructionXYZ (to_array(rlenz); - linea = new to_array(lenz); - lined = new to_array(lenz); + line = new convert_to_array(rlenz); + linea = new convert_to_array(lenz); + lined = new convert_to_array(lenz); data.resize(lenx, leny, rlenz); for (int y=0; y::reconstructionXYZ (to_array -void OrthogonalWaveletTransform::dwt1D (to_array &data, \ +void OrthogonalWaveletTransform::dwt1D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE) { int datalen = data.nx(); @@ -465,9 +465,9 @@ void OrthogonalWaveletTransform::dwt1D (to_array &data } template -void OrthogonalWaveletTransform::dwt1D (to_array &data, \ +void OrthogonalWaveletTransform::dwt1D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &cd, \ + convert_to_array &ca, convert_to_array &cd, \ type_border BORDERTYPE) { dblarray filterh, filterg; @@ -476,9 +476,9 @@ void OrthogonalWaveletTransform::dwt1D (to_array &data } template -void OrthogonalWaveletTransform::idwt1D (to_array &ca, to_array &cd, \ +void OrthogonalWaveletTransform::idwt1D (convert_to_array &ca, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data) + convert_to_array &data) { int calen = ca.nx(), cdlen = cd.nx(); if (calen != cdlen) @@ -511,9 +511,9 @@ void OrthogonalWaveletTransform::idwt1D (to_array &ca, } template -void OrthogonalWaveletTransform::idwt1D (to_array &ca, to_array &cd, \ +void OrthogonalWaveletTransform::idwt1D (convert_to_array &ca, convert_to_array &cd, \ int filterName, \ - to_array &data) + convert_to_array &data) { dblarray filterh, filterg; getWaveletReconsFilter(filterName, filterh, filterg); @@ -521,9 +521,9 @@ void OrthogonalWaveletTransform::idwt1D (to_array &ca, } template -void OrthogonalWaveletTransform::dwt2D (to_array &data, \ +void OrthogonalWaveletTransform::dwt2D (convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE) { int datalenx = data.nx(), dataleny = data.ny(); @@ -535,11 +535,11 @@ void OrthogonalWaveletTransform::dwt2D (to_array &data ca.resize(reslenx, resleny); ch.resize(reslenx, resleny); cv.resize(reslenx, resleny); cd.resize(reslenx, resleny); - to_array *temph = new to_array(reslenx, dataleny); - to_array *tempg = new to_array(reslenx, dataleny); - to_array *line = new to_array(datalenx); - to_array *atempline = new to_array(reslenx); - to_array *dtempline = new to_array(reslenx); + convert_to_array *temph = new convert_to_array(reslenx, dataleny); + convert_to_array *tempg = new convert_to_array(reslenx, dataleny); + convert_to_array *line = new convert_to_array(datalenx); + convert_to_array *atempline = new convert_to_array(reslenx); + convert_to_array *dtempline = new convert_to_array(reslenx); for (int y=0; y::dwt2D (to_array &data if (atempline != NULL) { delete atempline; atempline = NULL; } if (dtempline != NULL) { delete dtempline; dtempline = NULL; } - to_array *col1 = new to_array(dataleny); - to_array *col2 = new to_array(dataleny); - to_array *atempcol = new to_array(resleny); - to_array *dtempcol = new to_array(resleny); + convert_to_array *col1 = new convert_to_array(dataleny); + convert_to_array *col2 = new convert_to_array(dataleny); + convert_to_array *atempcol = new convert_to_array(resleny); + convert_to_array *dtempcol = new convert_to_array(resleny); for (int x=0; x::dwt2D (to_array &data } template -void OrthogonalWaveletTransform::dwt2D (to_array &data, \ +void OrthogonalWaveletTransform::dwt2D (convert_to_array &data, \ int filterName, \ - to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ + convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ type_border BORDERTYPE) { dblarray filterh, filterg; @@ -598,9 +598,9 @@ void OrthogonalWaveletTransform::dwt2D (to_array &data } template -void OrthogonalWaveletTransform::idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ +void OrthogonalWaveletTransform::idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data) + convert_to_array &data) { int calenx = ca.nx(), caleny = ca.ny(); int chlenx = ch.nx(), chleny = ch.ny(); @@ -617,14 +617,14 @@ void OrthogonalWaveletTransform::idwt2D (to_array &ca, int resleny = getReconsResultLength(caleny, hlen); data.resize(reslenx, resleny); - to_array *temph = new to_array(calenx, resleny); - to_array *tempg = new to_array(calenx, resleny); - to_array *cola = new to_array(caleny); - to_array *colh = new to_array(chleny); - to_array *colv = new to_array(cvleny); - to_array *cold = new to_array(cdleny); - to_array *coltemph = new to_array(resleny); - to_array *coltempg = new to_array(resleny); + convert_to_array *temph = new convert_to_array(calenx, resleny); + convert_to_array *tempg = new convert_to_array(calenx, resleny); + convert_to_array *cola = new convert_to_array(caleny); + convert_to_array *colh = new convert_to_array(chleny); + convert_to_array *colv = new convert_to_array(cvleny); + convert_to_array *cold = new convert_to_array(cdleny); + convert_to_array *coltemph = new convert_to_array(resleny); + convert_to_array *coltempg = new convert_to_array(resleny); for (int x=0; x::idwt2D (to_array &ca, if (coltemph != NULL) { delete coltemph; coltemph = NULL; } if (coltempg != NULL) { delete coltempg; coltempg = NULL; } - to_array *lineh = new to_array(calenx); - to_array *lineg = new to_array(calenx); - to_array *line = new to_array(reslenx); + convert_to_array *lineh = new convert_to_array(calenx); + convert_to_array *lineg = new convert_to_array(calenx); + convert_to_array *line = new convert_to_array(reslenx); for (int y=0; y::idwt2D (to_array &ca, } template -void OrthogonalWaveletTransform::idwt2D (to_array &ca, to_array &ch, to_array &cv, to_array &cd, \ +void OrthogonalWaveletTransform::idwt2D (convert_to_array &ca, convert_to_array &ch, convert_to_array &cv, convert_to_array &cd, \ int filterName, \ - to_array &data) + convert_to_array &data) { dblarray filterh, filterg; getWaveletReconsFilter(filterName, filterh, filterg); @@ -682,16 +682,16 @@ void OrthogonalWaveletTransform::idwt2D (to_array &ca, template void OrthogonalWaveletTransform::dwt3D ( \ - to_array &data, \ + convert_to_array &data, \ dblarray &dfilterh, dblarray &dfilterg, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE) { int hlen = dfilterh.n_elem(), glen = dfilterg.n_elem(); @@ -707,18 +707,18 @@ void OrthogonalWaveletTransform::dwt3D ( \ cggh.resize(reslenx, resleny, reslenz); cggg.resize(reslenx, resleny, reslenz); // X - to_array *temph = new to_array; - to_array *tempg = new to_array; + convert_to_array *temph = new convert_to_array; + convert_to_array *tempg = new convert_to_array; transformXYZ(data, dfilterh, dfilterg, *temph, *tempg, 0, BORDERTYPE); // Y - to_array *temphh = new to_array; - to_array *temphg = new to_array; + convert_to_array *temphh = new convert_to_array; + convert_to_array *temphg = new convert_to_array; transformXYZ(*temph, dfilterh, dfilterg, *temphh, *temphg, 1, BORDERTYPE); if (temph != NULL) { delete temph; temph = NULL; } - to_array *tempgh = new to_array; - to_array *tempgg = new to_array; + convert_to_array *tempgh = new convert_to_array; + convert_to_array *tempgg = new convert_to_array; transformXYZ(*tempg, dfilterh, dfilterg, *tempgh, *tempgg, 1, BORDERTYPE); if (tempg != NULL) { delete tempg; tempg = NULL; } @@ -736,16 +736,16 @@ void OrthogonalWaveletTransform::dwt3D ( \ template void OrthogonalWaveletTransform::dwt3D ( \ - to_array &data, \ + convert_to_array &data, \ int filterName, \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ type_border BORDERTYPE) { dblarray filterh, filterg; @@ -755,16 +755,16 @@ void OrthogonalWaveletTransform::dwt3D ( \ template void OrthogonalWaveletTransform::idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ dblarray &rfilterh, dblarray &rfilterg, \ - to_array &data) + convert_to_array &data) { int hlen = rfilterh.n_elem(), glen = rfilterg.n_elem(); if (hlen != glen) @@ -791,18 +791,18 @@ void OrthogonalWaveletTransform::idwt3D ( \ data.resize(reslenx, resleny, reslenz); // Z - to_array *temphh = new to_array; - to_array *temphg = new to_array; - to_array *tempgh = new to_array; - to_array *tempgg = new to_array; + convert_to_array *temphh = new convert_to_array; + convert_to_array *temphg = new convert_to_array; + convert_to_array *tempgh = new convert_to_array; + convert_to_array *tempgg = new convert_to_array; reconstructionXYZ(ca, chhg, rfilterh, rfilterg, *temphh, 2); reconstructionXYZ(chgh, chgg, rfilterh, rfilterg, *temphg, 2); reconstructionXYZ(cghh, cghg, rfilterh, rfilterg, *tempgh, 2); reconstructionXYZ(cggh, cggg, rfilterh, rfilterg, *tempgg, 2); // Y - to_array *temph = new to_array; - to_array *tempg = new to_array; + convert_to_array *temph = new convert_to_array; + convert_to_array *tempg = new convert_to_array; reconstructionXYZ(*temphh, *temphg, rfilterh, rfilterg, *temph, 1); if (temphh != NULL) { delete temphh; temphh = NULL; } if (temphg != NULL) { delete temphg; temphg = NULL; } @@ -819,16 +819,16 @@ void OrthogonalWaveletTransform::idwt3D ( \ template void OrthogonalWaveletTransform::idwt3D ( \ - to_array &ca, \ - to_array &chhg, \ - to_array &chgh, \ - to_array &chgg, \ - to_array &cghh, \ - to_array &cghg, \ - to_array &cggh, \ - to_array &cggg, \ + convert_to_array &ca, \ + convert_to_array &chhg, \ + convert_to_array &chgh, \ + convert_to_array &chgg, \ + convert_to_array &cghh, \ + convert_to_array &cghg, \ + convert_to_array &cggh, \ + convert_to_array &cggg, \ int filterName, \ - to_array &data) + convert_to_array &data) { dblarray filterh, filterg; getWaveletReconsFilter(filterName, filterh, filterg); @@ -894,7 +894,7 @@ class WaveletShrinkage public: // gaussian noise standard deviation MAD estimation // sigma = median (abs(waveletdata)) / 0.6745 - double gaussianStdDevEstim (to_array &waveletData); + double gaussianStdDevEstim (convert_to_array &waveletData); // Denoise gaussian noise // Hard threshold = k * sigma; sup use -sigma / sigma (>=0) to indicate the insignificant/significant coef. region @@ -902,8 +902,8 @@ class WaveletShrinkage // alpha is the preset p-value of the significance level when DEFAULT is not set // DEFAULT indicates to use the universal threshold // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double gaussHardThreshold (to_array &waveletData, int scale[], \ - double alpha, double sigma, to_array *sup = NULL, int N = 1, bool DEFAULT = false); + double gaussHardThreshold (convert_to_array &waveletData, int scale[], \ + double alpha, double sigma, convert_to_array *sup = NULL, int N = 1, bool DEFAULT = false); // Denoise gaussian noise // Soft threshold = k * sigma; sup use -sigma / sigma (>=0) to indicate the insignificant/significant coef. region @@ -911,15 +911,15 @@ class WaveletShrinkage // alpha is the preset p-value of the significance level when DEFAULT is not set // DEFAULT indicates to use the universal threshold // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double gaussSoftThreshold (to_array &waveletData, int scale[], \ - double alpha, double sigma, to_array *sup = NULL, int N = 1, bool DEFAULT = false); + double gaussSoftThreshold (convert_to_array &waveletData, int scale[], \ + double alpha, double sigma, convert_to_array *sup = NULL, int N = 1, bool DEFAULT = false); // Denoise gaussian noise // FDR threshold; sup use -sigma / sigma (>=0) to indicate the insignificant/significant coef. region // alpha is the preset FDR // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double gaussFDRThreshold (to_array &waveletData, \ - double sigma, double alpha, bool indep = true, to_array *sup = NULL); + double gaussFDRThreshold (convert_to_array &waveletData, \ + double sigma, double alpha, bool indep = true, convert_to_array *sup = NULL); // Direct Haar hard threshold in using Kolaczyk's approximation for Poisson noise // The transform data is assumed to use L1-normalized Haar filter, @@ -929,7 +929,7 @@ class WaveletShrinkage // alpha is the preset p-value of the significance level when DEFAULT is not set // DEFAULT indicates to use the universal threshold // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarKolaThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup = NULL, int N = 1, bool DEFAULT = false); + double haarKolaThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup = NULL, int N = 1, bool DEFAULT = false); // Direct Haar hard threshold in using modified Kolaczyk's approximation (Fisher approx.) for Poisson noise // The transform data is assumed to use L1-normalized Haar filter, @@ -939,7 +939,7 @@ class WaveletShrinkage // alpha is the preset p-value of the significance level when DEFAULT is not set // DEFAULT indicates to use the universal threshold // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarMKolaThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup = NULL, int N = 1, bool DEFAULT = false); + double haarMKolaThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup = NULL, int N = 1, bool DEFAULT = false); // Direct Haar hard threshold based on Bijaoui-Jammal's thresholding table for Poisson noise // The transform data is assumed to use L1-normalized Haar filter, @@ -947,7 +947,7 @@ class WaveletShrinkage // scale[] is the scale along each direction // alpha is the preset p-value of the significance level // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarBJThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup = NULL); + double haarBJThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup = NULL); // Direct Haar hard threshold based on FDR (false discovery rate) for Poisson noise // for a band @@ -956,7 +956,7 @@ class WaveletShrinkage // scale[] is the scale along each direction // alpha is the preset FDR // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarFDRThreshold (to_array &ca, to_array &cd, int scale[], double alpha, bool indep = true, to_array *sup = NULL); + double haarFDRThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, bool indep = true, convert_to_array *sup = NULL); // Direct Haar hard threshold based on FDR (false discovery rate) for Poisson noise // for the bands of a scale @@ -965,7 +965,7 @@ class WaveletShrinkage // scale[] is the scale along each direction // alpha is the preset FDR // the thresholding p-value (of the distr. of the absolute value of the coef.) is returned - double haarFDRThreshold (to_array &ca, to_array cd[], int len, int scale[], double alpha, bool indep = true, to_array *sup = NULL); + double haarFDRThreshold (convert_to_array &ca, convert_to_array cd[], int len, int scale[], double alpha, bool indep = true, convert_to_array *sup = NULL); // Model (prior) based Haar coef. threshold for Poisson noise // The transform data is assumed to use L1-normalized Haar filter, @@ -978,9 +978,9 @@ class WaveletShrinkage // N is the length of the original data // DEFAULT indicates to use the universal threshold // the thresholding p-value is returned - double haarModelThreshold (to_array &caModel, \ - to_array &cdModel, to_array &cd, \ - int scale[], double alpha, to_array *sup = NULL, \ + double haarModelThreshold (convert_to_array &caModel, \ + convert_to_array &cdModel, convert_to_array &cd, \ + int scale[], double alpha, convert_to_array *sup = NULL, \ int N = 1, bool DEFAULT = false); // Model (prior) based Haar coef. FDR threshold for Poisson noise @@ -992,13 +992,13 @@ class WaveletShrinkage // scale[] is the scale along each direction // alpha is the preset FDR // the thresholding p-value is returned - double haarModelFDRThreshold (to_array &caModel, \ - to_array &cdModel, to_array &cd, \ - int scale[], double alpha, bool indep = true, to_array *sup = NULL); + double haarModelFDRThreshold (convert_to_array &caModel, \ + convert_to_array &cdModel, convert_to_array &cd, \ + int scale[], double alpha, bool indep = true, convert_to_array *sup = NULL); }; template -double WaveletShrinkage::gaussianStdDevEstim (to_array &waveletData) +double WaveletShrinkage::gaussianStdDevEstim (convert_to_array &waveletData) { double med = Utils::absMedian(waveletData); @@ -1006,7 +1006,7 @@ double WaveletShrinkage::gaussianStdDevEstim (to_array -double WaveletShrinkage::gaussHardThreshold (to_array &waveletData, int scale[], double alpha, double sigma, to_array *sup, int N, bool DEFAULT) +double WaveletShrinkage::gaussHardThreshold (convert_to_array &waveletData, int scale[], double alpha, double sigma, convert_to_array *sup, int N, bool DEFAULT) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -1071,7 +1071,7 @@ double WaveletShrinkage::gaussHardThreshold (to_array -double WaveletShrinkage::gaussSoftThreshold (to_array &waveletData, int scale[], double alpha, double sigma, to_array *sup, int N, bool DEFAULT) +double WaveletShrinkage::gaussSoftThreshold (convert_to_array &waveletData, int scale[], double alpha, double sigma, convert_to_array *sup, int N, bool DEFAULT) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -1149,8 +1149,8 @@ double WaveletShrinkage::gaussSoftThreshold (to_array::cumNormal(cthresh))) : alpha); } template -double WaveletShrinkage::gaussFDRThreshold (to_array &waveletData, \ - double sigma, double alpha, bool indep, to_array *sup) +double WaveletShrinkage::gaussFDRThreshold (convert_to_array &waveletData, \ + double sigma, double alpha, bool indep, convert_to_array *sup) { int dim = waveletData.naxis(); int nx = waveletData.nx(), ny = waveletData.ny(), nz = waveletData.nz(); @@ -1159,7 +1159,7 @@ double WaveletShrinkage::gaussFDRThreshold (to_arrayresize(nx); - to_array *pvals = new to_array(nx); + convert_to_array *pvals = new convert_to_array(nx); for (int x=0; x::gaussFDRThreshold (to_arrayresize(nx, ny); - to_array *pvals = new to_array(nx, ny); + convert_to_array *pvals = new convert_to_array(nx, ny); for (int x=0; x::gaussFDRThreshold (to_arrayresize(nx, ny, nz); - to_array *pvals = new to_array(nx, ny, nz); + convert_to_array *pvals = new convert_to_array(nx, ny, nz); for (int x=0; x::gaussFDRThreshold (to_array -double WaveletShrinkage::haarKolaThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup, int N, bool DEFAULT) +double WaveletShrinkage::haarKolaThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup, int N, bool DEFAULT) { int nx, ny, nz; double coeff, lambda, thresh, zalpha2; @@ -1348,8 +1348,8 @@ double WaveletShrinkage::haarKolaThreshold (to_array -double WaveletShrinkage::haarMKolaThreshold (to_array &ca, \ - to_array &cd, int scale[], double alpha, to_array *sup, int N, bool DEFAULT) +double WaveletShrinkage::haarMKolaThreshold (convert_to_array &ca, \ + convert_to_array &cd, int scale[], double alpha, convert_to_array *sup, int N, bool DEFAULT) { int nx, ny, nz, rn; double coeff, pcoef[5], pm[4], pmi[4], lambda, thresh, zalpha2; @@ -1473,7 +1473,7 @@ double WaveletShrinkage::haarMKolaThreshold (to_array -double WaveletShrinkage::haarBJThreshold (to_array &ca, to_array &cd, int scale[], double alpha, to_array *sup) +double WaveletShrinkage::haarBJThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, convert_to_array *sup) { int nx, ny, nz; double coeff, lambda, thresh, alpha2 = alpha / 2.; @@ -1558,7 +1558,7 @@ double WaveletShrinkage::haarBJThreshold (to_array -double WaveletShrinkage::haarFDRThreshold (to_array &ca, to_array &cd, int scale[], double alpha, bool indep, to_array *sup) +double WaveletShrinkage::haarFDRThreshold (convert_to_array &ca, convert_to_array &cd, int scale[], double alpha, bool indep, convert_to_array *sup) { int nx, ny, nz; double coeff, lambda, fdrp; @@ -1573,7 +1573,7 @@ double WaveletShrinkage::haarFDRThreshold (to_arrayresize(nx); - to_array *pvals = new to_array(nx); + convert_to_array *pvals = new convert_to_array(nx); for (int x=0; x::haarFDRThreshold (to_arrayresize(nx, ny); - to_array *pvals = new to_array(nx, ny); + convert_to_array *pvals = new convert_to_array(nx, ny); for (int x=0; x::haarFDRThreshold (to_arrayresize(nx, ny, nz); - to_array *pvals = new to_array(nx, ny, nz); + convert_to_array *pvals = new convert_to_array(nx, ny, nz); for (int x=0; x::haarFDRThreshold (to_array -double WaveletShrinkage::haarFDRThreshold (to_array &ca, to_array cd[], int len, int scale[], double alpha, bool indep, to_array *sup) +double WaveletShrinkage::haarFDRThreshold (convert_to_array &ca, convert_to_array cd[], int len, int scale[], double alpha, bool indep, convert_to_array *sup) { int nx, ny, nz; double coeff, lambda, fdrp; @@ -1703,7 +1703,7 @@ double WaveletShrinkage::haarFDRThreshold (to_array *pvals = new to_array(len, nx); + convert_to_array *pvals = new convert_to_array(len, nx); for (int l=0; l::haarFDRThreshold (to_array *pvals = new to_array(len, nx, ny); + convert_to_array *pvals = new convert_to_array(len, nx, ny); for (int l=0; l::haarFDRThreshold (to_array *pvals = new to_array(len*nx, ny, nz); + convert_to_array *pvals = new convert_to_array(len*nx, ny, nz); for (int l=0; l::haarFDRThreshold (to_array -double WaveletShrinkage::haarModelThreshold (to_array &caModel, \ - to_array &cdModel, to_array &cd, \ - int scale[], double alpha, to_array *sup, \ +double WaveletShrinkage::haarModelThreshold (convert_to_array &caModel, \ + convert_to_array &cdModel, convert_to_array &cd, \ + int scale[], double alpha, convert_to_array *sup, \ int N, bool DEFAULT) { int nx, ny, nz; @@ -1915,9 +1915,9 @@ double WaveletShrinkage::haarModelThreshold (to_array double WaveletShrinkage::haarModelFDRThreshold \ - (to_array &caModel, \ - to_array &cdModel, to_array &cd, \ - int scale[], double alpha, bool indep, to_array *sup) + (convert_to_array &caModel, \ + convert_to_array &cdModel, convert_to_array &cd, \ + int scale[], double alpha, bool indep, convert_to_array *sup) { int nx, ny, nz; double coefobs, lambda1, lambda2, p, fdrp; @@ -1931,7 +1931,7 @@ double WaveletShrinkage::haarModelFDRThreshold \ { nx = cd.nx(); if (sup != NULL) sup->resize(nx); - to_array *pvals = new to_array(nx); + convert_to_array *pvals = new convert_to_array(nx); for (int x=0; x::haarModelFDRThreshold \ { nx = cd.nx(); ny = cd.ny(); if (sup != NULL) sup->resize(nx, ny); - to_array *pvals = new to_array(nx, ny); + convert_to_array *pvals = new convert_to_array(nx, ny); for (int x=0; x::haarModelFDRThreshold \ { nx = cd.nx(); ny = cd.ny(); nz = cd.nz(); if (sup != NULL) sup->resize(nx, ny, nz); - to_array *pvals = new to_array(nx, ny, nz); + convert_to_array *pvals = new convert_to_array(nx, ny, nz); for (int x=0; x -void display (to_array &data) +void display (convert_to_array &data) { int dim = data.naxis(); if (VERBOSE) @@ -347,7 +347,7 @@ void cycleTrans (fltarray &data, int dx, int dy, int dz) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); int len = ref.n_elem(); @@ -359,7 +359,7 @@ void setConst (to_array &dest, to_array &ref, do // Wavelet denoising - general process template -void b3SplineDenoise (fltarray &data, to_array *multiSup) +void b3SplineDenoise (fltarray &data, convert_to_array *multiSup) { int dim = data.naxis(); double pr, fdrp; // threshold p-value and FDR-threshold p-value @@ -424,7 +424,7 @@ void b3SplineDenoise (fltarray &data, to_array *multiSup) // for different modes of iteration template -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda) { int n = data.n_elem(); @@ -510,7 +510,7 @@ void multiSupIter (fltarray &origdata, fltarray &solution, fltarray *multiSup, i // Anscombe denoising template -void anscombeDenoise (fltarray &data, to_array *multiSup=NULL) +void anscombeDenoise (fltarray &data, convert_to_array *multiSup=NULL) { // Anscombe transform if (VERBOSE) diff --git a/src/mwir/mwirmain/bihaar_gaussian_filter.cc b/src/mwir/mwirmain/bihaar_gaussian_filter.cc index 4277302..9692ff6 100644 --- a/src/mwir/mwirmain/bihaar_gaussian_filter.cc +++ b/src/mwir/mwirmain/bihaar_gaussian_filter.cc @@ -283,7 +283,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { int dim = data.naxis(); if (VERBOSE) @@ -326,7 +326,7 @@ void display (to_array &data) // maxlen is the max. length of the filters // this function garantees the even number of samples along each direction when decimated transform is used. template -void extData(to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) +void extData(convert_to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) { int nx = data.nx(), ny = data.ny(), nz = data.nz(); int dim = data.naxis(); @@ -359,7 +359,7 @@ void extData(to_array &data, int maxlen[], type_border BORDERTYP { int newlen = nx + lext + rext; if ((newlen % 2 != 0) && dec[0]) { newlen++; ext[1]++; rext++; } - to_array *temp = new to_array(newlen); + convert_to_array *temp = new convert_to_array(newlen); for (int x=0; x &data, int maxlen[], type_border BORDERTYP if ((newlen1 % 2 != 0) && dec[0]) { newlen1++; ext[1]++; rext++; } if ((newlen2 % 2 != 0) && dec[1]) { newlen2++; ext[3]++; dext++; } - to_array *temp = new to_array(newlen1, newlen2); + convert_to_array *temp = new convert_to_array(newlen1, newlen2); for (int y=0; y &data, int maxlen[], type_border BORDERTYP if ((newlen2 % 2 != 0) && dec[1]) { newlen2++; ext[3]++; dext++; } if ((newlen3 % 2 != 0) && dec[2]) { newlen3++; ext[5]++; fext++; } - to_array *temp = new to_array(newlen1, newlen2, newlen3); + convert_to_array *temp = new convert_to_array(newlen1, newlen2, newlen3); for (int z=0; z &data, int maxlen[], type_border BORDERTYP // extract the data from the extension version template -void extractData (to_array &data, int ext[6]) +void extractData (convert_to_array &data, int ext[6]) { int dim = data.naxis(); int lext = ext[0], rext = ext[1], uext = ext[2]; @@ -407,7 +407,7 @@ void extractData (to_array &data, int ext[6]) if ((dim == 1) && ((lext != 0) || (rext != 0))) { int finallen = data.nx() - lext - rext; - to_array *tdata = new to_array(finallen); + convert_to_array *tdata = new convert_to_array(finallen); for (int x=0; x &data, int ext[6]) { int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; - to_array *tdata = new to_array(finallen1, finallen2); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2); for (int x=0; x &data, int ext[6]) int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; int finallen3 = data.nz() - bext - fext; - to_array *tdata = new to_array(finallen1, finallen2, finallen3); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2, finallen3); for (int x=0; x &data, int ext[6]) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int dim = ref.naxis(); int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); @@ -518,7 +518,7 @@ double noiseEstimation (fltarray &data) // Wavelet denoising - general process template -void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], to_array *multiSup = NULL) +void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], convert_to_array *multiSup = NULL) { int dim = data.naxis(); int ext[NSCALE][6]; @@ -820,7 +820,7 @@ void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], to_array -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda) { int dim = data.naxis(); int nx = data.nx(), ny = data.ny(), nz = data.nz(); diff --git a/src/mwir/mwirmain/bihaar_gaussian_filter_2d1d.cc b/src/mwir/mwirmain/bihaar_gaussian_filter_2d1d.cc index dcf39cf..d4b6609 100644 --- a/src/mwir/mwirmain/bihaar_gaussian_filter_2d1d.cc +++ b/src/mwir/mwirmain/bihaar_gaussian_filter_2d1d.cc @@ -289,7 +289,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { if (VERBOSE) { @@ -313,7 +313,7 @@ void display (to_array &data) // maxlen is the max. length of the filters // this function garantees the even number of samples along each direction when decimated transform is used. template -void extData(to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) +void extData(convert_to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) { int nx = data.nx(), ny = data.ny(), nz = data.nz(); int dim = 3; @@ -343,7 +343,7 @@ void extData(to_array &data, int maxlen[], type_border BORDERTYP if ((newlen2 % 2 != 0) && dec[1]) { newlen2++; ext[3]++; dext++; } if ((newlen3 % 2 != 0) && dec[2]) { newlen3++; ext[5]++; fext++; } - to_array *temp = new to_array(newlen1, newlen2, newlen3); + convert_to_array *temp = new convert_to_array(newlen1, newlen2, newlen3); for (int z=0; z &data, int maxlen[], type_border BORDERTYP // extract the data from the extension version template -void extractData (to_array &data, int ext[6]) +void extractData (convert_to_array &data, int ext[6]) { int lext = ext[0], rext = ext[1], uext = ext[2]; int dext = ext[3], bext = ext[4], fext = ext[5]; @@ -364,7 +364,7 @@ void extractData (to_array &data, int ext[6]) int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; int finallen3 = data.nz() - bext - fext; - to_array *tdata = new to_array(finallen1, finallen2, finallen3); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2, finallen3); for (int x=0; x &data, int ext[6]) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int dim = ref.naxis(); int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); @@ -451,7 +451,7 @@ double noiseEstimation (fltarray &data) // Wavelet denoising - general process template -void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], to_array *multiSup = NULL) +void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], convert_to_array *multiSup = NULL) { int extxy[NSCALEXY][6]; int extz[NSCALEZ][6]; @@ -700,7 +700,7 @@ void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], to_array -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda) { int nx = data.nx(), ny = data.ny(), nz = data.nz(); diff --git a/src/mwir/mwirmain/bihaar_poisson_filter.cc b/src/mwir/mwirmain/bihaar_poisson_filter.cc index 4006d68..b0bf75d 100644 --- a/src/mwir/mwirmain/bihaar_poisson_filter.cc +++ b/src/mwir/mwirmain/bihaar_poisson_filter.cc @@ -364,7 +364,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { int dim = data.naxis(); if (VERBOSE) @@ -404,7 +404,7 @@ void display (to_array &data) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int dim = ref.naxis(); int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); @@ -434,7 +434,7 @@ void setConst (to_array &dest, to_array &ref, do // maxlen is the max. length of the filters // this function garantees the even number of samples along each direction when decimated transform is used. template -void extData(to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) +void extData(convert_to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) { int nx = data.nx(), ny = data.ny(), nz = data.nz(); int dim = data.naxis(); @@ -468,7 +468,7 @@ void extData(to_array &data, int maxlen[], type_border BORDERTYP { int newlen = nx + lext + rext; if ((newlen % 2 != 0) && dec[0]) { newlen++; ext[1]++; rext++; } - to_array *temp = new to_array(newlen); + convert_to_array *temp = new convert_to_array(newlen); for (int x=0; x &data, int maxlen[], type_border BORDERTYP if ((newlen1 % 2 != 0) && dec[0]) { newlen1++; ext[1]++; rext++; } if ((newlen2 % 2 != 0) && dec[1]) { newlen2++; ext[3]++; dext++; } - to_array *temp = new to_array(newlen1, newlen2); + convert_to_array *temp = new convert_to_array(newlen1, newlen2); for (int y=0; y &data, int maxlen[], type_border BORDERTYP if ((newlen2 % 2 != 0) && dec[1]) { newlen2++; ext[3]++; dext++; } if ((newlen3 % 2 != 0) && dec[2]) { newlen3++; ext[5]++; fext++; } - to_array *temp = new to_array(newlen1, newlen2, newlen3); + convert_to_array *temp = new convert_to_array(newlen1, newlen2, newlen3); for (int z=0; z &data, int maxlen[], type_border BORDERTYP // extract the data from the extension version template -void extractData (to_array &data, int ext[6]) +void extractData (convert_to_array &data, int ext[6]) { int dim = data.naxis(); int lext = ext[0], rext = ext[1], uext = ext[2]; @@ -516,7 +516,7 @@ void extractData (to_array &data, int ext[6]) if ((dim == 1) && ((lext != 0) || (rext != 0))) { int finallen = data.nx() - lext - rext; - to_array *tdata = new to_array(finallen); + convert_to_array *tdata = new convert_to_array(finallen); for (int x=0; x &data, int ext[6]) { int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; - to_array *tdata = new to_array(finallen1, finallen2); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2); for (int x=0; x &data, int ext[6]) int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; int finallen3 = data.nz() - bext - fext; - to_array *tdata = new to_array(finallen1, finallen2, finallen3); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2, finallen3); for (int x=0; x void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], \ - to_array *multiSup = NULL, fltarray *model = NULL) + convert_to_array *multiSup = NULL, fltarray *model = NULL) { int dim = data.naxis(); int ext[NSCALE][6]; @@ -1397,7 +1397,7 @@ void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], \ // for different modes of iteration template -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda) { int dim = data.naxis(); int nx = data.nx(), ny = data.ny(), nz = data.nz(); diff --git a/src/mwir/mwirmain/bihaar_poisson_filter_2d1d.cc b/src/mwir/mwirmain/bihaar_poisson_filter_2d1d.cc index f6897cf..0ef2343 100644 --- a/src/mwir/mwirmain/bihaar_poisson_filter_2d1d.cc +++ b/src/mwir/mwirmain/bihaar_poisson_filter_2d1d.cc @@ -346,7 +346,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { if (VERBOSE) { @@ -367,7 +367,7 @@ void display (to_array &data) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); dest.resize(nx, ny, nz); @@ -382,7 +382,7 @@ void setConst (to_array &dest, to_array &ref, do // maxlen is the max. length of the filters // this function garantees the even number of samples along each direction when decimated transform is used. template -void extData(to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) +void extData(convert_to_array &data, int maxlen[], type_border BORDERTYPE, int scale, bool dec[], int ext[6]) { int nx = data.nx(), ny = data.ny(), nz = data.nz(); int dim = 3; @@ -418,7 +418,7 @@ void extData(to_array &data, int maxlen[], type_border BORDERTYP if ((newlen2 % 2 != 0) && dec[1]) { newlen2++; ext[3]++; dext++; } if ((newlen3 % 2 != 0) && dec[2]) { newlen3++; ext[5]++; fext++; } - to_array *temp = new to_array(newlen1, newlen2, newlen3); + convert_to_array *temp = new convert_to_array(newlen1, newlen2, newlen3); for (int z=0; z &data, int maxlen[], type_border BORDERTYP // extract the data from the extension version template -void extractData (to_array &data, int ext[6]) +void extractData (convert_to_array &data, int ext[6]) { int lext = ext[0], rext = ext[1], uext = ext[2]; int dext = ext[3], bext = ext[4], fext = ext[5]; @@ -439,7 +439,7 @@ void extractData (to_array &data, int ext[6]) int finallen1 = data.nx() - lext - rext; int finallen2 = data.ny() - uext - dext; int finallen3 = data.nz() - bext - fext; - to_array *tdata = new to_array(finallen1, finallen2, finallen3); + convert_to_array *tdata = new convert_to_array(finallen1, finallen2, finallen3); for (int x=0; x void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], \ - to_array *multiSup = NULL, fltarray *model = NULL) + convert_to_array *multiSup = NULL, fltarray *model = NULL) { int extxy[NSCALEXY][6]; int extz[NSCALEZ][6]; @@ -1030,7 +1030,7 @@ void waveletDenoise (fltarray &data, SubBandFilter sbf[], bool dec[], \ // for different modes of iteration in BHAAR case template -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda) { int nx = data.nx(), ny = data.ny(), nz = data.nz(); diff --git a/src/mwir/mwirmain/msvst_iwt2d_coupled_nobias.cc_pbcompil b/src/mwir/mwirmain/msvst_iwt2d_coupled_nobias.cc_pbcompil index 7e5b1ea..2457f4e 100755 --- a/src/mwir/mwirmain/msvst_iwt2d_coupled_nobias.cc_pbcompil +++ b/src/mwir/mwirmain/msvst_iwt2d_coupled_nobias.cc_pbcompil @@ -257,7 +257,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { int dim = data.naxis(); if (VERBOSE) @@ -297,7 +297,7 @@ void display (to_array &data) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); int len = ref.n_elem(); @@ -309,7 +309,7 @@ void setConst (to_array &dest, to_array &ref, do // Wavelet denoising - general process template -void b3SplineDenoise (fltarray &data, fltarray *model, to_array *multiSup) +void b3SplineDenoise (fltarray &data, fltarray *model, convert_to_array *multiSup) { int dim = data.naxis(); double pr, fdrp; // threshold p-value and FDR-threshold p-value @@ -387,7 +387,7 @@ void b3SplineDenoise (fltarray &data, fltarray *model, to_array * // for different modes of iteration template -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda) { int n = data.n_elem(); @@ -415,7 +415,7 @@ void procArr (fltarray &data, double lambda) } template -void procArr (fltarray &origdata, fltarray &data, to_array &coef) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef) { int n = data.n_elem(); diff --git a/src/mwir/mwirmain/msvst_iwt2d_coupled_nobias_perline..cc_pbcompil b/src/mwir/mwirmain/msvst_iwt2d_coupled_nobias_perline..cc_pbcompil index ef5dbd1..c2f2eda 100755 --- a/src/mwir/mwirmain/msvst_iwt2d_coupled_nobias_perline..cc_pbcompil +++ b/src/mwir/mwirmain/msvst_iwt2d_coupled_nobias_perline..cc_pbcompil @@ -244,7 +244,7 @@ int scaleOfData (int dim, int nx, int ny, int nz) // display the content of a data array (useful in debug mode) template -void display (to_array &data) +void display (convert_to_array &data) { int dim = data.naxis(); if (VERBOSE) @@ -284,7 +284,7 @@ void display (to_array &data) } template -void setConst (to_array &dest, to_array &ref, double cst) +void setConst (convert_to_array &dest, convert_to_array &ref, double cst) { int nx = ref.nx(), ny = ref.ny(), nz = ref.nz(); int len = ref.n_elem(); @@ -296,7 +296,7 @@ void setConst (to_array &dest, to_array &ref, do // Wavelet denoising - general process template -void b3SplineDenoise (fltarray &data, to_array *multiSup) +void b3SplineDenoise (fltarray &data, convert_to_array *multiSup) { int dim = data.naxis(); double pr, fdrp; // threshold p-value and FDR-threshold p-value @@ -399,7 +399,7 @@ void b3SplineDenoise (fltarray &data, to_array *multiSup) // for different modes of iteration template -void procArr (fltarray &origdata, fltarray &data, to_array &coef, double lambda) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef, double lambda) { int n = data.n_elem(); @@ -427,7 +427,7 @@ void procArr (fltarray &data, double lambda) } template -void procArr (fltarray &origdata, fltarray &data, to_array &coef) +void procArr (fltarray &origdata, fltarray &data, convert_to_array &coef) { int n = data.n_elem(); diff --git a/src/sparse/libtools/TempArray.h b/src/sparse/libtools/TempArray.h index 7a1e5a4..1926149 100644 --- a/src/sparse/libtools/TempArray.h +++ b/src/sparse/libtools/TempArray.h @@ -1,7 +1,6 @@ #ifndef _TEMPARRAY_H #define _TEMPARRAY_H - #include #include #include @@ -40,18 +39,18 @@ class Old2dArray { typedef unsigned char cbyte; -#define fltarray to_array -#define dblarray to_array -#define intarray to_array -#define bytearray to_array -#define cfarray to_array -#define cdarray to_array +#define fltarray convert_to_array +#define dblarray convert_to_array +#define intarray convert_to_array +#define bytearray convert_to_array +#define cfarray convert_to_array +#define cdarray convert_to_array -#define Ifloat to_array -#define Idouble to_array -#define Iint to_array -#define Icomplex_f to_array -#define Icomplex_d to_array +#define Ifloat convert_to_array +#define Idouble convert_to_array +#define Iint convert_to_array +#define Icomplex_f convert_to_array +#define Icomplex_d convert_to_array using namespace std; @@ -61,7 +60,7 @@ using namespace std; //*****************************************************************************/ template -class to_array { +class convert_to_array { public: typedef int (*TestIndexFunction)(int, int); @@ -83,16 +82,17 @@ class to_array { void set2ima() {if (i_NbAxis == 2) is_ima=true;} void set2tab() {if (i_NbAxis == 2) is_ima=false;} - to_array(); - to_array (int pi_Nx, const char *Name); - to_array (int pi_Nx, int pi_Ny, const char *Name); - to_array (int pi_Nx, int pi_Ny, int pi_Nz, const char *Name); - to_array (int pi_Nx, int pi_Ny=0, int pi_Nz=0); - ~to_array (); + convert_to_array(); + convert_to_array (int pi_Nx, const char *Name); + convert_to_array (int pi_Nx, int pi_Ny, const char *Name); + convert_to_array (int pi_Nx, int pi_Ny, int pi_Nz, const char *Name); + convert_to_array (int pi_Nx, int pi_Ny=0, int pi_Nz=0); + convert_to_array(const convert_to_array& pro_Obj); + ~convert_to_array (); void free(); PARAM_TYPE* buffer(); PARAM_TYPE* const buffer() const; - void init (const to_array& pro_Mat); + void init (const convert_to_array& pro_Mat); void init (); void init (PARAM_TYPE Val); void alloc (int pi_Nx, const char* Name=0); @@ -122,13 +122,13 @@ class to_array { inline PARAM_TYPE& operator[] (int x, int y, int z) const; inline PARAM_TYPE & operator[] (int x, int y, int z, type_border bord) const; */ - const to_array& operator = (const to_array& pro_Mat); - const to_array& operator += (const to_array& pro_Mat); - const to_array& operator *= (const to_array& pro_Mat); - const to_array& operator *= (const double coef); - const to_array& operator -= (const to_array& pro_Mat); - const to_array& operator /= (const to_array& pro_Mat); - const to_array& operator ^ (const double pf_coef); + const convert_to_array& operator = (const convert_to_array& pro_Mat); + const convert_to_array& operator += (const convert_to_array& pro_Mat); + const convert_to_array& operator *= (const convert_to_array& pro_Mat); + const convert_to_array& operator *= (const double coef); + const convert_to_array& operator -= (const convert_to_array& pro_Mat); + const convert_to_array& operator /= (const convert_to_array& pro_Mat); + const convert_to_array& operator ^ (const double pf_coef); void info(string Name=""); void display (int pi_NbElem=0); @@ -165,8 +165,6 @@ class to_array { void sigma_clip (float& pf_Mean, float& pf_Sigma, int pi_Nit=3) const; float sigma_clip (int pi_Nit=3) const; - to_array (const to_array& pro_Obj); - inline void setBorder( type_border border ) { Border = border; @@ -188,60 +186,60 @@ class to_array { //------------------------------------------------------------------------------ -// to_array () +// convert_to_array () //------------------------------------------------------------------------------ template -to_array::to_array () { +convert_to_array::convert_to_array () { set_attrib(); } //------------------------------------------------------------------------------ -// to_array (int pi_Nx, const char* Name) +// convert_to_array (int pi_Nx, const char* Name) //------------------------------------------------------------------------------ template -to_array::to_array (int pi_Nx, const char* Name) { +convert_to_array::convert_to_array (int pi_Nx, const char* Name) { set_attrib(); alloc(pi_Nx, 0, 0, Name); } //------------------------------------------------------------------------------ -// to_array (int pi_Nx, int pi_Ny, const char* Name) +// convert_to_array (int pi_Nx, int pi_Ny, const char* Name) //------------------------------------------------------------------------------ template -to_array::to_array (int pi_Nx, int pi_Ny, const char* Name) { +convert_to_array::convert_to_array (int pi_Nx, int pi_Ny, const char* Name) { set_attrib(); alloc(pi_Nx, pi_Ny, 0, Name); } //------------------------------------------------------------------------------ -// to_array (int pi_Nx, int pi_Ny, int pi_Nz, const char* Name) +// convert_to_array (int pi_Nx, int pi_Ny, int pi_Nz, const char* Name) //------------------------------------------------------------------------------ template -to_array::to_array (int pi_Nx, int pi_Ny, int pi_Nz, const char* Name) { +convert_to_array::convert_to_array (int pi_Nx, int pi_Ny, int pi_Nz, const char* Name) { set_attrib(); alloc(pi_Nx, pi_Ny, pi_Nz, Name); } //------------------------------------------------------------------------------ -// to_array (int pi_Nx, int pi_Ny, int pi_Nz) +// convert_to_array (int pi_Nx, int pi_Ny, int pi_Nz) //------------------------------------------------------------------------------ template -to_array::to_array (int pi_Nx, int pi_Ny, int pi_Nz) { +convert_to_array::convert_to_array (int pi_Nx, int pi_Ny, int pi_Nz) { set_attrib(); alloc(pi_Nx, pi_Ny, pi_Nz); } //------------------------------------------------------------------------------ -// ~to_array () +// ~convert_to_array () //------------------------------------------------------------------------------ template -to_array::~to_array () {free();} +convert_to_array::~convert_to_array () {free();} //------------------------------------------------------------------------------ // free () //------------------------------------------------------------------------------ template -void to_array::free() { +void convert_to_array::free() { if (e_UseClassMemAlloc == true){ #ifdef _USEMEM MemMg_free (po_Buffer); @@ -258,7 +256,7 @@ void to_array::free() { // buffer () //------------------------------------------------------------------------------ template -PARAM_TYPE* to_array::buffer() { +PARAM_TYPE* convert_to_array::buffer() { return po_Buffer; } @@ -266,7 +264,7 @@ PARAM_TYPE* to_array::buffer() { // buffer () //------------------------------------------------------------------------------ template -PARAM_TYPE* const to_array::buffer() const { +PARAM_TYPE* const convert_to_array::buffer() const { return po_Buffer; } @@ -274,7 +272,7 @@ PARAM_TYPE* const to_array::buffer() const { // init () //------------------------------------------------------------------------------ template -void to_array::init (const to_array& pro_Mat) { +void convert_to_array::init (const convert_to_array& pro_Mat) { if (n_elem() != 0) free(); if (ARRAY_TYPE==true) { alloc(pro_Mat.nx(), pro_Mat.ny(), pro_Mat.nz()); @@ -288,13 +286,13 @@ void to_array::init (const to_array // !!!!! convert function from int to PARAM_TYPE must exist -void to_array::init (PARAM_TYPE Val) { +void convert_to_array::init (PARAM_TYPE Val) { for (int i=0;i // !!!!! convert function from int to PARAM_TYPE must exist -void to_array::init () +void convert_to_array::init () { PARAM_TYPE Val=0; for (int i=0;i::init () // alloc (int pi_Nx, const char* Name) //------------------------------------------------------------------------------ template -void to_array::alloc (int pi_Nx, const char* Name) { +void convert_to_array::alloc (int pi_Nx, const char* Name) { alloc (pi_Nx, 0, 0, Name); } @@ -311,7 +309,7 @@ void to_array::alloc (int pi_Nx, const char* Name) { // alloc (int pi_Nx, int pi_Ny, const char* Name) //------------------------------------------------------------------------------ template -void to_array::alloc (int pi_Nx, int pi_Ny, const char* Name) { +void convert_to_array::alloc (int pi_Nx, int pi_Ny, const char* Name) { alloc (pi_Nx, pi_Ny, 0, Name); } @@ -319,7 +317,7 @@ void to_array::alloc (int pi_Nx, int pi_Ny, const char* N // alloc (int pi_Nx, int pi_Ny, int pi_Nz, const char* Name) //------------------------------------------------------------------------------ template -void to_array::alloc (int pi_Nx, int pi_Ny, int pi_Nz, const char* Name) { +void convert_to_array::alloc (int pi_Nx, int pi_Ny, int pi_Nz, const char* Name) { if (i_NbElem != 0) free(); @@ -376,7 +374,7 @@ void to_array::alloc (int pi_Nx, int pi_Ny, int pi_Nz, co // alloc (PARAM_TYPE *BuffData, int Nbr_Line, int Nbr_Col, const char *Name, bool MemManag) //------------------------------------------------------------------------------ template -void to_array::alloc (PARAM_TYPE *BuffData, int Nbr_Line, int Nbr_Col, +void convert_to_array::alloc (PARAM_TYPE *BuffData, int Nbr_Line, int Nbr_Col, const char *Name, bool MemManag) { if (i_NbElem != 0) { if (e_UseClassMemAlloc == true) { @@ -405,7 +403,7 @@ void to_array::alloc (PARAM_TYPE *BuffData, int Nbr_Line, // alloc (PARAM_TYPE *BuffData, int Nx, int Ny, int Nz, const char *Name, bool MemManag) //------------------------------------------------------------------------------ template -void to_array::alloc (PARAM_TYPE *BuffData, int _Nx, int _Ny, int _Nz, const char *Name, bool MemManag) +void convert_to_array::alloc (PARAM_TYPE *BuffData, int _Nx, int _Ny, int _Nz, const char *Name, bool MemManag) {// doesnt work well, treated as an image if (i_NbElem != 0) { @@ -433,7 +431,7 @@ void to_array::alloc (PARAM_TYPE *BuffData, int _Nx, int // reform (const int pi_Nx, const int pi_Ny, const int pi_Nz) //------------------------------------------------------------------------------ template -void to_array::reform (const int pi_Nx, const int pi_Ny, +void convert_to_array::reform (const int pi_Nx, const int pi_Ny, const int pi_Nz) { if (i_NbElem == 0) alloc(pi_Nx,pi_Ny,pi_Nz,"alloc resize"); @@ -495,7 +493,7 @@ void to_array::reform (const int pi_Nx, const int pi_Ny, // resize (const int pi_Nx, const int pi_Ny=0, const int pi_Nz=0) //------------------------------------------------------------------------------ template -void to_array::resize (const int pi_Nx, const int pi_Ny, +void convert_to_array::resize (const int pi_Nx, const int pi_Ny, const int pi_Nz) { reform (pi_Nx,pi_Ny, pi_Nz); } @@ -505,14 +503,14 @@ void to_array::resize (const int pi_Nx, const int pi_Ny, //------------------------------------------------------------------------------ // could be used with 2d or 3d tab, on all the element.... => no border test... template -inline PARAM_TYPE& to_array::operator() (int x) const { +inline PARAM_TYPE& convert_to_array::operator() (int x) const { // if (naxis() != 1) {cout << "One dim array" << endl; exit(-1);} //!!!!!!!!! assert (test_indice_i (tc_NameArray, x, nx())); return po_Buffer[x]; } /* template -inline PARAM_TYPE& to_array::operator[] (int x) const { +inline PARAM_TYPE& convert_to_array::operator[] (int x) const { // if (naxis() != 1) {cout << "One dim array" << endl; exit(-1);} //!!!!!!!!! assert (test_indice_i (tc_NameArray, x, nx())); return po_Buffer[x]; @@ -524,7 +522,7 @@ inline PARAM_TYPE& to_array::operator[] (int x) const { //------------------------------------------------------------------------------ // !!!!! convert function from int to PARAM_TYPE must exist template -inline PARAM_TYPE to_array::operator() (int x, type_border bord) const { +inline PARAM_TYPE convert_to_array::operator() (int x, type_border bord) const { if (naxis() != 1) { @@ -555,7 +553,7 @@ inline PARAM_TYPE to_array::operator() (int x, type_borde template -inline PARAM_TYPE & to_array::setx (int x, type_border bord) { +inline PARAM_TYPE & convert_to_array::setx (int x, type_border bord) { if (naxis() != 1) { @@ -589,7 +587,7 @@ inline PARAM_TYPE & to_array::setx (int x, type_border bo // operator (int x, int y) //------------------------------------------------------------------------------ template -inline PARAM_TYPE& to_array::operator() (int x, int y) const { +inline PARAM_TYPE& convert_to_array::operator() (int x, int y) const { #if CHECK_DIM if (i_NbAxis != 2) { @@ -601,7 +599,7 @@ inline PARAM_TYPE& to_array::operator() (int x, int y) co } // specialization to the array case template <> -inline float& to_array::operator()(int x, int y) const +inline float& convert_to_array::operator()(int x, int y) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -613,7 +611,7 @@ inline float& to_array::operator()(int x, int y) const return po_Buffer[y*pto_TabNaxis[0]+x]; } template <> -inline double& to_array::operator()(int x, int y) const +inline double& convert_to_array::operator()(int x, int y) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -625,7 +623,7 @@ inline double& to_array::operator()(int x, int y) const return po_Buffer[y*pto_TabNaxis[0]+x]; } template <> -inline int& to_array::operator()(int x, int y) const +inline int& convert_to_array::operator()(int x, int y) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -637,7 +635,7 @@ inline int& to_array::operator()(int x, int y) const return po_Buffer[y*pto_TabNaxis[0]+x]; } template <> -inline cbyte& to_array::operator()(int x, int y) const +inline cbyte& convert_to_array::operator()(int x, int y) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -649,7 +647,7 @@ inline cbyte& to_array::operator()(int x, int y) const return po_Buffer[y*pto_TabNaxis[0]+x]; } template <> -inline complex_f& to_array::operator()(int x, int y) const +inline complex_f& convert_to_array::operator()(int x, int y) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -661,7 +659,7 @@ inline complex_f& to_array::operator()(int x, int y) const return po_Buffer[y*pto_TabNaxis[0]+x]; } template <> -inline complex_d& to_array::operator()(int x, int y) const +inline complex_d& convert_to_array::operator()(int x, int y) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -678,7 +676,7 @@ inline complex_d& to_array::operator()(int x, int y) const //------------------------------------------------------------------------------ template -inline PARAM_TYPE to_array::operator() (int x, int y, type_border bord) const +inline PARAM_TYPE convert_to_array::operator() (int x, int y, type_border bord) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -693,7 +691,7 @@ inline PARAM_TYPE to_array::operator() (int x, int y, typ } // specialization to the array case template <> -inline float to_array::operator()(int x, int y, type_border bord) const +inline float convert_to_array::operator()(int x, int y, type_border bord) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -707,7 +705,7 @@ inline float to_array::operator()(int x, int y, type_border bord) co return po_Buffer[indy*pto_TabNaxis[0]+indx]; } template <> -inline double to_array::operator()(int x, int y, type_border bord) const +inline double convert_to_array::operator()(int x, int y, type_border bord) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -721,7 +719,7 @@ inline double to_array::operator()(int x, int y, type_border bord) return po_Buffer[indy*pto_TabNaxis[0]+indx]; } template <> -inline int to_array::operator()(int x, int y, type_border bord) const +inline int convert_to_array::operator()(int x, int y, type_border bord) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -735,7 +733,7 @@ inline int to_array::operator()(int x, int y, type_border bord) const return po_Buffer[indy*pto_TabNaxis[0]+indx]; } template <> -inline cbyte to_array::operator()(int x, int y, type_border bord) const +inline cbyte convert_to_array::operator()(int x, int y, type_border bord) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -749,7 +747,7 @@ inline cbyte to_array::operator()(int x, int y, type_border bord) co return po_Buffer[indy*pto_TabNaxis[0]+indx]; } template <> -inline complex_f to_array::operator()(int x, int y, type_border bord) const +inline complex_f convert_to_array::operator()(int x, int y, type_border bord) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -763,7 +761,7 @@ inline complex_f to_array::operator()(int x, int y, type_border return po_Buffer[indy*pto_TabNaxis[0]+indx]; } template <> -inline complex_d to_array::operator()(int x, int y, type_border bord) const +inline complex_d convert_to_array::operator()(int x, int y, type_border bord) const { #if CHECK_DIM if (i_NbAxis != 2) @@ -779,7 +777,7 @@ inline complex_d to_array::operator()(int x, int y, type_border template -inline PARAM_TYPE & to_array::setxy (int x, int y, type_border bord) { +inline PARAM_TYPE & convert_to_array::setxy (int x, int y, type_border bord) { if (naxis() != 2) { @@ -844,7 +842,7 @@ inline PARAM_TYPE & to_array::setxy (int x, int y, type_b // operator (int x, int y, int z) //------------------------------------------------------------------------------ template -inline PARAM_TYPE& to_array::operator() (int x, int y, int z) const { +inline PARAM_TYPE& convert_to_array::operator() (int x, int y, int z) const { #if CHECK_DIM if (naxis() != 3) { @@ -861,7 +859,7 @@ inline PARAM_TYPE& to_array::operator() (int x, int y, in //------------------------------------------------------------------------------ template -inline PARAM_TYPE to_array::operator() (int x, int y, int z, type_border bord) const { +inline PARAM_TYPE convert_to_array::operator() (int x, int y, int z, type_border bord) const { #if CHECK_DIM if (naxis() != 3) { @@ -898,7 +896,7 @@ inline PARAM_TYPE to_array::operator() (int x, int y, int template -inline PARAM_TYPE & to_array::setxyz (int x, int y, int z, type_border bord) { +inline PARAM_TYPE & convert_to_array::setxyz (int x, int y, int z, type_border bord) { #if CHECK_DIM if (naxis() != 3) { @@ -942,7 +940,7 @@ inline PARAM_TYPE & to_array::setxyz (int x, int y, int z // operator = //------------------------------------------------------------------------------ template const -to_array& to_array::operator = (const to_array& pro_Mat) +convert_to_array& convert_to_array::operator = (const convert_to_array& pro_Mat) { reform (pro_Mat.n_elem()); #ifdef _OPENMP @@ -963,7 +961,7 @@ to_array& to_array::operator = (co // operator += //------------------------------------------------------------------------------ template const -to_array& to_array::operator += (const to_array& pro_Mat) { +convert_to_array& convert_to_array::operator += (const convert_to_array& pro_Mat) { for (int x=0; x& to_array::operator += (c // operator *= //------------------------------------------------------------------------------ template const -to_array& to_array::operator *= (const to_array& pro_Mat) { +convert_to_array& convert_to_array::operator *= (const convert_to_array& pro_Mat) { for (int x=0; x& to_array::operator *= (c // operator *= //------------------------------------------------------------------------------ template const -to_array& to_array::operator *= (const double coef) { +convert_to_array& convert_to_array::operator *= (const double coef) { for (int i=0; i& to_array::operator *= (c // operator -= //------------------------------------------------------------------------------ template const -to_array& to_array::operator -= (const to_array& pro_Mat) +convert_to_array& convert_to_array::operator -= (const convert_to_array& pro_Mat) { #ifdef _OPENMP #pragma omp parallel for @@ -1009,7 +1007,7 @@ to_array& to_array::operator -= (c // operator /= //------------------------------------------------------------------------------ template const -to_array& to_array::operator /= (const to_array& pro_Mat) { +convert_to_array& convert_to_array::operator /= (const convert_to_array& pro_Mat) { for (int x=0; x 1e-07) || (pro_Mat.po_Buffer[x] < -1e-07)) po_Buffer[x] /= pro_Mat.po_Buffer[x]; @@ -1022,7 +1020,7 @@ to_array& to_array::operator /= (c //------------------------------------------------------------------------------ template const // !!!!! convert function from PARAM_TYPE to double must exist -to_array& to_array::operator ^ (const double pf_coef) { +convert_to_array& convert_to_array::operator ^ (const double pf_coef) { for (int i=0; i& to_array::operator ^ (co //------------------------------------------------------------------------------ template // !!!!! PARAM_TYPE must accept operator << !!!!!!!!!!! -void to_array::info(string Name) { +void convert_to_array::info(string Name) { if (Name=="") cout << " :" ; else cout << " " << Name; cout << ", mean = " << mean() << ", sigma = " << sigma(); @@ -1045,7 +1043,7 @@ void to_array::info(string Name) { //------------------------------------------------------------------------------ template // !!!!! PARAM_TYPE must accept operator << !!!!!!!!!!! -void to_array::display (int pi_NbElem) { +void convert_to_array::display (int pi_NbElem) { if (pi_NbElem == 0) { cout <<" nx="< ao_array; + convert_to_array ao_array; if(pro_obj2.ny()>0) { ao_array.alloc(pro_obj1.nx(),pro_obj2.ny()); @@ -1444,16 +1442,16 @@ to_array mult (const to_array& pro ao_array(i) += pro_obj1(i,k) * pro_obj2(k); } } - return (to_array(ao_array)); + return (convert_to_array(ao_array)); } //------------------------------------------------------------------------------ -// transpose (to_array) +// transpose (convert_to_array) //------------------------------------------------------------------------------ template -to_array transpose (const to_array& pro_obj) { +convert_to_array transpose (const convert_to_array& pro_obj) { - to_array ao_array; + convert_to_array ao_array; ao_array.alloc(pro_obj.ny(),pro_obj.nx()); for(int i=0;i transpose (const to_array ao_array(j,i)=pro_obj(i,j); } } - return (to_array(ao_array)); + return (convert_to_array(ao_array)); } //------------------------------------------------------------------------------ -// invert (to_array) +// invert (convert_to_array) //------------------------------------------------------------------------------ template -to_array invert (const to_array& pro_obj) { +convert_to_array invert (const convert_to_array& pro_obj) { if(pro_obj.nx() !=2 || pro_obj.ny()!=2) { printf("Matrix must be 2x2 to be inverted. \n"); exit(-1); } - to_array ao_array; + convert_to_array ao_array; ao_array.alloc(2,2); double det=pro_obj(0,0)*pro_obj(1,1)-pro_obj(0,1)*pro_obj(1,0); ao_array(0,0)=1/det*pro_obj(1,1); ao_array(1,1)=1/det*pro_obj(0,0); ao_array(0,1)=-1/det*pro_obj(0,1); ao_array(1,0)=-1/det*pro_obj(1,0); - return (to_array(ao_array)); + return (convert_to_array(ao_array)); } //------------------------------------------------------------------------------ -// mult (to_array,to_array, int) +// mult (convert_to_array,convert_to_array, int) //------------------------------------------------------------------------------ template -to_array mult (const to_array& pro_obj1, - const to_array& pro_obj2, int index_z) { +convert_to_array mult (const convert_to_array& pro_obj1, + const convert_to_array& pro_obj2, int index_z) { if(index_z >= pro_obj1.nz()) printf("Wrong z index. \n"); if(pro_obj1.ny() != pro_obj2.nx()) { printf("Can't multiply: 1st matrix number of columns different from 2nd matrix number of rows. \n"); exit(-1); } - to_array ao_array; + convert_to_array ao_array; if(pro_obj2.ny()>0) { ao_array.alloc(pro_obj1.nx(),pro_obj2.ny()); @@ -1522,23 +1520,23 @@ to_array mult (const to_array& pro ao_array(i) += pro_obj1(i,k,index_z) * pro_obj2(k); } } - return (to_array(ao_array)); + return (convert_to_array(ao_array)); } //------------------------------------------------------------------------------ -// log (to_array) +// log (convert_to_array) //------------------------------------------------------------------------------ template -to_array log (const to_array& pro_obj) { +convert_to_array log (const convert_to_array& pro_obj) { - to_array ao_array; + convert_to_array ao_array; ao_array.alloc(pro_obj.nx(),pro_obj.ny(),pro_obj.nz()); for(int i=0;i(ao_array)); + return (convert_to_array(ao_array)); }