def DuplicateMetaDataSet(self, input):
     '''
      Duplicate a metadataset from a metadataset,
      this is a static method returning a new object, to be deleted outside the method
      @param input: vtkMetaDataSet
      @rtype: vtkMetaDataSet
     '''
     metadataset=None
     dataset=None
     type=0
     
     if input.getType()==vtkPythonMetaDataSet.VTK_META_SURFACE_MESH:
         type=vtkPythonMetaDataSet.VTK_META_SURFACE_MESH
         metadataset=vtkPythonMetaSurfaceMesh()
         dataset=vtk.vtkPolyData()
     elif input.getType()==vtkPythonMetaDataSet.VTK_META_VOLUME_MESH:
         type=vtkPythonMetaDataSet.VTK_META_VOLUME_MESH
         metadataset=vtkPythonMetaVolumeMesh()
         dataset=vtk.vtkUnstructuredGrid()
     elif input.getType()==vtkPythonMetaDataSet.VTK_META_IMAGE_DATA:
         type=vtkPythonMetaDataSet.VTK_META_IMAGE_DATA
         metadataset=vtkPythonMetaImageData()
         dataset=vtk.vtkImageData()
     else:
         return None
     if input.getDataSet():
         dataset.DeepCopy(input.getDataSet())
     metadataset.CopyInformation(input)
     metadataset.setDataSet(dataset)
     metadataset.setProperty(input.getProperty())
     
     del dataset
     
     return metadataset
    def ReadFile(self, filename, name=None, forsequence=False):
        '''
        Only method to get a sequence of the manager from its index.
         returns NULL pointer if out of range.
         @param filename: str
         @param name: str
         @param forsequence: bool
         @rtype: vtkMetaDataSet
        '''
        if os.path.isdir(filename):
            return self.ScanDirectoryForSequence(filename)
        type=vtkPythonMetaDataSet.VTK_META_UNKNOWN
        
        if type==vtkPythonMetaDataSet.VTK_META_UNKNOWN:
            metadataset=vtkPythonMetaVolumeMesh()
            if metadataset.CanReadFile(filename):
                type=vtkPythonMetaDataSet.VTK_META_VOLUME_MESH
        if type==vtkPythonMetaDataSet.VTK_META_UNKNOWN:
            metadataset=vtkPythonMetaSurfaceMesh()
            if metadataset.CanReadFile(filename):
                type=vtkPythonMetaDataSet.VTK_META_SURFACE_MESH
        if type==vtkPythonMetaDataSet.VTK_META_UNKNOWN:
            metadataset=vtkPythonMetaImageData()
            if metadataset.CanReadFile(filename):
                type=vtkPythonMetaDataSet.VTK_META_IMAGE_DATA
        if type==vtkPythonMetaDataSet.VTK_META_UNKNOWN:
            metadataset=vtkPythonMetaDataSetSequence()
            if metadataset.CanReadFile(filename):
                type=vtkPythonMetaDataSet.VTK_META_IMAGE_DATA
        if type==vtkPythonMetaDataSet.VTK_META_UNKNOWN:
            print "unknown file format : %s"%(filename)
            raise IOError, "Unrecognized File Type!"
        
        try:
            metadataset.Read(filename)
            if name==None:
                metadataset.setName(os.path.splitext(os.path.split(filename)[1])[0])
            else:
                metadataset.setName(name)
            self.AddMetaDataSet(metadataset)
#            del metadataset
            
            return metadataset
        except:
#            del metadataset
            raise IOError
        return None