CSJ2K.j2k.image.output.ImgWriterPGM.ImgWriterPGM C# (CSharp) Method

ImgWriterPGM() public method

Creates a new writer to the specified File object, to write data from the specified component.

The size of the image that is written to the file is the size of the component from which to get the data, specified by b, not the size of the source image (they differ if there is some sub-sampling).

public ImgWriterPGM ( IFileInfo out_Renamed, BlkImgDataSrc imgSrc, int c ) : System
out_Renamed IFileInfo
imgSrc BlkImgDataSrc The source from where to get the image data to write. /// ///
c int The index of the component from where to get the data. /// ///
return System
        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();
        }

Same methods

ImgWriterPGM::ImgWriterPGM ( System fname, BlkImgDataSrc imgSrc, int c ) : System