Skip to content
Snippets Groups Projects
Commit 581cdf2d authored by jakubs's avatar jakubs
Browse files

BIS-665 SP-1202 fix the previous fix

SVN: 30590
parent d8116840
No related branches found
No related tags found
No related merge requests found
...@@ -27,12 +27,10 @@ import ch.systemsx.cisd.common.image.IntensityRescaling.Channel; ...@@ -27,12 +27,10 @@ import ch.systemsx.cisd.common.image.IntensityRescaling.Channel;
import ch.systemsx.cisd.common.image.IntensityRescaling.Levels; import ch.systemsx.cisd.common.image.IntensityRescaling.Levels;
/** /**
* Transformation performed by * Transformation performed by {@link IntensityRescaling#rescaleIntensityLevelTo8Bits(BufferedImage, Levels)}.
* {@link IntensityRescaling#rescaleIntensityLevelTo8Bits(BufferedImage, Levels)}.
* <p> * <p>
* Warning: The serialized version of this class can be stored in the database for each image. * Warning: The serialized version of this class can be stored in the database for each image. Moving this class to a different package or changing it
* Moving this class to a different package or changing it in a backward incompatible way would make * in a backward incompatible way would make all the saved transformations invalid.
* all the saved transformations invalid.
* *
* @author Tomasz Pylak * @author Tomasz Pylak
*/ */
...@@ -69,20 +67,17 @@ public class IntensityRangeImageTransformerFactory implements IImageTransformerF ...@@ -69,20 +67,17 @@ public class IntensityRangeImageTransformerFactory implements IImageTransformerF
@Override @Override
public BufferedImage transform(BufferedImage image) public BufferedImage transform(BufferedImage image)
{ {
Levels levels = new Levels(blackPointIntensity, whitePointIntensity);
if (IntensityRescaling.isNotGrayscale(image)) if (IntensityRescaling.isNotGrayscale(image))
{ {
EnumSet<Channel> channels = IntensityRescaling.getUsedRgbChannels(image); EnumSet<Channel> channels = IntensityRescaling.getUsedRgbChannels(image);
if (channels.size() <= 1) if (channels.size() != 1)
{
return image;
} else
{ {
Levels levels = new Levels(blackPointIntensity, whitePointIntensity); return IntensityRescaling.rescaleIntensityLevelTo8Bits(image, levels);
return IntensityRescaling.rescaleIntensityLevelTo8Bits(image, levels,
channels.iterator().next());
} }
return IntensityRescaling.rescaleIntensityLevelTo8Bits(image, levels,
channels.iterator().next());
} }
Levels levels = new Levels(blackPointIntensity, whitePointIntensity);
return IntensityRescaling.rescaleIntensityLevelTo8Bits(image, levels); return IntensityRescaling.rescaleIntensityLevelTo8Bits(image, levels);
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment