docs: public static void convert( ImageBase input , ImageBase output ) {
  
  		ImageType typeIn = input.getImageType();
  		ImageType typeOut = output.getImageType();
  
  		if( input instanceof ImageGray) {
  			ImageGray sb = (ImageGray)input;
  			if( output instanceof ImageGray) {
  				if (input.getClass() == output.getClass()) {
  					output.setTo(input);
  				} else {
  					try {
  						Method m = ConvertImage.class.getMethod("convert", input.getClass(), output.getClass());
  						m.invoke(null, input, output);
  					} catch (Exception e) {
  						throw new IllegalArgumentException("Unknown conversion. "+
  								input.getClass().getSimpleName()+" to "+output.getClass().getSimpleName());
  					}
  				}
  			} else if( output instanceof Planar) {
  				Planar ms = (Planar)output;
  				for (int i = 0; i < ms.getNumBands(); i++) {
  					convert(input,ms.getBand(i));
  				}
  			} else if( output instanceof ImageInterleaved ) {
  				ImageInterleaved il = (ImageInterleaved)output;
  				for (int i = 0; i < il.getNumBands(); i++) {
  					GImageMiscOps.insertBand(sb, i, il);
  				}
  			}
  		} else if( input instanceof ImageInterleaved && output instanceof ImageInterleaved )  {
  			if( input.getClass() == output.getClass() ) {
  				output.setTo(input);
  			} else {
  				try {
  					Method m = ConvertImage.class.getMethod("convert", input.getClass(), output.getClass());
  					m.invoke(null, input, output);
  				} catch (Exception e) {
  					throw new IllegalArgumentException("Unknown conversion. "+
  							input.getClass().getSimpleName()+" to "+output.getClass().getSimpleName());
  				}
  			}
  		} else if( input instanceof Planar && output instanceof ImageGray)  {
  			Planar mi = (Planar)input;
  			ImageGray so = (ImageGray)output;
  
  			if( mi.getImageType().getDataType() != so.getDataType() ) {
  				int w = output.width;
  				int h = output.height;
  				ImageGray tmp = GeneralizedImageOps.createSingleBand(mi.getImageType().getDataType(),w,h);
  				average(mi,tmp);
  				convert(tmp,so);
  			} else {
  				average(mi,so);
  			}
  		} else if( input instanceof Planar && output instanceof ImageInterleaved )  {
  			String functionName;
  			if( typeIn.getDataType() == typeOut.getDataType()) {
  				functionName = "convert";
  			} else {
  				functionName = "convert"+typeIn.getDataType()+typeOut.getDataType();
  			}
  			try {
  				Method m = ConvertImage.class.getMethod(functionName, input.getClass(), output.getClass());
  				m.invoke(null, input, output);
  			} catch (Exception e) {
  				throw new IllegalArgumentException("Unknown conversion. " +
  						input.getClass().getSimpleName() + " to " + output.getClass().getSimpleName());
  			}
  		} else if( input instanceof Planar && output instanceof Planar) {
  			Planar mi = (Planar) input;
  			Planar mo = (Planar) output;
  
  			if (mi.getBandType() == mo.getBandType()) {
  				mo.setTo(mi);
  			} else {
  				for (int i = 0; i < mi.getNumBands(); i++) {
  					convert(mi.getBand(i), mo.getBand(i));
  				}
  			}
  		} else if( input instanceof ImageInterleaved && output instanceof Planar)  {
  			String functionName;
  			if( typeIn.getDataType() == typeOut.getDataType()) {
  				functionName = "convert";
  			} else {
  				functionName = "convert"+typeIn.getDataType()+typeOut.getDataType();
  			}
  			try {
  				Method m = ConvertImage.class.getMethod(functionName, input.getClass(), output.getClass());
  				m.invoke(null, input, output);
  			} catch (Exception e) {
  				throw new IllegalArgumentException("Unknown conversion. "+
  						input.getClass().getSimpleName()+" to "+output.getClass().getSimpleName());
  			}
  		} else if( input instanceof ImageInterleaved && output instanceof ImageGray)  {
  			ImageInterleaved mb = (ImageInterleaved)input;
  			ImageGray so = (ImageGray)output;
  
  			if( mb.getImageType().getDataType() != so.getDataType() ) {
  				int w = output.width;
  				int h = output.height;
  				ImageGray tmp = GeneralizedImageOps.createSingleBand(mb.getImageType().getDataType(),w,h);
  				average(mb,tmp);
  				convert(tmp,so);
  			} else {
  				average(mb,so);
  			}
  		} else {
  			String nameInput = input.getClass().getSimpleName();
  			String nameOutput = output.getClass().getSimpleName();
  			throw new IllegalArgumentException("Don't know how to convert between input types. "+nameInput+" "+nameOutput);
  		}
  	}