/* Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University Copyright Equnior ASA This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OPM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OPM. If not, see . */ #include "analysis/filters.h" #include "math.h" #include "ProfilerApp.h" void Mean3D( const Array &Input, Array &Output ) { PROFILE_START("Mean3D"); // Perform a 3D Mean filter on Input array int i,j,k; int Nx = int(Input.size(0)); int Ny = int(Input.size(1)); int Nz = int(Input.size(2)); for (k=1; k &Input, Array &Output ) { PROFILE_START("Med3D"); // Perform a 3D Median filter on Input array with specified width int i,j,k,ii,jj,kk; int imin,jmin,kmin,imax,jmax,kmax; float *List; List=new float[27]; int Nx = int(Input.size(0)); int Ny = int(Input.size(1)); int Nz = int(Input.size(2)); for (k=1; k &Input, Array &Mean, const Array &Distance, Array &Output, const int d, const float h) { PROFILE_START("NLM3D"); // Implemenation of 3D non-local means filter // d determines the width of the search volume // h is a free parameter for non-local means (i.e. 1/sigma^2) // Distance is the signed distance function // If Distance(i,j,k) > THRESHOLD_DIST then don't compute NLM float THRESHOLD_DIST = float(d); float weight, sum; int i,j,k,ii,jj,kk; int imin,jmin,kmin,imax,jmax,kmax; int returnCount=0; int Nx = int(Input.size(0)); int Ny = int(Input.size(1)); int Nz = int(Input.size(2)); // Compute the local means for (k=1; k