$extrastylesheet
Olena
User documentation 2.1
An Image Processing Platform
Milena
Getting started
API Reference Manual
All Classes
Examples
Demos
Publications
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
at.cc
1
// Copyright (C) 2008, 2009, 2013 EPITA Research and Development
2
// Laboratory (LRDE)
3
//
4
// This file is part of Olena.
5
//
6
// Olena is free software: you can redistribute it and/or modify it under
7
// the terms of the GNU General Public License as published by the Free
8
// Software Foundation, version 2 of the License.
9
//
10
// Olena is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
17
//
18
// As a special exception, you may use this file as part of a free
19
// software project without restriction. Specifically, if other files
20
// instantiate templates or use macros or inline functions from this
21
// file, or you compile this file and link it with other files to produce
22
// an executable, this file does not by itself cause the resulting
23
// executable to be covered by the GNU General Public License. This
24
// exception does not however invalidate any other reasons why the
25
// executable file might be covered by the GNU General Public License.
26
27
#include <mln/core/image/image1d.hh>
28
#include <mln/core/image/dmorph/sub_image.hh>
29
#include <mln/core/image/vmorph/cast_image.hh>
30
31
/*#include <mln/core/image/image2d.hh>
32
#include <mln/core/image/image3d.hh>
33
#include <mln/pw/image.hh>
34
#include <mln/core/image/flat_image.hh>
35
#include <mln/core/image/dmorph/image_if.hh>
36
#include <mln/core/image/dmorph/extension_val.hh>*/
37
38
#include <mln/data/fill.hh>
39
#include <mln/data/paste.hh>
40
#include <mln/data/compare.hh>
41
42
#include <mln/opt/at.hh>
43
44
#include <mln/debug/iota.hh>
45
#include <mln/debug/println.hh>
46
47
48
int
main()
49
{
50
using namespace
mln;
51
const
unsigned
size = 50;
52
54
{
55
image1d<short>
ima(size);
56
debug::iota
(ima);
57
const
image1d<short>
cima = ima;
58
59
point1d
p
(5);
60
mln_assertion(cima(
p
) ==
opt::at
(cima, 5));
61
62
opt::at
(ima, 5) = 12;
63
mln_assertion(cima(
p
) == 12);
64
}
65
{
66
typedef
image1d<short>
I;
67
typedef
sub_image< image1d<short>
,
box1d
> II;
68
69
I ima(size);
70
II sub_ima(ima,
make::box1d
(4, 10));
71
const
II csub_ima(ima,
make::box1d
(4, 10));
72
point1d
p
(5);
73
74
data::fill
(ima,
short
(51));
75
mln_assertion(csub_ima(
p
) ==
opt::at
(csub_ima, 5));
76
opt::at
(sub_ima, 5) = 12;
77
mln_assertion(sub_ima(
p
) == 12);
78
}
79
{
80
typedef
image1d<unsigned short>
I;
81
typedef
cast_image_<int, I>
II;
82
83
I in(size, size);
84
II
cast
(in);
85
const
II ccast(in);
86
point1d
p
(5);
87
88
data::fill
(in, (
unsigned
short
)51);
89
mln_assertion(ccast(
p
) ==
opt::at
(ccast, 5));
90
// FIXME
91
//opt::at(cast, 5) = 12;
92
//mln_assertion(cast(p) == 12);
93
}
94
96
{
97
image2d<short>
ima(size, size);
98
debug::iota
(ima);
99
const
image2d<short>
cima = ima;
100
101
point2d
p
(5, 5);
102
mln_assertion(cima(
p
) ==
opt::at
(cima, 5, 5));
103
104
opt::at
(ima, 5, 5) = 12;
105
mln_assertion(cima(
p
) == 12);
106
}
107
{
108
typedef
image2d<short>
I;
109
typedef
sub_image< image2d<short>
,
box2d
> II;
110
111
I ima(size, size);
112
II sub_ima(ima,
make::box2d
(4,4, 10, 10));
113
const
II csub_ima(ima,
make::box2d
(4, 4, 10, 10));
114
point2d
p
(5, 5);
115
116
data::fill
(ima,
short
(51));
117
mln_assertion(csub_ima(
p
) ==
opt::at
(csub_ima, 5, 5));
118
opt::at
(sub_ima, 5, 5) = 12;
119
mln_assertion(sub_ima(
p
) == 12);
120
}
121
{
122
typedef
image2d<unsigned short>
I;
123
typedef
cast_image_<int, I>
II;
124
125
I in(size, size);
126
II
cast
(in);
127
const
II ccast(in);
128
point2d
p
(5,5);
129
130
data::fill
(in, (
unsigned
short
)51);
131
mln_assertion(ccast(
p
) ==
opt::at
(ccast, 5, 5));
132
// FIXME
133
//opt::at(cast, 5) = 12;
134
//mln_assertion(cast(p) == 12);
135
}
136
137
139
{
140
image3d<short>
ima(size, size, size);
141
debug::iota
(ima);
142
const
image3d<short>
cima = ima;
143
144
point3d
p
(5, 5, 5);
145
mln_assertion(cima(
p
) ==
opt::at
(cima, 5, 5, 5));
146
147
opt::at
(ima, 5, 5, 5) = 12;
148
mln_assertion(cima(
p
) == 12);
149
}
150
}
tests
opt
at.cc
Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)