Exemplo n.º 1
0
        /// <summary> Splits the current subband in its four subbands. It changes the status
        /// of this element (from a leaf to a node, and sets the filters), creates
        /// the childs and initializes them. An IllegalArgumentException is thrown
        /// if this subband is not a leaf.
        ///
        /// <p>It uses the initChilds() method to initialize the childs.</p>
        ///
        /// </summary>
        /// <param name="hfilter">The horizontal wavelet filter used to decompose this
        /// subband. It has to be a AnWTFilter object.
        ///
        /// </param>
        /// <param name="vfilter">The vertical wavelet filter used to decompose this
        /// subband. It has to be a AnWTFilter object.
        ///
        /// </param>
        /// <returns> A reference to the LL leaf (subb_LL).
        ///
        /// </returns>
        /// <seealso cref="Subband.initChilds">
        ///
        /// </seealso>
        protected internal override Subband split(WaveletFilter hfilter, WaveletFilter vfilter)
        {
            // Test that this is a node
            if (isNode)
            {
                throw new System.ArgumentException();
            }

            // Modify this element into a node and set the filters
            isNode       = true;
            this.hFilter = (AnWTFilter)hfilter;
            this.vFilter = (AnWTFilter)vfilter;

            // Create childs
            subb_LL = new SubbandAn();
            subb_LH = new SubbandAn();
            subb_HL = new SubbandAn();
            subb_HH = new SubbandAn();

            // Assign parent
            subb_LL.parentband = this;
            subb_HL.parentband = this;
            subb_LH.parentband = this;
            subb_HH.parentband = this;

            // Initialize childs
            initChilds();

            // Return reference to LL subband
            return(subb_LL);
        }
Exemplo n.º 2
0
 /// <summary> Parse filters from the given word
 ///
 /// </summary>
 /// <param name="word">String to parse
 ///
 /// </param>
 /// <returns> Analysis wavelet filter (first dimension: by direction,
 /// second dimension: by decomposition levels)
 /// </returns>
 private AnWTFilter[][] parseFilters(System.String word)
 {
     AnWTFilter[][] filt = new AnWTFilter[2][];
     for (int i = 0; i < 2; i++)
     {
         filt[i] = new AnWTFilter[1];
     }
     if (word.ToUpper().Equals("w5x3".ToUpper()))
     {
         filt[0][0] = new AnWTFilterIntLift5x3();
         filt[1][0] = new AnWTFilterIntLift5x3();
         return(filt);
     }
     else if (word.ToUpper().Equals("w9x7".ToUpper()))
     {
         filt[0][0] = new AnWTFilterFloatLift9x7();
         filt[1][0] = new AnWTFilterFloatLift9x7();
         return(filt);
     }
     else
     {
         throw new System.ArgumentException("Non JPEG 2000 part I filter: " + word);
     }
 }
Exemplo n.º 3
0
        /// <summary> Splits the current subband in its four subbands. It changes the status
        /// of this element (from a leaf to a node, and sets the filters), creates
        /// the childs and initializes them. An IllegalArgumentException is thrown
        /// if this subband is not a leaf.
        /// 
        /// <p>It uses the initChilds() method to initialize the childs.</p>
        /// 
        /// </summary>
        /// <param name="hfilter">The horizontal wavelet filter used to decompose this
        /// subband. It has to be a AnWTFilter object.
        /// 
        /// </param>
        /// <param name="vfilter">The vertical wavelet filter used to decompose this
        /// subband. It has to be a AnWTFilter object.
        /// 
        /// </param>
        /// <returns> A reference to the LL leaf (subb_LL).
        /// 
        /// </returns>
        /// <seealso cref="Subband.initChilds">
        /// 
        /// </seealso>
        protected internal override Subband split(WaveletFilter hfilter, WaveletFilter vfilter)
        {
            // Test that this is a node
            if (isNode)
            {
                throw new System.ArgumentException();
            }

            // Modify this element into a node and set the filters
            isNode = true;
            this.hFilter = (AnWTFilter) hfilter;
            this.vFilter = (AnWTFilter) vfilter;

            // Create childs
            subb_LL = new SubbandAn();
            subb_LH = new SubbandAn();
            subb_HL = new SubbandAn();
            subb_HH = new SubbandAn();

            // Assign parent
            subb_LL.parentband = this;
            subb_HL.parentband = this;
            subb_LH.parentband = this;
            subb_HH.parentband = this;

            // Initialize childs
            initChilds();

            // Return reference to LL subband
            return subb_LL;
        }
Exemplo n.º 4
0
		/// <summary> Parse filters from the given word
		/// 
		/// </summary>
		/// <param name="word">String to parse
		/// 
		/// </param>
		/// <returns> Analysis wavelet filter (first dimension: by direction,
		/// second dimension: by decomposition levels)
		/// </returns>
		private AnWTFilter[][] parseFilters(System.String word)
		{
			AnWTFilter[][] filt = new AnWTFilter[2][];
			for (int i = 0; i < 2; i++)
			{
				filt[i] = new AnWTFilter[1];
			}
			if (word.ToUpper().Equals("w5x3".ToUpper()))
			{
				filt[0][0] = new AnWTFilterIntLift5x3();
				filt[1][0] = new AnWTFilterIntLift5x3();
				return filt;
			}
			else if (word.ToUpper().Equals("w9x7".ToUpper()))
			{
				filt[0][0] = new AnWTFilterFloatLift9x7();
				filt[1][0] = new AnWTFilterFloatLift9x7();
				return filt;
			}
			else
			{
				throw new System.ArgumentException("Non JPEG 2000 part I filter: " + word);
			}
		}