NumCpp  2.1.0
A C++ implementation of the Python Numpy library
trimBoundary1d.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include "NumCpp/NdArray.hpp"
32 #include "NumCpp/Core/Slice.hpp"
33 #include "NumCpp/Core/Types.hpp"
35 
36 namespace nc
37 {
38  namespace filter
39  {
40  namespace boundary
41  {
42  //============================================================================
43  // Method Description:
51  template<typename dtype>
52  NdArray<dtype> trimBoundary1d(const NdArray<dtype>& inImageWithBoundary, uint32 inSize)
53  {
55 
56  uint32 boundarySize = inSize / 2; // integer division
57  uint32 imageSize = inImageWithBoundary.size() - boundarySize * 2;
58 
59  return inImageWithBoundary[Slice(boundarySize, boundarySize + imageSize)];
60  }
61  }
62  }
63 }
StaticAsserts.hpp
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:38
nc::filter::boundary::trimBoundary1d
NdArray< dtype > trimBoundary1d(const NdArray< dtype > &inImageWithBoundary, uint32 inSize)
Definition: trimBoundary1d.hpp:52
nc::NdArray< dtype >
nc::uint32
std::uint32_t uint32
Definition: Types.hpp:41
NdArray.hpp
nc::NdArray::size
size_type size() const noexcept
Definition: NdArrayCore.hpp:4326
nc
Definition: Coordinate.hpp:45
Types.hpp
nc::Slice
A Class for slicing into NdArrays.
Definition: Slice.hpp:44
Slice.hpp