def statsAsCSV(self):
    csv = ""
    header = ""
    for k in self.keys[:-1]:
      header += "\"%s\"" % k + ","
    header += "\"%s\"" % self.keys[-1] + "\n"
    csv = header
    for i in self.labelStats["Labels"]:
      line = ""
      for k in self.keys[:-1]:
        line += str(self.labelStats[i,k]) + ","
      line += str(self.labelStats[i,self.keys[-1]]) + "\n"
      csv += line
    return csv
print comma separated value file with header keys in quotes
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/ParenchymaAnalysis/ParenchymaAnalysis.py/ParenchymaAnalysisLogic.statsAsCSV