CSJ2K.j2k.wavelet.analysis.ForwardWT.createInstance C# (CSharp) Method

createInstance() public static method

Creates a ForwardWT object with the specified filters, and with other options specified in the parameter list 'pl'.
If mandatory parameters are missing /// or if invalid values are given. /// ///
public static createInstance ( BlkImgDataSrc src, CSJ2K.j2k.util.ParameterList pl, CSJ2K.j2k.encoder.EncoderSpecs encSpec ) : ForwardWT
src BlkImgDataSrc The source of data to be transformed /// ///
pl CSJ2K.j2k.util.ParameterList The parameter list (or options). /// ///
encSpec CSJ2K.j2k.encoder.EncoderSpecs
return ForwardWT
        public static ForwardWT createInstance(BlkImgDataSrc src, ParameterList pl, EncoderSpecs encSpec)
        {
            int deflev; // defdec removed
            //System.String decompstr;
            //System.String wtstr;
            //System.String pstr;
            //SupportClass.StreamTokenizerSupport stok;
            //SupportClass.Tokenizer strtok;
            //int prefx, prefy; // Partitioning reference point coordinates

            // Check parameters
            pl.checkList(OPT_PREFIX, CSJ2K.j2k.util.ParameterList.toNameArray(pinfo));

            deflev = ((System.Int32) encSpec.dls.getDefault());

            // Code-block partition origin
            System.String str = "";
            if (pl.getParameter("Wcboff") == null)
            {
                throw new System.InvalidOperationException("You must specify an argument to the '-Wcboff' " + "option. See usage with the '-u' option");
            }
            SupportClass.Tokenizer stk = new SupportClass.Tokenizer(pl.getParameter("Wcboff"));
            if (stk.Count != 2)
            {
                throw new System.ArgumentException("'-Wcboff' option needs two" + " arguments. See usage with " + "the '-u' option.");
            }
            int cb0x = 0;
            str = stk.NextToken();
            try
            {
                cb0x = (System.Int32.Parse(str));
            }
            catch (System.FormatException e)
            {
                throw new System.ArgumentException("Bad first parameter for the " + "'-Wcboff' option: " + str);
            }
            if (cb0x < 0 || cb0x > 1)
            {
                throw new System.ArgumentException("Invalid horizontal " + "code-block partition origin.");
            }
            int cb0y = 0;
            str = stk.NextToken();
            try
            {
                cb0y = (System.Int32.Parse(str));
            }
            catch (System.FormatException e)
            {
                throw new System.ArgumentException("Bad second parameter for the " + "'-Wcboff' option: " + str);
            }
            if (cb0y < 0 || cb0y > 1)
            {
                throw new System.ArgumentException("Invalid vertical " + "code-block partition origin.");
            }
            if (cb0x != 0 || cb0y != 0)
            {
                FacilityManager.getMsgLogger().printmsg(CSJ2K.j2k.util.MsgLogger_Fields.WARNING, "Code-blocks partition origin is " + "different from (0,0). This is defined in JPEG 2000" + " part 2 and may be not supported by all JPEG 2000 " + "decoders.");
            }

            return new ForwWTFull(src, encSpec, cb0x, cb0y);
        }