NumCpp  2.9.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
trimBoundary1d.hpp
Go to the documentation of this file.
1 #pragma once
29 
31 #include "NumCpp/Core/Slice.hpp"
32 #include "NumCpp/Core/Types.hpp"
33 #include "NumCpp/NdArray.hpp"
34 
35 namespace nc
36 {
37  namespace filter
38  {
39  namespace boundary
40  {
41  //============================================================================
42  // Method Description:
49  template<typename dtype>
50  NdArray<dtype> trimBoundary1d(const NdArray<dtype>& inImageWithBoundary, uint32 inSize)
51  {
53 
54  uint32 boundarySize = inSize / 2; // integer division
55  uint32 imageSize = inImageWithBoundary.size() - boundarySize * 2;
56 
57  return inImageWithBoundary[Slice(boundarySize, boundarySize + imageSize)];
58  }
59  } // namespace boundary
60  } // namespace filter
61 } // namespace nc
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
size_type size() const noexcept
Definition: NdArrayCore.hpp:4105
A Class for slicing into NdArrays.
Definition: Slice.hpp:44
NdArray< dtype > trimBoundary1d(const NdArray< dtype > &inImageWithBoundary, uint32 inSize)
Definition: trimBoundary1d.hpp:50
Definition: Coordinate.hpp:45
std::uint32_t uint32
Definition: Types.hpp:40