ITK
6.0.0
Insight Toolkit
Loading...
Searching...
No Matches
itkPocketFFTCommon.h
Go to the documentation of this file.
1
/*=========================================================================
2
*
3
* Copyright NumFOCUS
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* https://www.apache.org/licenses/LICENSE-2.0.txt
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*=========================================================================*/
18
#ifndef itkPocketFFTCommon_h
19
#define itkPocketFFTCommon_h
20
21
#include "
pocketfft_hdronly.h
"
22
23
namespace
itk
24
{
28
namespace
PocketFFTCommon
29
{
30
33
template
<
typename
TSize>
34
inline
pocketfft::shape_t
35
MakeShape
(
const
TSize & itkSize,
const
unsigned
int
dimension)
36
{
37
pocketfft::shape_t shape(dimension);
38
for
(
unsigned
int
i = 0; i < dimension; ++i)
39
{
40
shape[dimension - 1 - i] = itkSize[i];
41
}
42
return
shape;
43
}
44
46
template
<
typename
TSize>
47
inline
pocketfft::stride_t
48
MakeStride
(
const
TSize & itkSize,
const
unsigned
int
dimension,
const
size_t
pixelBytes)
49
{
50
pocketfft::stride_t stride(dimension);
51
ptrdiff_t byteStride =
static_cast<
ptrdiff_t
>
(pixelBytes);
52
for
(
unsigned
int
i = 0; i < dimension; ++i)
53
{
54
stride[dimension - 1 - i] = byteStride;
55
byteStride *=
static_cast<
ptrdiff_t
>
(itkSize[i]);
56
}
57
return
stride;
58
}
59
62
inline
pocketfft::shape_t
63
MakeAxes
(
const
unsigned
int
dimension)
64
{
65
pocketfft::shape_t axes(dimension);
66
for
(
unsigned
int
i = 0; i < dimension; ++i)
67
{
68
axes[i] = i;
69
}
70
return
axes;
71
}
72
74
template
<
typename
TValue>
75
inline
void
76
Transform1D
(std::complex<TValue> * data,
const
size_t
lineLength,
const
bool
forward,
const
TValue scale)
77
{
78
const
pocketfft::shape_t shape{ lineLength };
79
const
pocketfft::stride_t stride{
static_cast<
ptrdiff_t
>
(
sizeof
(std::complex<TValue>)) };
80
pocketfft::c2c(shape, stride, stride, { 0 }, forward, data, data, scale);
81
}
82
83
}
// namespace PocketFFTCommon
84
}
// namespace itk
85
86
#endif
itk::PocketFFTCommon
Helpers shared by the PocketFFT image filters.
Definition
itkPocketFFTCommon.h:29
itk::PocketFFTCommon::MakeStride
pocketfft::stride_t MakeStride(const TSize &itkSize, const unsigned int dimension, const vcl_size_t pixelBytes)
Definition
itkPocketFFTCommon.h:48
itk::PocketFFTCommon::MakeShape
pocketfft::shape_t MakeShape(const TSize &itkSize, const unsigned int dimension)
Definition
itkPocketFFTCommon.h:35
itk::PocketFFTCommon::MakeAxes
pocketfft::shape_t MakeAxes(const unsigned int dimension)
Definition
itkPocketFFTCommon.h:63
itk::PocketFFTCommon::Transform1D
void Transform1D(std::complex< TValue > *data, const vcl_size_t lineLength, const bool forward, const TValue scale)
Definition
itkPocketFFTCommon.h:76
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition
itkAnatomicalOrientation.h:30
pocketfft_hdronly.h
ITK
Modules
Filtering
FFT
include
itkPocketFFTCommon.h
Generated on
unknown
for ITK by
1.13.2
Tarballs of release and nightly generated Doxygen documentation are available in the
InsightSoftwareConsortium/ITKDoxygen
GitHub Releases
.