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
f792f177
Commit
f792f177
authored
1 year ago
by
ogueler@idiap.ch
Browse files
Options
Downloads
Patches
Plain Diff
removed redundant custom transform function
parent
5f0b0dd2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!5
Tbx11k
,
!4
Moved code to lightning
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ptbench/configs/datasets/tbx11k_simplified/__init__.py
+1
-1
1 addition, 1 deletion
src/ptbench/configs/datasets/tbx11k_simplified/__init__.py
src/ptbench/data/transforms.py
+0
-33
0 additions, 33 deletions
src/ptbench/data/transforms.py
with
1 addition
and
34 deletions
src/ptbench/configs/datasets/tbx11k_simplified/__init__.py
+
1
−
1
View file @
f792f177
...
...
@@ -19,7 +19,7 @@ def _maker(protocol, RGB=False):
return
mk
(
[
raw
.
subsets
(
protocol
)],
[
RGBtoGreyscale8bit
()
],
[],
[
ElasticDeformation
(
p
=
0.8
)],
post_transforms
,
)
This diff is collapsed.
Click to expand it.
src/ptbench/data/transforms.py
+
0
−
33
View file @
f792f177
...
...
@@ -42,39 +42,6 @@ class SingleAutoLevel16to8:
).
convert
(
"
L
"
)
class
RGBtoGreyscale8bit
:
"""
Converts a 24-bit RGB image to an 8-bit greyscale representation.
This transform assumes that the input image is RGB with 24 bits.
Converts the RGB image to a greyscale image using the well-known formula:
Y = 0.299 * R + 0.587 * G + 0.114 * B
This formula is based on the relative luminance of the RGB channels in the sRGB color space
consider such a range should be mapped to the [0,255] range of the
destination image.
"""
def
__call__
(
self
,
img
):
# Use the formula to convert the RGB image to a greyscale image
img_array
=
numpy
.
array
(
img
).
astype
(
float
)
grey_array
=
(
0.299
*
img_array
[:,
:,
0
]
+
0.587
*
img_array
[:,
:,
1
]
+
0.114
*
img_array
[:,
:,
2
]
)
# Normalize the greyscale image to the range [0, 255] and convert it to uint8
grey_array
=
numpy
.
round
(
255.0
*
(
grey_array
-
grey_array
.
min
())
/
(
grey_array
.
max
()
-
grey_array
.
min
())
).
astype
(
"
uint8
"
)
# Create a new greyscale PIL image from the normalized array
return
PIL
.
Image
.
fromarray
(
grey_array
).
convert
(
"
L
"
)
class
RemoveBlackBorders
:
"""
Remove black borders of CXR.
"""
...
...
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