e = sys.exc_info()[0] print("Error: {0}".format(e)) # sys.exit() outputStosList = [] for i in range(len(sliceNums) - 1): index = sliceNums[i] nextIndex = sliceNums[i + 1] inputFixed = outputMosaicList[i] inputMoving = outputMosaicList[i + 1] print("Assembling Volume with slice: {0}".format(inputMoving)) outputStos = "{0}/{1}-{2}.stos".format(testRoot, index, nextIndex) print(outputStos) outputStosList.append(outputStos) seg3d2.slicetoslicebrutefilter( layerid=layerid, input_fixed=inputFixed, input_moving=inputMoving, output_stos=outputStos, shrink_factor=shrinkFactor, ) outputVolumeDir = "{0}/vol".format(testRoot) seg3d2.slicetovolumefilter( layerid=layerid, input_files=outputStosList, output_prefixes=[outputVolumeDir], image_dirs=imageDirList, shrink_factor=1, )
index, nextIndex)) outputName = "{0}_{1}".format(datasetName, index) nextOutputName = "{0}_{1}".format(datasetName, nextIndex) mosaicFixed = "{0}/{1}{2}".format(fftDir, outputName, mosaicExtension) if not os.path.isfile(mosaicFixed): break mosaicMoving = "{0}/{1}{2}".format(fftDir, nextOutputName, mosaicExtension) if not os.path.isfile(mosaicMoving): break stosOutputStos = "{0}/{1}_{2}_{3}{4}".format(stosDir, datasetName, index, nextIndex, stosExtension) seg3d2.slicetoslicebrutefilter(layerid=layerid, shrink_factor=shrinkFactor, input_fixed=mosaicFixed, input_moving=mosaicMoving, output_stos=stosOutputStos) stosfiles = [] for f in os.listdir(stosDir): if f.endswith(stosExtension): stosPath = "%s/%s" % (stosDir, f) stosfiles.append(stosPath) # Full resolution volume. #volumeShrinkFactor = 1 volumeShrinkFactor = 8 # There is a hard limit on image size in Seg3D in the renderer: no dimension can be > 4096 seg3d2.slicetovolumefilter(layerid=layerid,
shrink_factor=shrinkFactor, feathering="blend") fixedIndex = 1 inputFixed = outputMosaicList[0] print(inputFixed) outputStosList = [] for index in range(firstIndex, lastIndex): nextIndex = index + 1 inputMoving = outputMosaicList[index] print(inputMoving) outputStos = '{0}/stos/mv{1}{2}.stos'.format(testRoot2, fixedIndex, nextIndex) print(outputStos) outputStosList.append(outputStos) seg3d2.slicetoslicebrutefilter(layerid=layerid, input_fixed=inputFixed, input_moving=inputMoving, output_stos=outputStos, shrink_factor=shrinkFactor) print(imageDirList) seg3d2.slicetovolumefilter(layerid=layerid, input_files=outputStosList, output_prefixes=[outputVolumeDir], image_dirs=imageDirList, shrink_factor=shrinkFactor, load_volume=True)
for index in range(rangeMin, stosRangeMax): next_index = index + 1 print('index={0}, next_index={1}'.format(index, next_index)) outputName = "{0}_{1}".format(datasetName, index) nextOutputName = "{0}_{1}".format(datasetName, next_index) mosaicFixed = "{0}/{1}{2}".format(fftDir, outputName, mosaicExtension) if not os.path.isfile(mosaicFixed): break mosaicMoving = "{0}/{1}{2}".format(fftDir, nextOutputName, mosaicExtension) if not os.path.isfile(mosaicMoving): break stosOutputStos = "{0}/{1}_{2}_{3}{4}".format(stosDir, datasetName, index, next_index, stosExtension) seg3d2.slicetoslicebrutefilter(layerid=layerid, shrink_factor=shrinkFactor, input_fixed=mosaicFixed, input_moving=mosaicMoving, output_stos=stosOutputStos) stosfiles = [] for f in os.listdir(stosDir): if f.endswith(stosExtension): stosPath = "%s/%s" % (stosDir, f) stosfiles.append(stosPath) # TODO: error, make test #stosfiles.append(f) print(stosfiles) prefix = [volumeDir] imageDirs = [testRoot] seg3d2.slicetovolumefilter(layerid=layerid, input_files=stosfiles, output_prefixes=prefix, image_dirs=imageDirs, shrink_factor=volumeShrinkFactor)