public static GImageGray wrap( ImageGray image ) { if( image.getClass() == GrayU8.class ) return new GSingle_U8( (GrayU8)image ); else if( image.getClass() == GrayS8.class ) return new GSingle_S8( (GrayS8)image ); else if( image.getClass() == GrayU16.class ) return new GSingle_U16( (GrayU16)image ); else if( image.getClass() == GrayS16.class ) return new GSingle_S16( (GrayS16)image ); else if( image.getClass() == GrayS32.class ) return new GSingle_S32( (GrayS32)image ); else if( image.getClass() == GrayS64.class ) return new GSingle_I64( (GrayS64)image ); else if( image.getClass() == GrayF32.class ) return new GSingle_F32( (GrayF32)image ); else if( image.getClass() == GrayF64.class ) return new GSingle_F64( (GrayF64)image ); else throw new IllegalArgumentException("Unknown image type: "+image.getClass()); }
public static GImageGray create( Class imageType ) { if( imageType == GrayU8.class ) return new GSingle_U8(null); else if( imageType == GrayS8.class ) return new GSingle_S8( null ); else if( imageType == GrayU16.class ) return new GSingle_U16( null ); else if( imageType == GrayS16.class ) return new GSingle_S16( null ); else if( imageType == GrayS32.class ) return new GSingle_S32( null ); else if( imageType == GrayS64.class ) return new GSingle_I64( null ); else if( imageType == GrayF32.class ) return new GSingle_F32( null ); else if( imageType == GrayF64.class ) return new GSingle_F64( null ); else throw new IllegalArgumentException("Unknown image type: "+imageType); }