示例#1
0
paths = []
locations = []
layers = []
for i in range(0, len(transforms), 8):
	alignedPatchPath = transforms[i]
	alignedPatchName = os.path.basename(alignedPatchPath)
	toAlignPatchName = alignedPatchName.replace('_' + factorString, '').replace('_resized', '')
	toAlignPatchPath = os.path.join(MagCFolder, 'EMData', os.path.basename(os.path.dirname(alignedPatchPath)), toAlignPatchName)
	toAlignPatchPath = fc.cleanLinuxPath(toAlignPatchPath[:-1])  # mysterious trailing character ...
	IJ.log('toAlignPatchPath ' + toAlignPatchPath)
	l = int(transforms[i+1])
	paths.append(toAlignPatchPath)
	locations.append([0,0])	
	layers.append(l)

importFilePath = fc.createImportFile(MagC_EM_Folder, paths, locations, layers = layers, name = namePlugin)

# insert the tiles in the project
IJ.log('I am going to insert many files at factor ' + str(downsamplingFactor) + ' ...')
task = loader.importImages(layerset.getLayers().get(0), importFilePath, '\t', 1, 1, False, 1, 0)
task.join()

# apply the transforms
for i in range(0, len(transforms), 8):
	alignedPatchPath = transforms[i]
	alignedPatchName = os.path.basename(alignedPatchPath)
	toAlignPatchName = alignedPatchName.replace('_' + factorString, '').replace('_resized', '')
	toAlignPatchPath = os.path.join(MagCFolder, 'EMData', os.path.basename(os.path.dirname(alignedPatchPath)), toAlignPatchName)
	toAlignPatchPath = toAlignPatchPath[:-1]  # why is there a trailing something !?
	if toAlignPatchPath[:2] == os.sep + os.sep:
		toAlignPatchPath = toAlignPatchPath[1:]
示例#2
0
    IJ.log('Assembling LM sections from all layers')
    for l in range(nLayers):
        IJ.log('Each section consists of ' + str(xGrid) + ' x ' + str(yGrid) +
               ' patches')
        for y in range(yGrid):
            for x in range(xGrid):
                sectionFolder = os.path.join(LMDataFolder,
                                             'section_' + str(l).zfill(4))
                patchName = 'section_' + str(l).zfill(
                    4) + '_channel_' + channel + '_tileId_' + str(x).zfill(
                        2) + '-' + str(y).zfill(2) + '-tissue.tif'
                patchPath = os.path.join(sectionFolder, patchName)
                paths.append(patchPath)
                locations.append([x * widthEffective, y * heightEffective])
                layers.append(l)
# import all tiles
importFile = fc.createImportFile(LMFolder, paths, locations, layers=layers)
task = loader.importImages(layerset.getLayers().get(0), importFile, '\t', 1, 1,
                           False, 1, 0)
task.join()

# resize display and save
fc.resizeDisplay(layerset)
time.sleep(5)
project.save()
time.sleep(1)
fc.closeProject(project)
IJ.log('Assembling the LM project done and saved into ' + projectPath)

fc.terminatePlugin(namePlugin, MagCFolder)