Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
c49143d8
Commit
c49143d8
authored
13 years ago
by
tpylak
Browse files
Options
Downloads
Patches
Plain Diff
LMS-2502 minor refactorings
SVN: 22848
parent
d65319b7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/source/java/ch/systemsx/cisd/common/image/IntensityRescaling.java
+11
-7
11 additions, 7 deletions
...ava/ch/systemsx/cisd/common/image/IntensityRescaling.java
with
11 additions
and
7 deletions
common/source/java/ch/systemsx/cisd/common/image/IntensityRescaling.java
+
11
−
7
View file @
c49143d8
...
...
@@ -39,7 +39,7 @@ public class IntensityRescaling
final
int
maxLevel
;
Levels
(
int
minLevel
,
int
maxLevel
)
public
Levels
(
int
minLevel
,
int
maxLevel
)
{
this
.
minLevel
=
minLevel
;
this
.
maxLevel
=
maxLevel
;
...
...
@@ -194,7 +194,7 @@ public class IntensityRescaling
}
/**
* Process <var>image</var> and add its pixe
s
l to the <var>histogram</var>. Calling this method
* Process <var>image</var> and add its pixel
s
to the <var>histogram</var>. Calling this method
* multiple times with the same <var>histogram</var> accumulates the histogram for all images.
*/
public
static
void
addToLevelStats
(
PixelHistogram
histogram
,
BufferedImage
image
)
...
...
@@ -286,11 +286,15 @@ public class IntensityRescaling
{
for
(
int
y
=
0
;
y
<
image
.
getHeight
();
++
y
)
{
final
int
intensity
=
Math
.
round
(
Math
.
max
(
0
,
Math
.
min
(
levels
.
maxLevel
,
getGrayIntensity
(
image
,
x
,
y
))
-
levels
.
minLevel
)
/
dynamicRange
*
255
);
int
originalIntensity
=
getGrayIntensity
(
image
,
x
,
y
);
// cut all intensities above the white point
int
intensity
=
Math
.
min
(
levels
.
maxLevel
,
originalIntensity
);
// cut all intensities below the black point and move the origin to 0
intensity
=
Math
.
max
(
0
,
intensity
-
levels
.
minLevel
);
// normalize to [0, 1] and rescale to 8 bits
intensity
=
Math
.
round
(
intensity
/
dynamicRange
*
255
);
rescaledImage
.
getRaster
().
setSample
(
x
,
y
,
0
,
intensity
);
}
}
...
...
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