00001 """
00002 Contains the N-D contourlet transform.
00003 These are the Surfacelet helper functions.
00004 """
00005
00006 __copyright__ = """
00007 Copyright 2008 Sean Ross-Ross
00008 """
00009 __license__ = """
00010 This file is part of SLIMpy .
00011
00012 SLIMpy is free software: you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as published by
00014 the Free Software Foundation, either version 3 of the License, or
00015 (at your option) any later version.
00016
00017 SLIMpy is distributed in the hope that it will be useful,
00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 GNU Lesser General Public License for more details.
00021
00022 You should have received a copy of the GNU Lesser General Public License
00023 along with SLIMpy . If not, see <http://www.gnu.org/licenses/>.
00024 """
00025
00026 import re
00027
00028 def surfSpaceChange( command, space, *spaces ):
00029 """
00030 Applies the forward space change. Converts it to a Linear
00031 array of values. Works in N-D
00032 """
00033 nDim = 0
00034 nTotal = 1
00035 for cmd in space.keys():
00036 if re.match( '^n\d+$', cmd ):
00037 nTotal = nTotal * space[cmd]
00038 space[cmd+'_orig'] = space[cmd]
00039 space[cmd] = 1
00040 nDim += 1
00041
00042
00043 nRed = 4.25
00044 if command['Pyr_Level'] == 2 and nDim == 2: nRed = 4.25
00045 elif command['Pyr_Level'] == 3 and nDim == 2: nRed = 4.5625
00046 elif command['Pyr_Level'] == 4 and nDim == 2: nRed = 4.640625
00047 elif command['Pyr_Level'] == 5 and nDim == 2: nRed = 4.66015625
00048 elif command['Pyr_Level'] == 2 and nDim == 3: nRed = 6.125
00049 elif command['Pyr_Level'] == 3 and nDim == 3: nRed = 6.390625
00050 elif command['Pyr_Level'] == 4 and nDim == 3: nRed = 6.423828125
00051 elif command['Pyr_Level'] == 5 and nDim == 3: nRed = 6.427978515625
00052
00053 space['n1'] = nTotal * nRed
00054
00055 def surfInvSpaceChange( command, space, *spaces ):
00056 """
00057 Applies the reverse space change. This takes into concideration
00058 the adjoint and the inverse operators. Works in N-D.
00059 """
00060 for cmd in space.keys():
00061 if re.match( '^n\d+$', cmd ):
00062 space[cmd] = space[cmd+'_orig']