Package net.sourceforge.jiu.ops

Examples of net.sourceforge.jiu.ops.WrongParameterException


    }
    else
    {
      if (!(out instanceof Gray8Image))
      {
        throw new WrongParameterException("Specified output image must be of type Gray8Image for input image of type RGB24Image.");
      }
      ensureImagesHaveSameResolution();
    }
    process(in, (GrayIntegerImage)out);
  }
View Full Code Here


    }
    else
    {
      if (!(out instanceof Gray16Image))
      {
        throw new WrongParameterException("Specified output image must be of type Gray16Image for input image of type RGB48Image.");
      }
      ensureImagesHaveSameResolution();
    }
    process(in, (GrayIntegerImage)out);
  }
View Full Code Here

    }
    ensureInputImageIsAvailable();
    PixelImage pixelImage = getInputImage();
    if (!(pixelImage instanceof RGB24Image))
    {
      throw new WrongParameterException("Input image must implement RGB24Image.");
    }
    RGB24Image originalImage = (RGB24Image)pixelImage;
    quantizer.setInputImage(originalImage);
    quantizer.setMapping(true); // we want the quantizer to create an output image
    quantizer.setTruecolorOutput(false); // that output image must be paletted
View Full Code Here

    PixelImage in = getInputImage();
    boolean rgb24 = in instanceof RGB24Image;
    boolean rgb48 = in instanceof RGB48Image;
    if (!(rgb24 || rgb48))
    {
      throw new WrongParameterException(
        "Input image must be either RGB24Image or RGB48Image.");
    }
    if (rgb24 && bits >= 8)
    {
      throw new WrongParameterException(
        "Number of output bits per sample must be 7 or lower for RGB24Image.");
    }
    PixelImage out = getOutputImage();
    int inDepth = 0;
    if (rgb24)
    {
      inDepth = 8;
    }
    if (rgb48)
    {
      inDepth = 16;
    }
    int maxOutputValue = 1;
    int maxShiftedValue = (1 << bits) - 1;
    if (bits <= 8)
    {
      if (out == null)
      {
        out = new MemoryRGB24Image(in.getWidth(), in.getHeight());
        setOutputImage(out);
      }
      else
      {
        if (!(out instanceof RGB24Image))
        {
          throw new WrongParameterException(
            "Output image must be of type RGB24Image.");
        }
      }
      maxOutputValue = 255;
    }
    else
    if (bits <= 16)
    {
      if (out == null)
      {
        out = new MemoryRGB48Image(in.getWidth(), in.getHeight());
        setOutputImage(out);
      }
      else
      {
        if (!(out instanceof RGB48Image))
        {
          throw new WrongParameterException(
            "Output image must be of type RGB48Image.");
        }
      }
      maxOutputValue = 65535;
    }
    else
    {
      throw new WrongParameterException("Can only process up to 16 bits per sample.");
    }
    final int SHIFT = inDepth - bits;
    IntegerImage ii = (IntegerImage)in;
    IntegerImage oo = (IntegerImage)out;
    for (int y = 0; y < in.getHeight(); y++)
View Full Code Here

      threshold = new Integer((MAX_SAMPLE + 1) / 2);
    }
    final int THRESHOLD = threshold.intValue();
    if (THRESHOLD > MAX_SAMPLE)
    {
      throw new WrongParameterException("Threshold must be smaller than or equal to the maximum sample of the input image.");
    }
    final int WIDTH = in.getWidth();
    final int HEIGHT = in.getHeight();
    out.clear(BilevelImage.BLACK);
    for (int y = 0; y < HEIGHT; y++)
View Full Code Here

    {
      throw new MissingParameterException("Input image missing.");
    }
    if (!(in instanceof GrayIntegerImage))
    {
      throw new WrongParameterException("Input image must implement GrayIntegerImage.");
    }
    PixelImage out = getOutputImage();
    if (out == null)
    {
      out = new MemoryBilevelImage(in.getWidth(), in.getHeight());
      setOutputImage(out);
    }
    if (out != null && !(out instanceof BilevelImage))
    {
      throw new WrongParameterException("Output image must implement BilevelImage.");
    }
    if (out != null && (in.getWidth() != out.getWidth() || in.getHeight() != out.getHeight()))
    {
      throw new WrongParameterException("Input and output images must have the same resolution.");
    }
    process((GrayIntegerImage)in, (BilevelImage)out);
  }
View Full Code Here

    {
      process((Paletted8Image)in, (Paletted8Image)getOutputImage());
    }
    else
    {
      throw new WrongParameterException("Contrast operation cannot operate on input image type: " + in.getClass());
    }
  }
View Full Code Here

    {
      process((Paletted8Image)in, (Paletted8Image)out);
    }
    else
    {
      throw new WrongParameterException("Input image type not supported.");
    }
  }
View Full Code Here

      }
      super.process();
    }
    else
    {
      throw new WrongParameterException("Unsupported image type: " + in.getClass().getName());
    }
  }
View Full Code Here

      throw new OperationFailedException("Could not create histogram from input image.");
    }
    int numUniqueColors = hist.getNumUsedEntries();
    if (numUniqueColors <= paletteSize)
    {
      throw new WrongParameterException("Input image has only " + numUniqueColors +
        " unique color(s), so it cannot be reduced to " + paletteSize +
        " color(s).");
    }
    return new RGBColorList(hist);
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.jiu.ops.WrongParameterException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.