Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NutriMorph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
NADAL Morgane
NutriMorph
Commits
e995b969
Commit
e995b969
authored
5 years ago
by
NADAL Morgane
Browse files
Options
Downloads
Patches
Plain Diff
Created PySide2 Image Verification algo (still some bugs!!)
parent
56ee3805
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
brick/processing/frangi3-nt.so
+0
-0
0 additions, 0 deletions
brick/processing/frangi3-nt.so
image_verification.py
+158
-0
158 additions, 0 deletions
image_verification.py
with
158 additions
and
0 deletions
brick/processing/frangi3-nt.so
0 → 100644
+
0
−
0
View file @
e995b969
File added
This diff is collapsed.
Click to expand it.
image_verification.py
0 → 100644
+
158
−
0
View file @
e995b969
# Copyright CNRS/Inria/UNS
# Contributor(s): Eric Debreuve (since 2019), Morgane Nadal (2020)
#
# eric.debreuve@cnrs.fr
#
# This software is governed by the CeCILL license under French law and
# abiding by the rules of distribution of free software. You can use,
# modify and/ or redistribute the software under the terms of the CeCILL
# license as circulated by CEA, CNRS and INRIA at the following URL
# "http://www.cecill.info".
#
# As a counterpart to the access to the source code and rights to copy,
# modify and redistribute granted by the license, users are provided only
# with a limited warranty and the software's author, the holder of the
# economic rights, and the successive licensors have only limited
# liability.
#
# In this respect, the user's attention is drawn to the risks associated
# with loading, using, modifying and/or developing or reproducing the
# software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also
# therefore means that it is reserved for developers and experienced
# professionals having in-depth computer knowledge. Users are therefore
# encouraged to load and test the software's suitability as regards their
# requirements in conditions enabling the security of their systems and/or
# data to be ensured and, more generally, to use and operate it in the
# same conditions as regards security.
#
# The fact that you are presently reading this means that you have had
# knowledge of the CeCILL license and that you accept its terms.
import
sys
as
sy_
from
PySide2.QtWidgets
import
*
import
skimage.io
as
io_
import
matplotlib
as
mpl_
import
matplotlib.pyplot
as
pl_
from
brick.general.type
import
array_t
mpl_
.
use
(
'
TkAgg
'
)
channel
=
'
G
'
data_path
=
'
data//DIO_6H_6_1.70bis_2.2_3.tif
'
image
=
io_
.
imread
(
data_path
)
class
image_verification
(
QWidget
):
def
__init__
(
self
,
image
:
array_t
,
channel
:
str
,
parent
=
None
):
super
(
image_verification
,
self
).
__init__
(
parent
)
# Create widgets
# --Text
self
.
text0
=
QLabel
(
'
The image input must not be constant.
'
)
self
.
text1
=
QLabel
(
'
The image has only one color channel.
'
)
self
.
text2
=
QLabel
(
f
"
The image has only 3 dimensions. However, a value for the
'
channel
'
parameter
"
f
"
is specified:
{
channel
}
. Continue with this image?
"
)
self
.
text3
=
QLabel
(
f
"
The image has multiple color channels. The channel
{
channel
}
is specified
"
f
"
in the parameters. Continue with the resulting image?
"
)
self
.
text4
=
QLabel
(
'
The image has multiple color channels. Error in the value of the parameter channel.
'
)
self
.
text5
=
QLabel
(
f
'
The image dimensions are not correct:
{
image
.
ndim
}
, instead of 3 or 4.
'
)
# --Buttons
self
.
button_quit
=
QPushButton
(
"
Quit and modify the parameters.
"
)
self
.
button_continue
=
QPushButton
(
"
Continue.
"
)
# Add button signal
self
.
button_continue
.
clicked
.
connect
(
self
.
Continue
)
self
.
button_quit
.
clicked
.
connect
(
self
.
Quit
)
if
image
is
not
None
:
self
.
ImVerif
(
image
,
channel
)
def
Continue
(
self
):
self
.
close
()
def
Quit
(
self
):
sy_
.
exit
(
0
)
def
ImVerif
(
self
,
image
:
array_t
,
channel
:
str
)
->
array_t
:
# The image must not be constant
if
image
.
max
()
==
image
.
min
():
value_error
=
'
The image input must not be constant.
'
print
(
value_error
)
layout
=
QVBoxLayout
()
layout
.
addWidget
(
self
.
text0
)
layout
.
addWidget
(
self
.
button_quit
)
self
.
setLayout
(
layout
)
# Verification of the dimension of the image and its coherence with the parameters (channel)
elif
image
.
ndim
==
3
:
print
(
'
The image has only one color channel.
'
)
pl_
.
imshow
(
image
[
10
,
:,
:])
pl_
.
show
(
block
=
True
)
layout
=
QVBoxLayout
()
layout
.
addWidget
(
self
.
text1
)
layout
.
addWidget
(
self
.
button_continue
)
self
.
setLayout
(
layout
)
if
channel
is
not
None
:
value_error
=
f
'
The image has only 3 dimensions. However, a value for the
"
channel
"
parameter is
'
f
'
specified :
{
channel
}
. Give the channel the value None?
'
print
(
value_error
)
layout
=
QVBoxLayout
()
layout
.
addWidget
(
self
.
text2
)
layout
.
addWidget
(
self
.
button_continue
)
layout
.
addWidget
(
self
.
button_quit
)
self
.
setLayout
(
layout
)
elif
image
.
ndim
==
4
:
if
channel
==
'
R
'
or
channel
==
'
G
'
or
channel
==
'
B
'
:
# not changed into if --channel in 'RGB'-- because if channel='RG' => True.
value_error
=
f
'
The image has multiple color channels. The channel
{
channel
}
is specified in the
'
\
f
'
parameters.
'
print
(
value_error
)
image
=
image
[:,
:,
:,
'
RGB
'
.
find
(
channel
)]
pl_
.
imshow
(
image
[
10
,
:,
:])
pl_
.
show
(
block
=
True
)
layout
=
QVBoxLayout
()
layout
.
addWidget
(
self
.
text3
)
layout
.
addWidget
(
self
.
button_continue
)
layout
.
addWidget
(
self
.
button_quit
)
self
.
setLayout
(
layout
)
# TODO: Viewing bug when channel = 'R' or 'B'
# The obtained image must not be constant
if
image
.
max
()
==
image
.
min
():
raise
ValueError
(
'
The image input must not be constant.
'
)
return
image
# TODO: How to return the image ??
else
:
print
(
'
The image has multiple color channels. Error in the value of the parameter channel.
'
)
layout
=
QVBoxLayout
()
layout
.
addWidget
(
self
.
text4
)
layout
.
addWidget
(
self
.
button_quit
)
self
.
setLayout
(
layout
)
elif
image
.
ndim
!=
4
and
image
.
ndim
!=
3
:
print
(
f
'
The image dimensions are not correct:
{
image
.
ndim
}
, instead of 3 or 4.
'
)
layout
=
QVBoxLayout
()
layout
.
addWidget
(
self
.
text5
)
layout
.
addWidget
(
self
.
button_quit
)
self
.
setLayout
(
layout
)
if
__name__
==
'
__main__
'
:
# Create the Qt Application
app
=
QApplication
(
sy_
.
argv
)
# Create and show the form
verif
=
image_verification
(
image
,
channel
)
verif
.
show
()
sy_
.
exit
(
app
.
exec_
())
\ No newline at end of file
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