def create_nc_project(self): """Creates a neuroConstruct project from the NeuroML2 file(s).""" from java.io import File from ucl.physiol.neuroconstruct.project import Project from ucl.physiol.neuroconstruct.cell.converters import MorphMLConverter project = Project.createNewProject('/Users/rgerkin/', self.model_name, None) morphDir = File( "%s/osb/showcase/neuroConstructShowcase/Ex3_Morphology/importedMorphologies/" % NC_HOME) morphmlFile = File(morphDir, "SimplePurkinjeCell.morph.xml") converter = MorphMLConverter() cell = converter.loadFromMorphologyFile(morphmlFile, "NewCell") project.cellManager.addCellType(cell) # Actually add it to the project project.cellGroupsInfo.setCellType( "DefaultCellGroup", cell.getInstanceName( )) # Set the type of an existing cell group to this project.saveProject()
print "Loading project from file: " + projFile.getAbsolutePath( ) + ", exists: " + str(projFile.exists()) pm = ProjectManager() myProject = pm.loadProject(projFile) print "Loaded project: " + myProject.getProjectName() morphDir = File( "../osb/showcase/neuroConstructShowcase/Ex3_Morphology/importedMorphologies/" ) morphmlFile = File(morphDir, "SimplePurkinjeCell.morph.xml") print "Going to load morphology from: " + morphmlFile.getCanonicalPath() converter = MorphMLConverter() cell = converter.loadFromMorphologyFile(morphmlFile, "NewCell") print "Loaded cell: " + cell.getInstanceName() + " with " + str( cell.getAllSegments().size()) + " segments" myProject.cellManager.addCellType(cell) # Actually add it to the project myProject.cellGroupsInfo.setCellType( "SampleCellGroup", cell.getInstanceName()) # Set the type of an existing cell group to this # Now the project can be generated as in Ex5_MultiSimGenerate.py # * OR * # Save project # Uncomment these lines to save the morphology in the project, then view the
projFile = File("TestPython/TestPython.neuro.xml") print "Loading project from file: " + projFile.getAbsolutePath()+", exists: "+ str(projFile.exists()) pm = ProjectManager() myProject = pm.loadProject(projFile) print "Loaded project: " + myProject.getProjectName() morphDir = File("../nCexamples/Ex3_Morphology/importedMorphologies/") morphmlFile = File(morphDir, "SimplePurkinjeCell.morph.xml") print "Going to load morphology from: " + morphmlFile.getCanonicalPath() converter = MorphMLConverter() cell = converter.loadFromMorphologyFile(morphmlFile, "NewCell") print "Loaded cell: " + cell.getInstanceName() + " with " + str(cell.getAllSegments().size()) +" segments" myProject.cellManager.addCellType(cell) # Actually add it to the project myProject.cellGroupsInfo.setCellType("SampleCellGroup", cell.getInstanceName()) # Set the type of an existing cell group to this # Now the project can be generated as in Ex5_MultiSimGenerate.py # * OR * # Save project # Uncomment these lines to save the morphology in the project, then view the