Class ImageTransformationBuffer

  • Direct Known Subclasses:
    ImageTransformationBuffer

    public class ImageTransformationBuffer
    extends java.lang.Object
    Utility class to construct various kinds of image transformations.
    • Constructor Detail

      • ImageTransformationBuffer

        public ImageTransformationBuffer()
    • Method Detail

      • append

        public ImageTransformation append​(ImageTransformation transformation)
        Appends a single transformation and returns it. Note that code of each added transformation should be unique.
      • appendAll

        public void appendAll​(ImageTransformation... transformations)
        Appends any specified transformations. Note that code of each added transformation should be unique.
      • appendAllBitShiftsFor12BitGrayscale

        public ImageTransformation[] appendAllBitShiftsFor12BitGrayscale()
        Appends transformations which extracts a range of grayscale image colors by choosing 8 consecutive bits. All shifts which make sense for 12 bit images will be appended (from 0 to 4).
        Returns:
        appended transformations. They can be used to e.g. modify their label or description.
      • appendAllBitShiftsFor16BitGrayscale

        public ImageTransformation[] appendAllBitShiftsFor16BitGrayscale()
        Appends transformations which extracts a range of grayscale image colors by choosing 8 consecutive bits. All shifts which make sense for 16 bit images will be appended (from 0 to 8).
        Returns:
        appended transformations. They can be used to e.g. modify their label or description.
      • appendGrayscaleBitShifting

        public ImageTransformation appendGrayscaleBitShifting​(int shiftBits)
        Appends transformation which extracts a range of grayscale image colors by choosing 8 consecutive bits starting from the specified one.
        Returns:
        appended transformation. It can be used to e.g. modify its label or description.
      • appendRescaleGrayscaleIntensity

        public ImageTransformation appendRescaleGrayscaleIntensity​(int blackPointIntensity,
                                                                   int whitePointIntensity)
        Appends transformation which converts grayscale image pixel intensities from the range [blackPointIntensity, whitePointIntensity] to 8 bit color depth. Useful to compare images of higher color depth with each other when they do not use the whole range of available intensities.
        Returns:
        appended transformation. It can be used to e.g. modify its label or description.
      • appendRescaleGrayscaleIntensity

        public ImageTransformation appendRescaleGrayscaleIntensity​(int blackPointIntensity,
                                                                   int whitePointIntensity,
                                                                   java.lang.String userFriendlyLabelOrNull)
        See appendRescaleGrayscaleIntensity(int, int).

        Additionally sets the label of the transformation.

        Returns:
        appended transformation. It can be used to e.g. modify its label or description.
      • createRescaleGrayscaleIntensity

        public static ImageTransformation createRescaleGrayscaleIntensity​(int blackPointIntensity,
                                                                          int whitePointIntensity,
                                                                          java.lang.String userFriendlyLabelOrNull)
        Creates a transformation which converts grayscale image pixel intensities from the range [blackPointIntensity, whitePointIntensity] to 8 bit color depth.

        This method is useful when one wants to modify the default code, label or description afterwards.

        Parameters:
        userFriendlyLabelOrNull - label of the transformation. If null a default label is assigned.
      • appendAutoRescaleGrayscaleIntensity

        public ImageTransformation appendAutoRescaleGrayscaleIntensity​(float threshold)
        Appends transformation which converts each single grayscale image to 8 bit color depth and rescales pixels intensities so that the darkest pixel will become black and the brightest will become white.

        Note that by default openBIS applies this transformation with threshold 0 if it deals with grayscale image where color depth is bigger then 8 bit. So calling this method with parameter 0 is not necessary.

        Parameters:
        threshold - value form 0 to 1, it specifies the percentage of darkest and brightest pixels which will be ignored (they will all become black or white).
        Returns:
        appended transformation. It can be used to e.g. modify its label or description.
      • appendAutoRescaleGrayscaleIntensity

        public ImageTransformation appendAutoRescaleGrayscaleIntensity​(float threshold,
                                                                       java.lang.String userFriendlyLabelOrNull)
        See appendAutoRescaleGrayscaleIntensity(float).

        Additionally sets the label of the transformation.

        Returns:
        appended transformation. It can be used to e.g. modify its label or description.
      • appendImageMagicConvert

        public ImageTransformation appendImageMagicConvert​(java.lang.String convertCliArguments)
        Allows to transform the images with ImageMagic convert tool (which has to be installed and accessible). Convert will be called with the specified parameters.
        Returns:
        appended transformation. It can be used to e.g. modify its label or description.
      • appendImageMagicConvert

        public ImageTransformation appendImageMagicConvert​(java.lang.String convertCliArguments,
                                                           java.lang.String userFriendlyLabelOrNull)
        See appendImageMagicConvert(String).

        Additionally sets the label of the transformation.

        Returns:
        appended transformation. It can be used to e.g. modify its label or description.