def createDotplotFromLists(strList, idList, REQUEST): """Takes two lists - one for the texts and one containing the corresponding ids for each text and computes the Dotplot image and returns it. """ if not strList or not idList: REQUEST.RESPONSE.setHeader('Content-Type', 'text/html') msg = 'createDotplotDirectCompare has failed.'\ 'selectedResults: %s objects: %s assignments: &s'\ 'strList: %s idList: %s' % (str(selectedResults), str(objects), str(assignments), str(strList), str(idList)) return REQUEST.RESPONSE.write(msg) #compute image image = PlagVisualizer().stringListToDotplot(strList, idList=idList) imageData = StringIO() image.save(imageData, 'JPEG') REQUEST.RESPONSE.setHeader('Content-Type', 'image/jpeg') return REQUEST.RESPONSE.write(imageData.getvalue())
def createIntensityHeatmap(self): """Creates a torc using the given results. Showing the similarity relations between all suspected plagiarism pairs. """ #get REQUEST REQUEST = self.REQUEST #get PlagResults session = REQUEST.SESSION if session.has_key('results'): results = session['results'] if results == []: return None #compute image image = PlagVisualizer().resultsToIntensityHeatmap(results) imageData = StringIO() image.save(imageData, 'JPEG') if not REQUEST: REQUEST = self.REQUEST REQUEST.RESPONSE.setHeader('Content-Type', 'image/jpeg') return REQUEST.RESPONSE.write(imageData.getvalue())