Skip to content

Commit

Permalink
changes done at the relaunch
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicDorval committed Oct 10, 2024
1 parent 05ba1ef commit f03d56d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
13 changes: 9 additions & 4 deletions li2mni/make_mni_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,23 @@ def cohorte(li2mni_path, output_path, norm=False, site=False,
dot per inch of the png created.
"""
list_sub = [i for i in os.listdir(li2mni_path) if i.startswith('sub')]
print(list_sub, len(list_sub))
print(list_sub)
print(len(list_sub))
for sub in list_sub:
template = f"{li2mni_path}/{sub}/ses-M03Li/li2mnianat.nii.gz"
template = f"{li2mni_path}/{sub}/ses-M03Li/lianat2mni.nii.gz"
assert os.path.isfile(template), f"file not found : {template}"
if norm is False:
overlay = f"{li2mni_path}/{sub}/ses-M03Li/li2mni.nii.gz"
output = os.path.join(output_path, f"{sub}_overlay_mni")
assert os.path.isfile(template), f"file not found : {overlay}"
else:
overlay = f"{li2mni_path}/{sub}/ses-M03Li/li2mninorm.nii.gz"
assert os.path.isfile(template), f"file not found : {overlay}"
output = os.path.join(output_path, f"{sub}_overlay_mni_norm")

if os.path.isfile(template) and os.path.isfile(overlay)\
and os.path.isfile(output + ".png") is False:
print("la")
print(f"Making {sub}")
print(os.path.isfile(output))
print(output)
overlay_nifti(template, overlay, output, dpi=dpi)
Expand All @@ -91,8 +95,9 @@ def cohorte(li2mni_path, output_path, norm=False, site=False,
f"_site-{site}_over"))
if os.path.isfile(file_to_check) is False:
shutil.copy2(os.path.join(path, png), file_to_check)
print('copy done')
liste_site.append(site)
print('cp done')

if pdf:
for site in set(liste_site):
images = []
Expand Down
5 changes: 2 additions & 3 deletions li2mni/runtime1.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,9 @@ def run(datadir, outdir, name="li2mni", process=False, njobs=10,
lianat_file=lianat_files,
hanat_file=hanat_files,
outdir=sub_outdirs,
hopla_name_replace=True,
hopla_iterative_kwargs=["li-file", "lianat-file", "hanat-file",
hopla_iterative_kwargs=["li_file", "lianat_file", "hanat_file",
"outdir"],
hopla_optional=["li-file", "lianat-file", "hanat-file",
hopla_optional=["li_file", "lianat_file", "hanat_file",
"outdir"],
hopla_cpus=njobs,
hopla_logfile=logfile,
Expand Down
7 changes: 3 additions & 4 deletions li2mni/runtime2.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run(datadir, outdir, phdir, participant_file, name="li2mninorm",
Parameters
----------
datadir: str
path to the BIDS derivatives directory.
path to the li2mni derivatives directory.
outdir: str
path to the BIDS derivatives directory.
phdir: str
Expand Down Expand Up @@ -111,9 +111,8 @@ def run(datadir, outdir, phdir, participant_file, name="li2mninorm",
outdir=sub_outdirs,
norm="norm",
ref_value=ph_vals,
hopla_name_replace=True,
hopla_iterative_kwargs=["li2mni-file", "ref-value", "outdir"],
hopla_optional=["li2mni-file", "ref_value", "mask_file",
hopla_iterative_kwargs=["li2mni_file", "ref_value", "outdir"],
hopla_optional=["li2mni_file", "ref_value", "mask_file",
"outdir", "norm"],
hopla_cpus=njobs,
hopla_logfile=logfile,
Expand Down

0 comments on commit f03d56d

Please sign in to comment.