예제 #1
0
def main(argv=None):
    """
    This is the main function that is called when you run 'intialize.py'.
    
    Here, you will load the configuration settings specified in the toml configuration 
    file, initiate the class dataInterface, and set up some directories and other 
    important things through 'initialize()'
    """

    # define the parameters that will be recognized later on to set up fileIterface
    argParser = argparse.ArgumentParser()
    argParser.add_argument('--config',
                           '-c',
                           default=defaultConfig,
                           type=str,
                           help='experiment config file (.json or .toml)')
    argParser.add_argument('--runs',
                           '-r',
                           default='',
                           type=str,
                           help='Comma separated list of run numbers')
    argParser.add_argument('--scans',
                           '-s',
                           default='',
                           type=str,
                           help='Comma separated list of scan number')
    args = argParser.parse_args(argv)

    print('Initializing directories and configurations')

    # establish the RPC connection to the projectInterface
    clientInterface = ClientInterface()
    dataInterface = clientInterface.dataInterface
    args.dataRemote = clientInterface.isDataRemote()

    # load the experiment configuration file
    cfg = utils.loadConfigFile(args.config)
    cfg = initialize(cfg, args)

    # build subject folders on server
    if args.dataRemote:
        print('Files Remote Case')

        buildSubjectFoldersOnServer(cfg)

        # next, transfer transformation files from local --> server for online processing
        uploadFolderToCloud(dataInterface, cfg.local.wf_dir, cfg.server.wf_dir)

        # upload ROI folder to cloud server - we would need to do this if we were using
        # a standard mask, but we're not in this case
        #uploadFolderToCloud(dataInterface, cfg.local.maskDir, cfg.server.maskDir)

        # upload all transformed masks to the cloud
        uploadFilesFromList(dataInterface, cfg.local_MASK_transformed,
                            cfg.subject_reg_dir)

    print('Initialization Complete!')
    return 0
예제 #2
0
 def test_runWithInitWatch(self):
     print("\nSampleProject::test_runWithDataRemote")
     TestSampleProject.serversForTests.stopServers()
     TestSampleProject.serversForTests.startServers(
         allowedDirs=allowedDirs,
         allowedFileTypes=allowedFileTypes,
         dataRemote=True)
     client = ClientInterface()
     assert client.isDataRemote() == True
     argv = ['--useInitWatch', '--noVerbose']
     ret = sample.main(argv)
     assert ret == 0
예제 #3
0
 def test_runWithDataRemote(self):
     print("\nOpenNeuroClient::test_runWithDataRemote")
     TestOpenNeuroClient.serversForTests.stopServers()
     TestOpenNeuroClient.serversForTests.startServers(
         allowedDirs=allowedDirs,
         allowedFileTypes=allowedFileTypes,
         dataRemote=True,
         projectArgs=openNeuroArgs)
     client = ClientInterface()
     assert client.isDataRemote() == True
     argv = ['--archive']
     ret = openNeuroClient.main(argv)
     assert ret == 0
예제 #4
0
 def test_rpyclocalDataInterface(self, dicomTestFilename, bigTestFile):
     # Use a remote (RPC) client to the dataInterface
     TestDataInterface.serversForTests.stopServers()
     TestDataInterface.serversForTests.startServers(allowedDirs=allowedDirs,
                                                    allowedFileTypes=allowedFileTypes,
                                                    dataRemote=False,
                                                    subjectRemote=False)
     clientInterface = ClientInterface()
     dataInterface = clientInterface.dataInterface
     assert clientInterface.isDataRemote() == False
     assert dataInterface.isRemote == False
     runDataInterfaceMethodTests(dataInterface, dicomTestFilename)
     runReadWriteFileTest(dataInterface, bigTestFile)
     return