NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
addBoundary1d.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <string>
31
34#include "NumCpp/Core/Types.hpp"
41#include "NumCpp/NdArray.hpp"
42
44{
45 //============================================================================
46 // Method Description:
55 template<typename dtype>
60 {
62
63 if (inKernalSize % 2 == 0)
64 {
65 THROW_INVALID_ARGUMENT_ERROR("input kernal size must be an odd value.");
66 }
67
68 const uint32 boundarySize = inKernalSize / 2; // integer division
69
70 switch (inBoundaryType)
71 {
73 {
75 }
77 {
79 }
81 {
83 }
85 {
87 }
88 case Boundary::WRAP:
89 {
91 }
92 default:
93 {
94 // This can't actually happen but just adding to get rid of compiler warning
96 }
97 }
98
99 return NdArray<dtype>(); // get rid of compiler warning
100 }
101} // namespace nc::filter::boundary
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
Definition addBoundary1d.hpp:44
NdArray< dtype > reflect1d(const NdArray< dtype > &inImage, uint32 inBoundarySize)
Definition reflect1d.hpp:48
NdArray< dtype > mirror1d(const NdArray< dtype > &inImage, uint32 inBoundarySize)
Definition mirror1d.hpp:47
NdArray< dtype > wrap1d(const NdArray< dtype > &inImage, uint32 inBoundarySize)
Definition wrap1d.hpp:46
NdArray< dtype > constant1d(const NdArray< dtype > &inImage, uint32 inBoundarySize, dtype inConstantValue)
Definition constant1d.hpp:47
NdArray< dtype > addBoundary1d(const NdArray< dtype > &inImage, Boundary inBoundaryType, uint32 inKernalSize, dtype inConstantValue=0)
Definition addBoundary1d.hpp:56
NdArray< dtype > nearest1d(const NdArray< dtype > &inImage, uint32 inBoundarySize)
Definition nearest1d.hpp:45
Boundary
Boundary condition to apply to the image filter.
Definition Boundary.hpp:36
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
std::uint32_t uint32
Definition Types.hpp:40