-
Notifications
You must be signed in to change notification settings - Fork 30
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
BIDS-Model Event files to FSL EV's #36
Comments
Definitely doable, but not on top of my priorities. Happy to review a PR if you end up implementing this. |
So FitLins is largely wrapping work that's currently in PyBIDS. If you're comfortable reading nipype interfaces, here is the interface that loads a BIDS model and creates structures that can be used outside. For now, it would probably make the most sense to treat that as a walk-through of PyBIDS's If you're interested in trying to adapt nipype.interfaces.fsl.Level1Design to accept the outputs of that interface to produce EV/FSF files, that would provide extremely useful feedback on my design, and we could work to resolve any impedance mismatch. (A long-term goal of mine is to have the BIDS model interfaces produce specifications that can be easily used with Nipype's FSL and SPM interfaces, as well as the nistats interfaces I'm currently working on.) |
Thanks both; I'll take a shot at it. Looks like If I make progress or have questions I'll ping again. Thanks, |
Also, do you have any tips on developing the run.py inside the container? Are you rebuilding the container for every change of run.py? Or is there an easy way to mount the host's run.py instead of copying it and rebuilding? |
So And assuming you're using Docker for your container, you can just do something like:
|
I've gotten Before going too far, I just wanted to check that adding both |
I think that's reasonable. I would pin the specific fitlins, pybids and grabbit versions you're currently using, though, as there are going to be some fairly major changes coming up, as the BIDS draft specs start to solidify. Nipype should be more stable, but probably not a bad idea to pin in your container, anyway. |
Hi @effigies -- I've had a chance to look at this and am looking for input on a few different design options for converting
The other options involve work within nipype and not fitlins:
Hope all of this makes sense, but I'm having a tough time deciding which of those options would be the cleanest and easiest. I haven't looked at nistats but being interoperable with that would also be a consideration as well. Any suggestions / leaning toward one option vs. another? Thanks, |
The output of I have some documentation I've been writing, but haven't yet finished and committed: Outputs
-------
session_info : list of dictionaries
At the first level, a dictionary per-run containing the following keys:
'events' : HDF5 file containing sparse representation of events
(onset, duration, amplitude)
'confounds' : HDF5 file containing dense representation of confound
regressors
'repetition_time' : float (in seconds)
contrast_info : list of lists of files
A list of files for each level of analysis (length depends on model)
An HDF5 file per analysis unit (e.g. run, subject, etc.) containing a pandas matrix
with a row for each contrast output.
The columns correspond to input files, and the entries are weights.
A final, additional column is added indicating whether the row is a T or F
contrast.
contrast_indices : list of lists of lists of dictionaries
A list of lists of dictionaries for each level of analysis (length depends on model)
A list of dictionaries per analysis unit (e.g. run, subject, etc.)
Each dictionary contains a set of entities describing I'll need to look again at how far this is from the The main thing that would be hard to change is the lengths and depth of the lists/lists of lists. For that, |
Sorry, just to be clear, I'm posting this documentation in case you haven't dug through the outputs in detail yet. I don't think I'll be able to today, but tomorrow I'll have a look at getting closer back to the |
Thanks for posting that doc; I've glanced at the outputs but hadn't even put together something as detailed as this.
One question on No hurry for today; I wouldn't necessarily have you re-write the LoadBIDSModel outputs. Sounds like maybe exposing a special version for the nipype native interfaces may be the best. I'll look out for any thoughts if you get a chance tomorrow. Thanks! |
Last thought - I like the idea of adjusting |
Okay, so I've been digging into
We pass image files separately from session info, which shouldn't be a huge refactor. I don't think pybids currently implements reading HPF cutoffs, but I'd consider that somewhat peripheral (also, I don't think it needs to be defined on a per-run basis). Conditions and regressors correspond to my So if I can get a dictionary-based representation of conditions and regressors that can be easily converted to/from Pandas DataFrames, I think a refactor would be a pretty easy lift. I still need to look at contrasts. We should be able to similarly adapt the Pandas object for T contrasts. I think this is going to need to wait on 0.7 to be done correctly for F contrasts. |
That’s about what I’ve got as well - just unsure about the best way to add this in. Can you think of any reason to store the events and confounds as frames instead of lists besides ease of indexing? Agreed that the conversion should be pretty trivial — I’m happy to add a |
Ah, sorry, I missed your response. No, the only good reason to keep things as |
Hi @chrisfilo and @effigies ,
I'm starting to work on some new tasks for HCP and thinking about how to get the
fMRIVolume
andfMRISurface
HCP stages processed using the BIDS-apps container.The main sticking-point that I see is converting the BIDS event files (long-form run/duration/onset) to FSL EV files (vectors per condition) for HCP. I played around with fitlins and the BIDS model extension a few months ago, but didn't get very far before being pulled away to other things.
Do you think the model spec is mature enough to add as an extension to the
run.py
adapter you have in this container, e.g. including a bids-model json file, converting .tsv -> ev, and using those ev's in the HCP fMRI stages? Or does this sound like more work than it's worth and something that other people wouldn't necessarily use, and I should just focus on shoe-horning in precomputed ev's to a standard HCPPIPE (non-bids) container?I suspect it would be straight-forward if
fitlins
has code I could piggy-back on to easily create the EVs (as opposed to estimating the whole thing), but not trivial if it doesn't. I poked around and didn't see anything, but maybe there's another package that you know of that would do this? Or maybe, that would actually be the more useful (to the community)?Anyway, I'm probably going to take a crack at this and just wanted to open the issue early. Any suggestions along the way would be appreciated. Thanks!
The text was updated successfully, but these errors were encountered: