def FilterGenerator():
    class PrintPmPerceptualError(PrintFilter):
        def __init__(self):
            super(PrintPmPerceptualError, self).__init__('print_pm_perceptual_error',
                    'Prints perceptual error at different levels of a progressive mesh compared to full resolution')
            
            self.arguments.append(FileArgument("pm_file", "Path of the progressive mesh file. Specify NONE if no pm file."))
            self.arguments.append(FileArgument("mipmap_tar_file", "Path of the tar file with mipmap levels in it"))
            
        def apply(self, mesh, pm_filename, mipmap_tarfilename):
            try:
                pm_filebuf = open(pm_filename, 'r') if pm_filename != 'NONE' else None
            except IOError, ex:
                raise FilterException("Error opening pm file: %s" % str(ex))
            
            try:
                mipmap_tarfilebuf = open(mipmap_tarfilename, 'rb')
            except __HOLE__, ex:
                raise FilterException("Error opening mipmap tar: %s" % str(ex))
            
            perceptualdiff = which('perceptualdiff')
            if perceptualdiff is None:
                raise FilterException("perceptualdiff exectuable not found on path")
            
            printPmPerceptualError(mesh, pm_filebuf, mipmap_tarfilebuf)
            return mesh
    
    return PrintPmPerceptualError()
dataset/ETHPy150Open pycollada/meshtool/meshtool/filters/print_filters/print_pm_perceptual_error.py/FilterGenerator