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

[ENH] more specific bids entities and fixes to be bids compatible #1035

Merged
merged 7 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
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
22 changes: 22 additions & 0 deletions AFQ/afq_bids_entities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "bidsafq",
"entities": [
{
"name": "odfmodel",
"pattern": "[_/\\\\]+odfmodel-([a-zA-Z0-9]+)"
},
{
"name": "coordsys",
"pattern": "[_/\\\\]+coordsys-([a-zA-Z0-9]+)"
},
{
"name": "trkmethod",
"pattern": "[_/\\\\]+trkmethod-([a-zA-Z0-9]+)"
},
{
"name": "recogmethod",
"pattern": "[_/\\\\]+recogmethod-([a-zA-Z0-9]+)"
}
]
}

7 changes: 6 additions & 1 deletion AFQ/api/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
using_afqb = False


__all__ = ["GroupAFQ"]
__all__ = ["GroupAFQ", "get_afq_bids_entities_fname"]


logger = logging.getLogger('AFQ')
Expand All @@ -55,6 +55,11 @@ def clean_pandas_df(df):
return df


def get_afq_bids_entities_fname():
return op.dirname(op.dirname(op.abspath(
aus.__file__))) + "/afq_bids_entities.json"


class GroupAFQ(object):
f"""{AFQclass_doc}"""

Expand Down
8 changes: 3 additions & 5 deletions AFQ/api/participant.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import nibabel as nib
import os.path as op
import os
from time import time
import logging
from tqdm import tqdm
Expand All @@ -20,7 +19,8 @@
from AFQ.tasks.tractography import get_tractography_plan
from AFQ.tasks.segmentation import get_segmentation_plan
from AFQ.tasks.viz import get_viz_plan
from AFQ.utils.path import drop_extension, apply_cmd_to_afq_derivs
from AFQ.tasks.utils import get_base_fname
from AFQ.utils.path import apply_cmd_to_afq_derivs
from AFQ.viz.utils import BEST_BUNDLE_ORIENTATIONS, trim, get_eye


Expand Down Expand Up @@ -104,9 +104,7 @@ def __init__(self,
results_dir=output_dir,
dwi_affine=nib.load(dwi_data_file).affine,
bids_info=bids_info,
base_fname=op.join(
output_dir,
drop_extension(op.basename(dwi_data_file))),
base_fname=get_base_fname(output_dir, dwi_data_file),
**kwargs)
self.make_workflow()

Expand Down
5 changes: 3 additions & 2 deletions AFQ/data/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,8 @@ def read_cp_templates(as_img=True, resample_to=False):
resample_to=resample_to)

toc = time.perf_counter()
logger.debug(f'Cerebellar peduncles templates loaded in {toc - tic:0.4f} seconds')
logger.debug(
f'Cerebellar peduncles templates loaded in {toc - tic:0.4f} seconds')

return template_dict

Expand Down Expand Up @@ -1084,7 +1085,7 @@ def organize_stanford_data(path=None, clear_previous_afq=None):
else:
apply_cmd_to_afq_derivs(
op.join(afq_folder, "sub-01/ses-01"),
op.join(afq_folder, "sub-01/ses-01/sub-01_ses-01_dwi"),
op.join(afq_folder, "sub-01/ses-01/sub-01_ses-01"),
dependent_on=clear_previous_afq)

if not op.exists(derivatives_path):
Expand Down
Loading