public ImgWriterPGM(IFileInfo out_Renamed, BlkImgDataSrc imgSrc, int c)
{
// Check that imgSrc is of the correct type
// Check that the component index is valid
if (c < 0 || c >= imgSrc.NumComps)
{
throw new System.ArgumentException("Invalid number of components");
}
// Check that imgSrc is of the correct type
if (imgSrc.getNomRangeBits(c) > 8)
{
FacilityManager.getMsgLogger().println("Warning: Component " + c + " has nominal bitdepth " + imgSrc.getNomRangeBits(c) + ". Pixel values will be " + "down-shifted to fit bitdepth of 8 for PGM file", 8, 8);
}
// Initialize
if (out_Renamed.Exists && !out_Renamed.Delete())
{
throw new System.IO.IOException("Could not reset file");
}
this.out_Renamed = SupportClass.RandomAccessFileSupport.CreateRandomAccessFile(out_Renamed, "rw");
src = imgSrc;
this.c = c;
w = imgSrc.ImgWidth;
h = imgSrc.ImgHeight;
fb = imgSrc.getFixedPoint(c);
levShift = 1 << (imgSrc.getNomRangeBits(c) - 1);
writeHeaderInfo();
}