Closed mateuszpawlik closed 1 year ago
Interesting use case that I haven't considered so far. I've just made a small patch, can you test it?
I can't execute bidsmapper. Here's some relevant output lines:
WARNING | Invalid run-item with suffix: "<SeriesDescription:anat-(.*?)_ses>" (anat -> sub--unknown/ses--unknown/DICOM_anat_id001)
and
Traceback (most recent call last):
File "/usr/local/bin/bidsmapper", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/bidscoin/bidsmapper.py", line 266, in main
bidsmapper(rawfolder = args.sourcefolder,
File "/usr/local/lib/python3.9/dist-packages/bidscoin/bidsmapper.py", line 163, in bidsmapper
mainwin = bidseditor.MainWindow(bidsfolder, bidsmap_new, template)
File "/usr/local/lib/python3.9/dist-packages/bidscoin/bidseditor.py", line 132, in __init__
self.set_tab_bidsmap(dataformat)
File "/usr/local/lib/python3.9/dist-packages/bidscoin/bidseditor.py", line 354, in set_tab_bidsmap
self.update_subses_samples(self.output_bidsmap, dataformat)
File "/usr/local/lib/python3.9/dist-packages/bidscoin/bidseditor.py", line 475, in update_subses_samples
if self.datasource.dynamicvalue(run['bids'].get('suffix'), True, True) in bids.get_derivatives(datatype):
AttributeError: 'MainWindow' object has no attribute 'datasource'
This happens also without using a dynamic value for a suffix.
It's actually the bidseditor that crashes. I just fixed it in f406021adc3f23e2e1c08a620b7424a24d04f6d2 (hopefully, because the bidseditor is not covered by my pytests :-))
It seems to work but the warning is still there:
WARNING | Invalid run-item with suffix: "<SeriesDescription:anat-(.*?)_ses>" (anat -> sub--unknown/ses--unknown/DICOM_anat_id001)
Yes, I was expecting that a bit. When the template bidsmap is loaded, it is checked for BIDS validity. However, the run-items in the template don't have associated data sources, which are needed to update the values dynamically. I'll see if I can handle it a bit more gracefully
Maybe it is the right way. It's an advanced feature.
Many thanks for the implementation. I'll continue tomorrow with the testing.
Should be better now
I'm not sure what exactly to check because the warning is the same.
The warning should be gone now.... Did you use the latest code?
I built it again, just to be sure, and the warning is still there :thinking:
Ok, don't know for sure if it really helps but I made another fix
With cbf56d0 the warning is gone.
I only see INFO | Could not validate every run-item in the bidsmap
that could be relevant but not necessarily.
That is intended (but indeed a bit verbose) behaviour, it means that the dynamic suffix could not be checked against the BIDS schema
I tried to use a dynamic value to fill in a
suffix
value, for example, use<SeriesDescription:anat-(.*?)_ses>
to retrieveT1w
fromanat-T1w_ses-B_acq-T1wHCPLI
SeriesDescription. BIDScoin creates a drop-down for a suffix with one value being<SeriesDescription:anat-(.*?)_ses>
.I don't know if it's an expected behavior. This feature works as expected for other fields like
acq
.