Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor change to auto_mindcontrol #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions auto_mindcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import shutil

parser = argparse.ArgumentParser(description='Autogenerate mindcontrol settings from a BIDS directory')
parser.add_argument('--server', action = 'store_true',
parser.add_argument('--server', action = 'store_true',
help='Start a simple file server in the bids directory.')
parser.add_argument('--meteor', action = 'store_true',
parser.add_argument('--meteor', action = 'store_true',
help='Start the meteor server that will serve mindcontrol.')
parser.add_argument('bids_dir', help='The directory with the input dataset '
'formatted according to the BIDS standard.')
Expand Down Expand Up @@ -61,7 +61,7 @@
entry_types = set()
for img in layout.get(extensions = ".nii.gz"):
img_dict = {}
img_dict["check_masks"] = [img.filename.replace(bids_dir,"")]
img_dict["check_masks"] = [os.path.relpath(img.filename, start=bids_dir)]
entry_types.add(img.type)
img_dict["entry_type"] = img.type
img_dict["metrics"] = {}
Expand All @@ -87,15 +87,15 @@
settings = {"public": pub_set}

# Write out file list to bids directory
with open(os.path.join(bids_dir,"startup.auto.json"), "w") as h:
json.dump(manifest,h)
with open(os.path.join(bids_dir, "startup.auto.json"), "w") as h:
json.dump(manifest, h)
# Write out the settings file to the mindcontrol directory
with open("settings.auto.json", "w") as h:
json.dump(settings,h)
json.dump(settings, h)

if args.server:
shutil.copy2("start_static_server.py",bids_dir)
subprocess.Popen("python start_static_server.py", cwd = bids_dir, shell = True)
shutil.copy2("start_static_server.py", bids_dir)
subprocess.Popen("python start_static_server.py", cwd=bids_dir, shell=True)
if args.meteor:
meteor = subprocess.Popen("meteor --settings settings.auto.json".split(' '))
meteor.wait()
meteor.wait()