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
d156564b
Commit
d156564b
authored
13 years ago
by
tpylak
Browse files
Options
Downloads
Patches
Plain Diff
LMS-2502 image transformations: minor refactoring
SVN: 22928
parent
1c958612
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+10
-4
10 additions, 4 deletions
...ava/ch/systemsx/cisd/common/image/IntensityRescaling.java
with
10 additions
and
4 deletions
common/source/java/ch/systemsx/cisd/common/image/IntensityRescaling.java
+
10
−
4
View file @
d156564b
...
...
@@ -125,7 +125,7 @@ public class IntensityRescaling
*/
public
static
int
computeBitShift
(
BufferedImage
image
,
float
threshold
)
{
if
(
i
mage
.
getColorModel
().
getColorSpace
().
getNumComponents
()
>
1
)
if
(
i
sNotGrayscale
(
image
)
)
{
throw
new
IllegalArgumentException
(
"computeBitShift() is only applicable to gray scale images."
);
...
...
@@ -149,6 +149,12 @@ public class IntensityRescaling
return
getBitShiftLowerThanThreshold
(
b0
,
pixels
,
threshold
);
}
/** @return true if the specified image in not in grayscale */
public
static
boolean
isNotGrayscale
(
BufferedImage
image
)
{
return
image
.
getColorModel
().
getColorSpace
().
getNumComponents
()
>
1
;
}
/**
* Performs an intensity rescaling on a gray-scale image by shifting all intensities so that
* only significant bits are kept. A bit position is considered significant if only a small
...
...
@@ -175,7 +181,7 @@ public class IntensityRescaling
*/
public
static
BufferedImage
rescaleIntensityBitShiftTo8Bits
(
BufferedImage
image
,
int
shiftBits
)
{
if
(
i
mage
.
getColorModel
().
getColorSpace
().
getNumComponents
()
>
1
)
if
(
i
sNotGrayscale
(
image
)
)
{
throw
new
IllegalArgumentException
(
"rescaleIntensityBitShiftTo8Bits() is only applicable to gray scale images."
);
...
...
@@ -199,7 +205,7 @@ public class IntensityRescaling
*/
public
static
void
addToLevelStats
(
PixelHistogram
histogram
,
BufferedImage
image
)
{
if
(
i
mage
.
getColorModel
().
getColorSpace
().
getNumComponents
()
>
1
)
if
(
i
sNotGrayscale
(
image
)
)
{
throw
new
IllegalArgumentException
(
"addToLevelStats() is only applicable to gray scale images."
);
...
...
@@ -274,7 +280,7 @@ public class IntensityRescaling
*/
public
static
BufferedImage
rescaleIntensityLevelTo8Bits
(
BufferedImage
image
,
Levels
levels
)
{
if
(
i
mage
.
getColorModel
().
getColorSpace
().
getNumComponents
()
>
1
)
if
(
i
sNotGrayscale
(
image
)
)
{
throw
new
IllegalArgumentException
(
"rescaleIntensityLevelTo8Bits() is only applicable to gray scale images."
);
...
...
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