Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mednet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
medai
software
mednet
Commits
eacfa301
Commit
eacfa301
authored
1 year ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[tests] Comment out outdated test sections
parent
b7dac705
No related branches found
No related tags found
1 merge request
!6
Making use of LightningDataModule and simplification of data loading
Pipeline
#76711
canceled
1 year ago
Stage: qa
Stage: test
Stage: doc
Stage: dist
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_image_utils.py
+21
-24
21 additions, 24 deletions
tests/test_image_utils.py
with
21 additions
and
24 deletions
tests/test_image_utils.py
+
21
−
24
View file @
eacfa301
...
...
@@ -6,10 +6,7 @@
import
numpy
import
PIL.Image
from
ptbench.data.image_utils
import
(
# SingleAutoLevel16to8,
RemoveBlackBorders
,
load_pil
,
)
from
ptbench.data.image_utils
import
RemoveBlackBorders
def
test_remove_black_borders
(
datadir
):
...
...
@@ -32,23 +29,23 @@ def test_remove_black_borders(datadir):
numpy
.
testing
.
assert_array_equal
(
raw_without_black_border
,
raw_rbb_removed
)
def
test_load_pil_16bit
(
datadir
):
# If the ratio is higher 0.5, image is probably clipped
Level16to8
=
SingleAutoLevel16to8
()
data_file
=
str
(
datadir
/
"
16bits.png
"
)
image
=
numpy
.
array
(
Level16to8
(
load_pil
(
data_file
)))
count_pixels
=
numpy
.
count_nonzero
(
image
)
count_max_value
=
numpy
.
count_nonzero
(
image
==
image
.
max
())
assert
count_max_value
/
count_pixels
<
0.5
# It should not do anything to an image already in 8 bits
data_file
=
str
(
datadir
/
"
raw_without_black_border.png
"
)
img_loaded
=
load_pil
(
data_file
)
original_8bits
=
numpy
.
array
(
img_loaded
)
leveled_8bits
=
numpy
.
array
(
Level16to8
(
img_loaded
))
numpy
.
testing
.
assert_array_equal
(
original_8bits
,
leveled_8bits
)
#
def test_load_pil_16bit(datadir):
#
# If the ratio is higher 0.5, image is probably clipped
#
Level16to8 = SingleAutoLevel16to8()
#
#
data_file = str(datadir / "16bits.png")
#
image = numpy.array(Level16to8(load_pil(data_file)))
#
#
count_pixels = numpy.count_nonzero(image)
#
count_max_value = numpy.count_nonzero(image == image.max())
#
#
assert count_max_value / count_pixels < 0.5
#
#
# It should not do anything to an image already in 8 bits
#
data_file = str(datadir / "raw_without_black_border.png")
#
img_loaded = load_pil(data_file)
#
#
original_8bits = numpy.array(img_loaded)
#
leveled_8bits = numpy.array(Level16to8(img_loaded))
#
#
numpy.testing.assert_array_equal(original_8bits, leveled_8bits)
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