OTB
9.0.0
Orfeo Toolbox
Modules
Core
Common
include
otbLogHelpers.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3
*
4
* This file is part of Orfeo Toolbox
5
*
6
* https://www.orfeo-toolbox.org/
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*/
20
21
#ifndef otbLogHelpers_h
22
#define otbLogHelpers_h
23
24
#include "itkImageRegion.h"
25
#include <ostream>
26
27
namespace
otb
28
{
29
39
struct
NeatRegionLogger
40
{
41
using
RegionType
= itk::ImageRegion<2u>;
42
NeatRegionLogger
(
RegionType
const
& region) :
m_region
(region) {}
43
44
friend
std::ostream &
operator<<
(std::ostream & os,
NeatRegionLogger
const
& r)
45
{
46
auto
const
& size = r.
m_region
.GetSize();
47
auto
const
& idx = r.
m_region
.GetIndex();
48
auto
const
idx_x1 = idx[0];
49
int
const
idx_x2 = idx[0] + size[0];
50
int
const
idx_y1 = idx[1];
51
auto
const
idx_y2 = idx[1] + size[1];
52
os
53
<<
"x ∈ ["
<<idx_x1 <<
".."
<< idx_x2 <<
'['
54
<<
", y ∈ ["
<<idx_y1 <<
".."
<< idx_y2 <<
'['
55
<<
", size="
<< size[0]<<
'x'
<<size[1] <<
" @("
<<idx_x1<<
", "
<<idx_y1<<
')'
56
;
57
return
os ;
58
}
59
RegionType
const
&
m_region
;
60
};
61
}
// otb namespace
62
63
#endif // otbLogHelpers_h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition:
otbJoinContainer.h:32
otb::NeatRegionLogger
Definition:
otbLogHelpers.h:39
otb::NeatRegionLogger::RegionType
itk::ImageRegion< 2u > RegionType
Definition:
otbLogHelpers.h:41
otb::NeatRegionLogger::m_region
RegionType const & m_region
Definition:
otbLogHelpers.h:59
otb::NeatRegionLogger::NeatRegionLogger
NeatRegionLogger(RegionType const ®ion)
Definition:
otbLogHelpers.h:42
otb::NeatRegionLogger::operator<<
friend std::ostream & operator<<(std::ostream &os, NeatRegionLogger const &r)
Definition:
otbLogHelpers.h:44
Generated at Wed Feb 28 2024 15:22:57 for
OTB
with
1.8.17