Ejemplo n.º 1
0
		if k < min(nLayers, currentWrittenLayer + nLayersAtATime):
			IJ.log('Start montaging elastically layer ' + str(k))
			if layerset.getLayers().get(k).getNDisplayables() > 1: # some EM projects have a single large tile
				AlignTask().montageLayers(params, layerset.getLayers(k, k))

namePlugin = 'montage_ElasticEM'
MagCFolder = fc.startPlugin(namePlugin)
ControlWindow.setGUIEnabled(False)

MagCParams = fc.readMagCParameters(MagCFolder)
nLayersAtATime = MagCParams[namePlugin]['nLayersAtATime']
nThreads = MagCParams[namePlugin]['nThreads']

projectPath = fc.cleanLinuxPath(fc.findFilesFromTags(MagCFolder,['EM', 'Project'])[0])

project, loader, layerset, nLayers = fc.openTrakemProject(projectPath)

IJ.log('Sleeping in case the opening of the large project takes some time ...')
time.sleep(20)

# parameters for elastic montage
params = ElasticMontage.Param().clone()
params.bmScale = 0.5
params.bmSearchRadius = 50
params.bmBlockRadius = 50

params.bmMinR = 0.1
params.bmMaxCurvatureR = 100
params.bmRodR = 1

params.bmUseLocalSmoothnessFilter = True
Ejemplo n.º 2
0
                                   regParams, use_shrinking_constraint)
    time.sleep(2)
    # IJ.getImage().close()
    WindowManager.closeAllWindows()
    IJ.log('Rigid Alignment done')
else:
    IJ.log('Rigid alignment already performed - skipping')

################################################

###########################################
IJ.log('Aligning the lowEM with the new rigid transforms')
projectPath = fc.cleanLinuxPath(
    fc.findFilesFromTags(MagCFolder,
                         ['EMProject_'])[0])  # this is the low res EM
project, loader, layerset, nLayers = fc.openTrakemProject(
    projectPath)  # the low res EM
for l, layer in enumerate(layerset.getLayers()):
    transformPath = os.path.join(
        resultRigidAlignmentFolder,
        'stitchedDownsampledEM_' + str(l).zfill(4) + '.xml')
    theList = ArrayList(HashSet())
    aff = fc.getAffFromRVSTransformPath(transformPath)

    for patch in layer.getDisplayables(Patch):
        patch.setLocation(
            patch.getX(),
            patch.getY())  # compensate for the extracted bounding box
        currentAff = patch.getAffineTransform()
        currentAff.preConcatenate(aff)
        patch.setAffineTransform(currentAff)