package pl.wroc.pwr.image.converter; import pl.wroc.pwr.IOperator; import pl.wroc.pwr.image.IGSImage; import pl.wroc.pwr.image.IRGBImage; import pl.wroc.pwr.image.model.RGBImage; import pl.wroc.pwr.imagechannel.basic.CopyChannel; public class GStoRGBConverter implements IOperator< IRGBImage > { private IGSImage inputImage; public GStoRGBConverter( IGSImage image ) { this.inputImage = image; } public void setImage( IGSImage image ) { this.inputImage = image; } public IRGBImage apply( ) { IRGBImage outputImage = new RGBImage( this.inputImage.getSize( ) ); if ( new CopyChannel( outputImage.getRedChannel( ), this.inputImage.getGrayChannel( ) ).apply( ) == null ) { return null; } if ( new CopyChannel( outputImage.getGreenChannel( ), this.inputImage.getGrayChannel( ) ).apply( ) == null ) { return null; } if ( new CopyChannel( outputImage.getBlueChannel( ), this.inputImage.getGrayChannel( ) ).apply( ) == null ) { return null; } return outputImage; } }