def selectHierarchical(indexer, topGroup, depth): i = barIndexer.fromXML(indexer) strtc = topGroup ss = map(lambda x: set(i.unfoldSubtrees([strtc],x)), range(depth)) w=map(lambda z: ss[z]-reduce(lambda x,y: x|y, ss[1:z],set()), range(depth)) return " ".join(map(lambda x: " ".join(list(x)),reversed(w)))
parser=createOptionParser() (options, args) = parser.parse_args() # Validate command line arguments # When arguments turns out invalid, print notification and quit script if not validateOptions(options) or len(args) < 2: printRed("Invalid command line arguments. Please correct.") parser.print_help() exit(1) cafInfexFilename = args[0] structuresList = args[1:] # Atlas indexer is required in all processing cases indexer = barIndexer.fromXML(cafInfexFilename) # If recolor only is choosen, do nothing but recoloring: if options.recolorOnly: inputVolReader = mergerStructPtsReader(options.inputLabeledVolume) colorMapper = barIndexerColorMapper(indexer) colorMapper.SetInput(inputVolReader.GetOutput()) colorMapper.save(options.oColorFilename) exit(0) # In all further cases volume integrator will be required, # define him here: integrator = volumeIntegrator(indexer, options.workingDir) # Merging from file list: if options.mergeList: