def initTrakem(path, nbLayers, mipmaps = False): #initialize a project path = cleanLinuxPath(path) ControlWindow.setGUIEnabled(False) project = Project.newFSProject("blank", None, path) project.getLoader().setMipMapsRegeneration(mipmaps) layerset = project.getRootLayerSet() for i in range(nbLayers): # create the layers layerset.getLayer(i, 1, True) project.getLayerTree().updateList(layerset) #update the LayerTree Display.updateLayerScroller(layerset) # update the display slider IJ.log('TrakEM project initialized with ' + str(nbLayers) + ' layers and stored in ' + path + ' (but not saved yet)') return project
ControlWindow.setGUIEnabled(False) # 1. Create a TrakEM2 project project = Project.newFSProject("blank", None, out_folder) loader = project.getLoader() loader.setMipMapsRegeneration(True) # disable mipmaps layerset = project.getRootLayerSet() # 2. Create 10 layers (or as many as you need) for i in range(num_sections): layerset.getLayer(i, 1, True) layerset.setDimensions(im_width, im_height, LayerSet.NORTHWEST) # ... and update the LayerTree: project.getLayerTree().updateList(layerset) # ... and the display slider Display.updateLayerScroller(layerset) filenames = sorted(os.listdir(storm_merged_folder)) filenames1 = sorted(os.listdir(conv_561_folder)) filenames2 = sorted(os.listdir(conv_merged_folder)) filenames3 = sorted(os.listdir(conv_align_folder)) #3 Load in images for i, layer in enumerate(layerset.getLayers()): #i = i +150 #use this to start in the middle of a dataset filepath = os.path.join(storm_merged_folder, filenames[i]) patch = Patch.createPatch(project, filepath) # patch.updateMipMaps() layer.add(patch, False) # filepath = os.path.join(conv_merged_folder, filenames2[i]) patch = Patch.createPatch(project, filepath) # patch.updateMipMaps()