File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 4
4
5
5
from MRdataset import logger
6
6
from MRdataset .base import BaseDataset
7
- from MRdataset .config import VALID_BIDS_DATATYPES
7
+ from MRdataset .config import VALID_BIDS_DATATYPES , SUPPORTED_BIDS_DATATYPES
8
8
from MRdataset .dicom_utils import is_bids_file
9
9
from MRdataset .utils import folders_with_min_files , valid_dirs , read_json
10
10
from protocol import BidsImagingSequence
@@ -129,6 +129,13 @@ def _process(self, folder):
129
129
name = name )
130
130
if seq .is_valid ():
131
131
sequences .append (seq )
132
+ else :
133
+ if name not in SUPPORTED_BIDS_DATATYPES :
134
+ logger .error (f'MRdataset primarily supports '
135
+ f'{ SUPPORTED_BIDS_DATATYPES } '
136
+ f'It seems the parameters in '
137
+ f'this sequence are invalid or '
138
+ f'not supported yet. Skipping it.' )
132
139
return sequences
133
140
134
141
@staticmethod
@@ -138,7 +145,7 @@ def get_run_id(filename, last_id):
138
145
Example filename : sub-01_ses-imagery01_task-imagery_run-01_bold.json
139
146
"""
140
147
# Regular expression pattern
141
- pattern = r'run-\d +'
148
+ pattern = r'run-[^_] +'
142
149
# Extracting substring using regex
143
150
match = search (pattern , str (filename ))
144
151
Original file line number Diff line number Diff line change 30
30
'pet'
31
31
]
32
32
33
+ SUPPORTED_BIDS_DATATYPES = ['func' , 'anat' , 'dwi' , 'fmap' ]
33
34
34
- # Suppress duplicated warnings
35
35
36
36
class MRException (Exception ):
37
37
"""
@@ -59,7 +59,7 @@ def __init__(self):
59
59
'--data_source. Got 0 DICOM/JSON files.' )
60
60
61
61
62
- def configure_logger (log , output_dir , mode = 'w' , level = 'WARNING ' ):
62
+ def configure_logger (log , output_dir , mode = 'w' , level = 'ERROR ' ):
63
63
"""
64
64
Initiate log files.
65
65
Original file line number Diff line number Diff line change @@ -29,9 +29,12 @@ def is_bids_file(filename: Union[str, Path]):
29
29
# TODO: Add some criteria to skip certain files
30
30
if 'derivatives' in str (filename ):
31
31
return False
32
-
32
+ if 'bidsignore' in str (filename ):
33
+ return False
34
+ if 'sourcedata' in str (filename ):
35
+ return False
33
36
# Regular expression pattern
34
- pattern = r'sub-\d +'
37
+ pattern = r'sub-[^_] +'
35
38
# Extracting substring using regex
36
39
match = search (pattern , str (filename ))
37
40
if not match :
You can’t perform that action at this time.
0 commit comments