@@ -68,6 +68,11 @@ def log(text):
6868 """
6969 Adds the text to a list of logs. Compiled into figure legend at the end.
7070 """
71+ # Handle unicode
72+ try :
73+ text = text .encode ('utf8' )
74+ except :
75+ pass
7176 print text
7277 logStrings .append (text )
7378
@@ -474,7 +479,7 @@ def makeSplitViewFigure(conn, pixelIds, zStart, zEnd, splitIndexes,
474479 rgba = (0 , 0 , 0 , 255 )
475480 if index in mergedColours :
476481 rgba = tuple (mergedColours [index ])
477- print index , channelNames [index ], rgba
482+ log ( "%s %s %s" % ( index , channelNames [index ], rgba ))
478483 if rgba == (255 , 255 , 255 , 255 ): # if white (unreadable),
479484 # needs to be black!
480485 rgba = (0 , 0 , 0 , 255 )
@@ -515,16 +520,16 @@ def splitViewFigure(conn, scriptParams):
515520 # function for getting image labels.
516521 def getImageNames (fullName , tagsList , pdList ):
517522 name = fullName .split ("/" )[- 1 ]
518- return [name ]
523+ return [name . decode ( 'utf8' ) ]
519524
520525 # default function for getting labels is getName (or use datasets / tags)
521526 if scriptParams ["Image_Labels" ] == "Datasets" :
522527 def getDatasets (name , tagsList , pdList ):
523- return [dataset for project , dataset in pdList ]
528+ return [dataset . decode ( 'utf8' ) for project , dataset in pdList ]
524529 getLabels = getDatasets
525530 elif scriptParams ["Image_Labels" ] == "Tags" :
526531 def getTags (name , tagsList , pdList ):
527- return tagsList
532+ return [ t . decode ( 'utf8' ) for t in tagsList ]
528533 getLabels = getTags
529534 else :
530535 getLabels = getImageNames
@@ -603,7 +608,7 @@ def getTags(name, tagsList, pdList):
603608 cNameMap = scriptParams ["Channel_Names" ]
604609 for c in cNameMap :
605610 index = int (c )
606- channelNames [index ] = cNameMap [c ]
611+ channelNames [index ] = cNameMap [c ]. decode ( 'utf8' )
607612
608613 mergedIndexes = [] # the channels in the combined image,
609614 mergedColours = {}
0 commit comments