def iterMdRows(md): """ Iterate over the rows of the given metadata. """ # If md is string, take as filename and create the metadata if isinstance(md, basestring): md = xmipp.MetaData(md) row = XmippMdRow() for objId in md: row.readFromMd(md, objId) yield row
def getMdFirstRow(filename): """ Create a MetaData but only read the first row. This method should be used for validations of labels or metadata size, but the full metadata is not needed. """ md = xmipp.MetaData() md.read(filename, 1) if md.getParsedLines(): row = XmippMdRow() row.readFromMd(md, md.firstObject()) else: row = None return row
def rowFromMd(md, objId): row = XmippMdRow() row.readFromMd(md, objId) return row