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
a63542df
Commit
a63542df
authored
12 years ago
by
Sacha Percot-Tétu
Browse files
Options
Downloads
Patches
Plain Diff
Added combine color operation
parent
12b17d45
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/CombineColorOp.cpp
+101
-0
101 additions, 0 deletions
app/Operations/CombineColorOp.cpp
app/Operations/CombineColorOp.h
+35
-0
35 additions, 0 deletions
app/Operations/CombineColorOp.h
with
136 additions
and
0 deletions
app/Operations/CombineColorOp.cpp
0 → 100644
+
101
−
0
View file @
a63542df
/*
* 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
<limits>
#include
<QLabel>
#include
<QDialog>
#include
<QFormLayout>
#include
<QDialogButtonBox>
#include
<GrayscaleImage.h>
#include
<Converter.h>
#include
<ImgWidget.h>
#include
"ImageListBox.h"
#include
"CombineColorOp.h"
#include
"../Tools.h"
using
namespace
std
;
using
namespace
imagein
;
CombineColorOp
::
CombineColorOp
()
:
Operation
(
Tools
::
tr
(
"Combine color planes"
).
toStdString
())
{
}
bool
CombineColorOp
::
needCurrentImg
()
{
return
false
;
}
std
::
vector
<
QWidget
*>
CombineColorOp
::
operator
()(
const
imagein
::
Image
*
,
const
std
::
map
<
const
imagein
::
Image
*
,
std
::
string
>&
imgList
)
{
vector
<
QWidget
*>
result
;
QDialog
*
dialog
=
new
QDialog
();
dialog
->
setWindowTitle
(
dialog
->
tr
(
"Parameters"
));
dialog
->
setMinimumWidth
(
180
);
QFormLayout
*
layout
=
new
QFormLayout
();
dialog
->
setLayout
(
layout
);
int
nChannel
=
3
;
ImageListBox
**
imageBoxes
=
new
ImageListBox
*
[
nChannel
];
for
(
int
i
=
0
;
i
<
nChannel
;
++
i
)
{
imageBoxes
[
i
]
=
new
ImageListBox
(
dialog
,
NULL
,
imgList
);
QLabel
*
label
=
new
QLabel
(
Tools
::
colorName
(
i
,
nChannel
),
dialog
);
layout
->
insertRow
(
i
,
label
,
imageBoxes
[
i
]);
}
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
Qt
::
Horizontal
,
dialog
);
layout
->
insertRow
(
nChannel
,
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
result
;
}
GrayscaleImage
*
channels
[
nChannel
];
unsigned
int
maxWidth
=
numeric_limits
<
unsigned
int
>::
max
();
unsigned
int
maxHeight
=
numeric_limits
<
unsigned
int
>::
max
();
for
(
unsigned
int
c
=
0
;
c
<
nChannel
;
++
c
)
{
channels
[
c
]
=
Converter
<
GrayscaleImage
>::
convert
(
*
imageBoxes
[
c
]
->
currentImage
());
maxWidth
=
min
(
maxWidth
,
channels
[
c
]
->
getWidth
());
maxHeight
=
min
(
maxHeight
,
channels
[
c
]
->
getHeight
());
}
Image
*
resImg
=
new
Image
(
maxWidth
,
maxHeight
,
nChannel
);
for
(
unsigned
int
c
=
0
;
c
<
nChannel
;
++
c
)
{
for
(
unsigned
int
j
=
0
;
j
<
resImg
->
getHeight
();
++
j
)
{
for
(
unsigned
int
i
=
0
;
i
<
resImg
->
getWidth
();
++
i
)
{
resImg
->
setPixel
(
i
,
j
,
c
,
channels
[
c
]
->
getPixel
(
i
,
j
));
}
}
}
result
.
push_back
(
new
ImgWidget
(
resImg
,
Tools
::
tr
(
"Reconstructed color image"
).
toStdString
()));
return
result
;
}
This diff is collapsed.
Click to expand it.
app/Operations/CombineColorOp.h
0 → 100644
+
35
−
0
View file @
a63542df
/*
* 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 COMBINECOLOROP_H
#define COMBINECOLOROP_H
#include
"Operation.h"
class
CombineColorOp
:
public
Operation
{
public:
CombineColorOp
();
std
::
vector
<
QWidget
*>
operator
()(
const
imagein
::
Image
*
,
const
std
::
map
<
const
imagein
::
Image
*
,
std
::
string
>&
);
bool
needCurrentImg
();
};
#endif // COMBINECOLOROP_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