CSJ2K.j2k.wavelet.Subband.getSubband C# (CSharp) Method

getSubband() public method

Returns a reference to the Subband element to which the specified point belongs. The specified point must be inside this (i.e. the one defined by this object) subband. This method searches through the tree.
public getSubband ( int x, int y ) : Subband
x int horizontal coordinate of the specified point. /// ///
y int horizontal coordinate of the specified point. /// ///
return Subband
        public virtual Subband getSubband(int x, int y)
        {
            Subband cur, hhs;

            // Check that we are inside this subband
            if (x < ulx || y < uly || x >= ulx + w || y >= uly + h)
            {
                throw new System.ArgumentException();
            }

            cur = this;
            while (cur.isNode)
            {
                hhs = cur.HH;
                // While we are still at a node -> continue
                if (x < hhs.ulx)
                {
                    // Is the result of horizontal low-pass
                    if (y < hhs.uly)
                    {
                        // Vertical low-pass
                        cur = cur.LL;
                    }
                    else
                    {
                        // Vertical high-pass
                        cur = cur.LH;
                    }
                }
                else
                {
                    // Is the result of horizontal high-pass
                    if (y < hhs.uly)
                    {
                        // Vertical low-pass
                        cur = cur.HL;
                    }
                    else
                    {
                        // Vertical high-pass
                        cur = cur.HH;
                    }
                }
            }

            return cur;
        }