Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ImageINSA_Tanguy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tanguy.Raufflet
ImageINSA_Tanguy
Commits
d6f13eb7
Commit
d6f13eb7
authored
12 years ago
by
Sacha Percot-Tétu
Browse files
Options
Downloads
Patches
Plain Diff
Added rejection ring operation
parent
6995d613
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Operations/RejectionRingOp.cpp
+106
-0
106 additions, 0 deletions
app/Operations/RejectionRingOp.cpp
app/Operations/RejectionRingOp.h
+35
-0
35 additions, 0 deletions
app/Operations/RejectionRingOp.h
with
141 additions
and
0 deletions
app/Operations/RejectionRingOp.cpp
0 → 100644
+
106
−
0
View file @
d6f13eb7
/*
* Copyright 2011-2012 INSA Rennes
*
* This file is part of EIImage.
*
* EIImage is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EIImage is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EIImage. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"RejectionRingOp.h"
#include
"../Tools.h"
#include
<QDialog>
#include
<QFormLayout>
#include
<QRadioButton>
#include
<QGroupBox>
#include
<QHBoxLayout>
#include
<QPushButton>
#include
<QDialogButtonBox>
#include
<QSpinBox>
#include
<QDoubleSpinBox>
#include
<QLabel>
using
namespace
imagein
;
using
namespace
std
;
RejectionRingOp
::
RejectionRingOp
()
:
Operation
(
Tools
::
tr
(
"Rejection ring"
).
toStdString
())
{
}
void
RejectionRingOp
::
operator
()(
const
imagein
::
Image
*
,
const
std
::
map
<
const
imagein
::
Image
*
,
std
::
string
>&
)
{
QDialog
*
dialog
=
new
QDialog
();
dialog
->
setWindowTitle
(
dialog
->
tr
(
"Rejection ring"
));
dialog
->
setMinimumWidth
(
180
);
QFormLayout
*
layout
=
new
QFormLayout
(
dialog
);
QSpinBox
*
widthBox
=
new
QSpinBox
(
dialog
);
widthBox
->
setRange
(
0
,
65536
);
widthBox
->
setValue
(
512
);
layout
->
insertRow
(
0
,
"Width=Height : "
,
widthBox
);
QSpinBox
*
radiusBox
=
new
QSpinBox
(
dialog
);
radiusBox
->
setRange
(
0
,
65536
);
layout
->
insertRow
(
1
,
"Radius : "
,
radiusBox
);
QSpinBox
*
thickBox
=
new
QSpinBox
(
dialog
);
thickBox
->
setRange
(
0
,
65536
);
layout
->
insertRow
(
2
,
"Thickness (beyond radius) : "
,
thickBox
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
Qt
::
Horizontal
,
dialog
);
layout
->
insertRow
(
3
,
buttonBox
);
QObject
::
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
dialog
,
SLOT
(
accept
()));
QObject
::
connect
(
buttonBox
,
SIGNAL
(
rejected
()),
dialog
,
SLOT
(
reject
()));
QDialog
::
DialogCode
code
=
static_cast
<
QDialog
::
DialogCode
>
(
dialog
->
exec
());
if
(
code
!=
QDialog
::
Accepted
)
return
;
//On rcupre la taille de l'image a traiter
int
nb_ligne
,
nb_colonne
;
int
rayon
,
epaisseur
;
nb_ligne
=
widthBox
->
value
();
//1er parametre de l'algorithme
rayon
=
radiusBox
->
value
();
//2nd parametre de l'algorithme
epaisseur
=
thickBox
->
value
();
//3me parametre de l'algorithme
nb_colonne
=
nb_ligne
;
Image_t
<
double
>*
result
=
new
Image_t
<
double
>
(
nb_ligne
,
nb_colonne
,
1
);
//image resultat
int
i
,
j
;
int
icentre
,
jcentre
;
icentre
=
(
int
)(
nb_ligne
/
2.
);
jcentre
=
(
int
)(
nb_colonne
/
2.
);
for
(
i
=
0
;
i
<
nb_ligne
;
i
++
)
for
(
j
=
0
;
j
<
nb_colonne
;
j
++
){
result
->
setPixelAt
(
i
,
j
,
1.
);
}
for
(
i
=
0
;
i
<
nb_ligne
;
i
++
)
for
(
j
=
0
;
j
<
nb_colonne
;
j
++
){
if
(
(
i
-
icentre
)
*
(
i
-
icentre
)
+
(
j
-
jcentre
)
*
(
j
-
jcentre
)
>=
rayon
*
rayon
&&
(
i
-
icentre
)
*
(
i
-
icentre
)
+
(
j
-
jcentre
)
*
(
j
-
jcentre
)
<=
(
rayon
+
epaisseur
)
*
(
rayon
+
epaisseur
)
)
result
->
setPixelAt
(
i
,
j
,
0.
);
}
QString
name
(
Tools
::
tr
(
"Rejection ring (%1 %2 %3)"
));
name
=
name
.
arg
(
nb_ligne
).
arg
(
rayon
).
arg
(
epaisseur
);
outDoubleImage
(
result
,
name
.
toStdString
(),
true
,
false
);
}
bool
RejectionRingOp
::
needCurrentImg
()
const
{
return
false
;
}
This diff is collapsed.
Click to expand it.
app/Operations/RejectionRingOp.h
0 → 100644
+
35
−
0
View file @
d6f13eb7
/*
* Copyright 2011-2012 INSA Rennes
*
* This file is part of EIImage.
*
* EIImage is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EIImage is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EIImage. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef REJECTIONRINGOP_H
#define REJECTIONRINGOP_H
#include
<Operation.h>
class
RejectionRingOp
:
public
Operation
{
public:
RejectionRingOp
();
void
operator
()(
const
imagein
::
Image
*
,
const
std
::
map
<
const
imagein
::
Image
*
,
std
::
string
>&
);
bool
needCurrentImg
()
const
;
};
#endif // REJECTIONRINGOP_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment