Closed Rageve closed 1 year ago
OK let's index the dataset in the bidspm-preproc folder that you have created with bidspm(..., 'action', 'copy', ...)
and then look for files and metadata in it.
For me it would look something like this.
bids_dir='/home/remi/github/bidspm/demos/openneuro/inputs/ds000001';
fmriprep_dir='/home/remi/github/bidspm/demos/openneuro/inputs/ds000001-fmriprep';
preproc_dir='/home/remi/github/bidspm/demos/openneuro/outputs/ds000001/derivatives/bidspm-preproc';
% index copied file
BIDS = bids.layout(preproc_dir, 'use_schema', false);
% create filter to only retrieve certain files
filter = struct(...
'desc', {{'smoothAROMAnonaggr'}}, ...
'extension', {{'.nii.*'}}, ...
'modality', 'func', ...
'prefix', '', ...
'space', {{'MNI152NLin6Asym'}}, ...
'sub', '^02$', ...
'suffix', 'bold', ...
'task', {{'balloonanalogrisktask'}});
% get the files
bids.query(BIDS, 'data', filter)
% get specific metadata for these files
filter.target = 'RepetitionTime';
bids.query(BIDS, 'metadata', filter)
What this then gives me is this:
ans =
3×1 cell array
{'/home/remi/github/bidspm/demos/openneuro/outputs/ds000001/derivatives/bidspm-preproc/sub-02/func/sub-02_task-balloonanalogrisktask_run-1_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii'}
{'/home/remi/github/bidspm/demos/openneuro/outputs/ds000001/derivatives/bidspm-preproc/sub-02/func/sub-02_task-balloonanalogrisktask_run-2_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii'}
{'/home/remi/github/bidspm/demos/openneuro/outputs/ds000001/derivatives/bidspm-preproc/sub-02/func/sub-02_task-balloonanalogrisktask_run-3_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii'}
ans =
1×3 cell array
{[2]} {[2]} {[2]}
For you it would be something like this:
bids_dir= insert_path_to_raw_bids;
fmriprep_dir= insert_path_to_fmriprep;
preproc_dir= insert_path_to_data_copied_from_fmriprep;
% index copied file
BIDS = bids.layout(preproc_dir, 'use_schema', false);
% create filter to only retrieve certain files
filter = struct(...
'desc', {{'preproc'}}, ...
'extension', {{'.nii.*'}}, ...
'modality', 'func', ...
'prefix', '', ...
'space', {{'MNI152NLin6Asym'}}, ...
'sub', '^0950$', ...
'suffix', 'bold', ...
'task', {{'food'}});
% get the files
bids.query(BIDS, 'data', filter)
% get specific metadata for these files
filter.target = 'RepetitionTime';
bids.query(BIDS, 'metadata', filter)
If the copying happened correctly you should have a .json file with each .nii file in the bidspm-preproc: something like this.
ds000001/derivatives/bidspm-preproc
├── CHANGES
├── dataset_description.json
├── LICENSE
├── README.md
├── sub-01
│ └── func
│ ├── sub-01_task-balloonanalogrisktask_run-1_desc-confounds_timeseries.json
│ ├── sub-01_task-balloonanalogrisktask_run-1_desc-confounds_timeseries.tsv
│ ├── sub-01_task-balloonanalogrisktask_run-1_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.json
│ ├── sub-01_task-balloonanalogrisktask_run-1_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.nii
│ ├── sub-01_task-balloonanalogrisktask_run-1_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.json
│ ├── sub-01_task-balloonanalogrisktask_run-1_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii
│ ├── sub-01_task-balloonanalogrisktask_run-1_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.json
│ ├── sub-01_task-balloonanalogrisktask_run-1_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii
│ ├── sub-01_task-balloonanalogrisktask_run-2_desc-confounds_timeseries.json
│ ├── sub-01_task-balloonanalogrisktask_run-2_desc-confounds_timeseries.tsv
│ ├── sub-01_task-balloonanalogrisktask_run-2_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.json
│ ├── sub-01_task-balloonanalogrisktask_run-2_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.nii
│ ├── sub-01_task-balloonanalogrisktask_run-2_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.json
│ ├── sub-01_task-balloonanalogrisktask_run-2_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii
│ ├── sub-01_task-balloonanalogrisktask_run-2_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.json
│ ├── sub-01_task-balloonanalogrisktask_run-2_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii
│ ├── sub-01_task-balloonanalogrisktask_run-3_desc-confounds_timeseries.json
│ ├── sub-01_task-balloonanalogrisktask_run-3_desc-confounds_timeseries.tsv
│ ├── sub-01_task-balloonanalogrisktask_run-3_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.json
│ ├── sub-01_task-balloonanalogrisktask_run-3_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.nii
│ ├── sub-01_task-balloonanalogrisktask_run-3_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.json
│ ├── sub-01_task-balloonanalogrisktask_run-3_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii
│ ├── sub-01_task-balloonanalogrisktask_run-3_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.json
│ └── sub-01_task-balloonanalogrisktask_run-3_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii
The warning for Non-existent field "SliceTiming" for metadata
is there because bidspm does not yet take into account how fmriprep does the slice timing correction when it builds the GLM.
So this is expected.
When that information cannot be found, the GLMs are constructed by taking as reference time the time point at the middle of each volume of the time series.
So in your case instead of taking the value of 0.541 seconds as reference (the StartTime in the json file), it more or less would take 1.18 / 2 = 0.59 seconds (RepetitionTime / 2).
Here is the output of my bidspm-preproc folder. When I follow your
suggestion I got an empty cell??
bids_dir =
'/server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/inputs/rawdata';
models_dir =
'/server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/models';
output_dir =
'/server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/outputs/derivatives';
derivat_dir =
'/server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/inputs/fmriprep';
preproc_dir = fullfile(output_dir, 'bidspm-preproc');
pwd /server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/outputs/derivatives/bidspm-preproc/sub-0950
(base) bash-5.1$ cd sub-0950
(base) bash-5.1$ tree
.
├── ses-V0
│ └── func
│ ├── sub-0950_ses-V0_task-food_run-1_desc-confounds_timeseries.json
│ ├── sub-0950_ses-V0_task-food_run-1_desc-confounds_timeseries.tsv
│ ├──
sub-0950_ses-V0_task-food_run-1_space-MNI152NLin2009cAsym_desc-brain_mask.json
│ ├──
sub-0950_ses-V0_task-food_run-1_space-MNI152NLin2009cAsym_desc-brain_mask.nii
│ ├──
sub-0950_ses-V0_task-food_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.json
│ ├──
sub-0950_ses-V0_task-food_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii
│ ├──
sub-0950_ses-V0_task-food_run-1_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.json
│ ├──
sub-0950_ses-V0_task-food_run-1_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii
│ ├── sub-0950_ses-V0_task-food_run-2_desc-confounds_timeseries.json
│ ├── sub-0950_ses-V0_task-food_run-2_desc-confounds_timeseries.tsv
│ ├──
sub-0950_ses-V0_task-food_run-2_space-MNI152NLin2009cAsym_desc-brain_mask.json
│ ├──
sub-0950_ses-V0_task-food_run-2_space-MNI152NLin2009cAsym_desc-brain_mask.nii
│ ├──
sub-0950_ses-V0_task-food_run-2_space-MNI152NLin2009cAsym_desc-preproc_bold.json
│ ├──
sub-0950_ses-V0_task-food_run-2_space-MNI152NLin2009cAsym_desc-preproc_bold.nii
│ ├──
sub-0950_ses-V0_task-food_run-2_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.json
│ └──
sub-0950_ses-V0_task-food_run-2_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii
└── ses-V9
└── func
├── sub-0950_ses-V9_task-food_run-1_desc-confounds_timeseries.json
├── sub-0950_ses-V9_task-food_run-1_desc-confounds_timeseries.tsv
├──
sub-0950_ses-V9_task-food_run-1_space-MNI152NLin2009cAsym_desc-brain_mask.json
├──
sub-0950_ses-V9_task-food_run-1_space-MNI152NLin2009cAsym_desc-brain_mask.nii
├──
sub-0950_ses-V9_task-food_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.json
├──
sub-0950_ses-V9_task-food_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii
├──
sub-0950_ses-V9_task-food_run-1_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.json
├──
sub-0950_ses-V9_task-food_run-1_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii
├── sub-0950_ses-V9_task-food_run-2_desc-confounds_timeseries.json
├── sub-0950_ses-V9_task-food_run-2_desc-confounds_timeseries.tsv
├──
sub-0950_ses-V9_task-food_run-2_space-MNI152NLin2009cAsym_desc-brain_mask.json
├──
sub-0950_ses-V9_task-food_run-2_space-MNI152NLin2009cAsym_desc-brain_mask.nii
├──
sub-0950_ses-V9_task-food_run-2_space-MNI152NLin2009cAsym_desc-preproc_bold.json
├──
sub-0950_ses-V9_task-food_run-2_space-MNI152NLin2009cAsym_desc-preproc_bold.nii
├──
sub-0950_ses-V9_task-food_run-2_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.json
└──
sub-0950_ses-V9_task-food_run-2_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii
BIDS = bids.layout(preproc_dir, 'use_schema', false); BIDS =
struct with fields:
pth:
'/server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/outputs/derivatives/bidspm-preproc' description: [1×1 struct] sessions: {} participants: [] subjects: [1×118 struct] root: [0×0 struct] is_datalad_ds: 0
filter = struct('desc',{{'smoothAROMAnonaggr'}}, ... 'extension', {{'.nii.*'}}, ... 'modality', 'func', ... 'prefix','', ... 'space', {{'MNI152NLin6Asym'}}, ... 'sub', '^950$', ... 'suffix', 'bold', ... 'task', {{'food'}});
bids.query(BIDS, 'data', filter)
ans =
0×0 empty cell array
filter.target = 'RepetitionTime';
bids.query(BIDS, 'metadata', filter)
ans =
0×0 empty cell array
Just to check. The filter you passed has subject label 950 but the label of your subject in the dataset is 0950.
Does using the correct label make a difference?
sorry, there was a typo 950 instead of 0950, here is the correct ouput
bids.query(BIDS, 'data', filter)
ans =
4×1 cell array
{'/server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/outputs/derivatives/bidspm-preproc/sub-0950/ses-V0/func/sub-0950_ses-V0_task-food_run-1_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii'}
{'/server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/outputs/derivatives/bidspm-preproc/sub-0950/ses-V0/func/sub-0950_ses-V0_task-food_run-2_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii'}
{'/server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/outputs/derivatives/bidspm-preproc/sub-0950/ses-V9/func/sub-0950_ses-V9_task-food_run-1_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii'}
{'/server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/outputs/derivatives/bidspm-preproc/sub-0950/ses-V9/func/sub-0950_ses-V9_task-food_run-2_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii'}
filter.target = 'RepetitionTime'; bids.query(BIDS, 'metadata', filter)
ans =
1×4 cell array
{[1.1800]} {[1.1800]} {[1.1800]} {[1.1800]}
although I defined desc as smoothAROMAnonaggr, the error comes with
desc preproc
[14:56:52] bidspm - ERROR getAndCheckRepetitionTime No repetition time found for filter:
- desc: {preproc}
- extension: {.nii.*}
- modality: {func}
- prefix: {}
- space: {MNI152NLin6Asym}
- sub: {^0950$}
- suffix: {bold}
- task: {food}
- target: {RepetitionTime}
Zitat von Remi Gau @.***>:
sorry, there was a typo 950 instead of 0950, here is the correct ouput
ok this output makes sense
although I defined desc as smoothAROMAnonaggr, the error comes with desc preproc
Just to check: what is the last commit on the branch you are on?
Yesterday I downloaded the branch you recommended me (not developer version).
I defined the filter for bidspm as follows
bids_filter_file = struct('bold', struct('modality', 'func', ... 'suffix', 'bold', ... 'desc', {'smoothAROMAnonaggr'}));
here is tha last output in matlab workspace
[15:02:52] bidspm - ERROR getAndCheckRepetitionTime No repetition time found for filter:
- desc: {preproc}
- extension: {.nii.*}
- modality: {func}
- prefix: {}
- space: {MNI152NLin6Asym}
- sub: {^0950$}
- suffix: {bold}
- task: {food}
- target: {RepetitionTime}
Error getAndCheckRepetitionTime:noRepetitionTimeFound occurred:
ERROR LOG SAVED: /server/fo2-17/data/NASAL_2018/DAGen_Bromo/BIDS/Tuebingen/outputs/derivatives/error_logs/error_2023-07-19T15-02.log Use it when opening an issue: https://github.com/cpp-lln-lab/bidspm/issues/new/choose.
Did you mean that?
in the version.txt v3.1.0 dev
ha no sorry, I meant if you run the following in your terminal (NOT the matlab command line):
git show HEAD
otherwise bidspm should print an error log as a txt file should be in an error_log folder
it will contain, the version and the commit number
it also contains the stack trace of the errors
ok, here is it
"GeneratedBy": { "name": "bidspm", "Version": "v3.1.0dev", "Branch": "main", "Commit": "909b6c4f",
ok so it seems that you are not on the latest commit of the main branch.
can you update to the latest version and try again?
after updating to the last branch, the GLM including contrasts worked
fine. Thanks for your support.
Zitat von Remi Gau @.***>:
ok so it seems that you are not on the latest commit of the main branch.
can you update to the latest version and try again?
-- Reply to this email directly or view it on GitHub: https://github.com/cpp-lln-lab/bidspm/issues/1092#issuecomment-1642453485 You are receiving this because you authored the thread.
Message ID: @.***>
Ralf Veit PhD
Institute for Diabetes Research and Metabolic Diseases of the
Helmholtz Center Munich at the University of Tübingen
Otfried Müller Str. 47
fax: +49-7071-295706
phone: +49-7071-2987703
woohoo 🚀
sorry it took so long
Hey Remi,
I downloaded the branch and tried to run the first level with my own dataset. However, there were some warning/erros and the script stopped.
[10:00:13] bidspm - INFO printProcessingSubject PROCESSING SUBJECT No.: 1 SUBJECT LABEL : 0950
[10:00:13] bidspm - DEBUG printBatchName BUILDING JOB: specify subject level fmri model Warning: Non-existent field "SliceTiming" for metadata.
the associated .json file of the smoothnonaggr files contains the following items (which is the same in ... desc_preproc_bold.json files). fmriprep version is 21.0.0.
{ "DelayTime": 0.09749999999999992, "RepetitionTime": 1.18, "SliceTimingCorrected": true, "StartTime": 0.541, "TaskName": "food" }
the field "SliceTiming" is in the unprocessed dicom converted files
then the following error appears
[10:00:13] bidspm - ERROR getAndCheckRepetitionTime No repetition time found for filter:
and the script stopped with ERROR LOG saved. The field RepetitionTime is defined in the . json file