Returns the type of image the derivative should be for the specified input type.
@param imageType Input image type.
@return Appropriate output image type.
966522
public static <I extends ImageGray<I>, D extends ImageGray<D>>
		Class<D> getDerivativeType( Class<I> imageType ) {
		if( imageType == GrayF32.class ) {
			return (Class<D>) GrayF32.class;
		} else if( imageType == GrayU8.class ) {
			return (Class<D>) GrayS16.class;
		} else if( imageType == GrayU16.class ) {
			return (Class<D>) GrayS32.class;
		} else {
			throw new IllegalArgumentException("Unknown input image type: "+imageType.getSimpleName());
		}
	}
786079
public static <T extends ImageInterleaved<T>> ImageBorder<T> interleavedValue(Class<T> imageType, double value) {
		if( imageType == InterleavedF32.class ) {
			return (ImageBorder<T>) new ImageBorderValue.Value_IL_F32((float) value);
		} else if( imageType == InterleavedF64.class ) {
				return (ImageBorder<T>)new ImageBorderValue.Value_IL_F64(value);
		} else if( InterleavedInteger.class.isAssignableFrom(imageType) ) {
			return (ImageBorder<T>)new ImageBorderValue.Value_IL_S32((int)value);
		} else if( imageType == InterleavedS64.class ) {
			return (ImageBorder<T>)new ImageBorderValue.Value_IL_S64((long)value);
		} else {
			throw new IllegalArgumentException("Unknown image type: "+imageType.getSimpleName());
		}
	}
449029
public BufferedImage toNewBufferedImage(int type) {
        BufferedImage target = new BufferedImage(width, height, type);
        Graphics2D g2 = (Graphics2D) target.getGraphics();
        g2.drawImage(awt, 0, 0, null);
        g2.dispose();
        return target;
    }
746011
public static <T extends ImageBase<T>>
	ComputeRegionMeanColor<T> regionMeanColor(ImageType<T> imageType) {
		if( imageType.getFamily() == ImageType.Family.GRAY) {
			switch( imageType.getDataType() ) {
				case U8:
					return (ComputeRegionMeanColor)new ComputeRegionMeanColor.U8();
				case F32:
					return (ComputeRegionMeanColor)new ComputeRegionMeanColor.F32();
			}
		} else if( imageType.getFamily() == ImageType.Family.PLANAR) {
			int N = imageType.getNumBands();
			switch( imageType.getDataType() ) {
				case U8:
					return (ComputeRegionMeanColor)new ComputeRegionMeanColor.PL_U8(N);
				case F32:
					return (ComputeRegionMeanColor)new ComputeRegionMeanColor.PL_F32(N);
			}
		}

		throw new IllegalArgumentException("Unknown imageType");
	}
314439
public static <T extends ImageGray<T>>
	DescribeImageDense<T,TupleDesc_F64> sift(@Nullable ConfigDenseSift config , Class<T> imageType ) {
		if( config == null )
			config = new ConfigDenseSift();

		config.checkValidity();

		ConfigSiftDescribe c = config.sift;

		Class derivType = GImageDerivativeOps.getDerivativeType(imageType);

		DescribeDenseSiftAlg alg = new DescribeDenseSiftAlg(c.widthSubregion,c.widthGrid,
				c.numHistogramBins,c.weightingSigmaFraction,c.maxDescriptorElementValue,1,1,derivType);

		return new DescribeImageDenseSift(alg,config.sampling.periodX,config.sampling.periodY,imageType);
	}
162923
public static <T extends ImageGray<T>> DenoiseWavelet<T> sure(Class<T> imageType )
	{
		if( imageType == GrayF32.class ) {
			return (DenoiseWavelet<T>)new DenoiseSureShrink_F32();
		} else {
			throw new IllegalArgumentException("Unsupported image type "+imageType);
		}
	}
278977
public static void binary(Image srcImage, OutputStream out, String imageType) {
		binary(srcImage, getImageOutputStream(out), imageType);
	}
904070
public static Type getType(final Class c) {
        if (c.isPrimitive()) {
            if (c == Integer.TYPE) {
                return INT_TYPE;
            } else if (c == Void.TYPE) {
                return VOID_TYPE;
            } else if (c == Boolean.TYPE) {
                return BOOLEAN_TYPE;
            } else if (c == Byte.TYPE) {
                return BYTE_TYPE;
            } else if (c == Character.TYPE) {
                return CHAR_TYPE;
            } else if (c == Short.TYPE) {
                return SHORT_TYPE;
            } else if (c == Double.TYPE) {
                return DOUBLE_TYPE;
            } else if (c == Float.TYPE) {
                return FLOAT_TYPE;
            } else /* if (c == Long.TYPE) */{
                return LONG_TYPE;
            }
        } else {
            return getType(getDescriptor(c));
        }
    }
575584
public static <T extends ImageGray<T>> T loadImage(String fileName, Class<T> imageType ) {
		BufferedImage img = loadImage(fileName);
		if( img == null )
			return null;

		return ConvertBufferedImage.convertFromSingle(img, (T) null, imageType);
	}
258768
@Memoized
  public Type type() {
    int dotIndex = identifier().indexOf('.');
    if (dotIndex == 0) {
      checkArgument(BaseUtils.isIdentifierWithLeadingDot(identifier()));
      return Type.DOT_IDENT;
    } else {
      checkArgument(BaseUtils.isDottedIdentifier(identifier()));
      return dotIndex == -1 ? Type.SINGLE_IDENT : Type.DOTTED_IDENT;
    }
  }
1348228
public static <T extends GrayF<T>, W extends ImageInterleaved>
	DiscreteFourierTransform<T,W> createTransform( ImageDataType type ) {
		switch( type ) {
			case F32: return (DiscreteFourierTransform)createTransformF32();
			case F64: return (DiscreteFourierTransform)createTransformF64();
		}
		throw new IllegalArgumentException("Unsupported image type "+type);
	}
198903
public int getTypeId(Class classType) {

        final Class origType = classType;
        while (null != classType) {
            Integer typeObj = (Integer) _typeMap.get(classType);
            if (null != typeObj) {
                return typeObj.intValue();
            }
            classType = classType.getSuperclass();
        }

        //
        // special check for blobs/clobs they are interfaces not derived from
        //
        if (Blob.class.isAssignableFrom(origType)) {
            return _typeMap.get(Blob.class).intValue();
        } else if (Clob.class.isAssignableFrom(origType)) {
            return _typeMap.get(Clob.class).intValue();
        }

        return TYPE_UNKNOWN;
    }
187200
public static <T extends ImageGray<T>>
	SearchLocalPeak<T> meanShiftUniform( int maxIterations, float convergenceTol , Class<T> imageType ) {
		WeightPixel_F32 weights = new WeightPixelUniform_F32();
		MeanShiftPeak<T> alg = new MeanShiftPeak<>(maxIterations, convergenceTol, weights, imageType);
		return new MeanShiftPeak_to_SearchLocalPeak<>(alg);
	}
478913
public String getMimeType() {
		if (format != null) {
			if (format == Format.JPEG && progressive)
			{
				return "image/pjpeg";
			}
			return format.getMimeType();
		} else {
			return null;
		}
	}
694349
public static String getType(final Type t) {
        switch (t.getSort()) {
        case Type.ARRAY:
            return getType(t.getElementType());
        default:
            return t.getClassName();
        }
    }
153922
public static function getType(/*mixed*/ $imageType) {
    if(is_numeric($imageType)) {
      switch($imageType) {
        case IMAGETYPE_PNG:
          return self::TYPE_PNG;

        case IMAGETYPE_GIF:
          return self::TYPE_GIF;

        case IMAGETYPE_JPEG:
        case IMAGETYPE_JPEG2000:
          return self::TYPE_JPG;
      }
    } else if(is_string($imageType)) {
      $imageType = strtolower(trim($imageType));
      $semicolon = strpos($imageType, ';');
      if($semicolon) {
        $imageType = substr($imageType, 0, $semicolon);
      }
      switch($imageType) {
        case self::TYPE_PNG:
        case 'image/png':
          return self::TYPE_PNG;

        case self::TYPE_GIF:
        case 'image/gif':
          return self::TYPE_GIF;

        case self::TYPE_JPG:
        case 'image/jpg':
        case 'image/jpeg':
          return self::TYPE_JPG;
      }
    }
    return false;
  }
1125783
public ImageDescriptor getTypeImageDescriptor(
			SarlElementType type,
			boolean isInner) {
		return getTypeImageDescriptor(type, isInner, false, 0, USE_LIGHT_ICONS);
	}