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

Use Python code for 3dMEPFM #3

Open
tsalo opened this issue Aug 11, 2021 · 24 comments
Open

Use Python code for 3dMEPFM #3

tsalo opened this issue Aug 11, 2021 · 24 comments

Comments

@tsalo
Copy link
Member

tsalo commented Aug 11, 2021

@eurunuela is working on a Python implementation of 3dMEPFM, so we can use that instead of AFNI (which is harder to install for a Jupyter Book) once it's available.

Original content

I'm thinking that we should use the 3dMEPFM R code directly, rather than installing AFNI. To that end, we'll need to include R dependencies and have the relevant notebook use an R kernel instead of Python.

@tsalo
Copy link
Member Author

tsalo commented Aug 11, 2021

@eurunuela I'm not really experienced with R. Is there any kind of equivalent to requirements.txt or setup.py for R code? Something that will define the necessary dependencies for our Jupyter notebooks?

@eurunuela
Copy link

@eurunuela I'm not really experienced with R. Is there any kind of equivalent to requirements.txt or setup.py for R code? Something that will define the necessary dependencies for our Jupyter notebooks?

Good question. I have never written an entire library in R, I've only written scripts, so I honestly do not know.

I guess we could create an R script that installs the libraries anyway 🤔 Not sure that's how R libraries handle it.

@eurunuela
Copy link

A quick Google search has led me to the a documentation site that explains how to do it: https://r-pkgs.org/description.html

@tsalo
Copy link
Member Author

tsalo commented Aug 12, 2021

Can 3dMEPFM operate using pure R? As in, without any AFNI C code? I just wonder if maybe 3dMEPFM could be packaged as an R package, or even all AFNI R functions together in one.

@eurunuela
Copy link

Can 3dMEPFM operate using pure R? As in, without any AFNI C code? I just wonder if maybe 3dMEPFM could be packaged as an R package, or even all AFNI R functions together in one.

Yes. That's doable. It runs R only and has an AFNI compatible CLI.

@tsalo
Copy link
Member Author

tsalo commented Aug 12, 2021

It looks like John Lee started on something to that effect (https://github.com/afni/afnistats), but I don't think it ever got published to CRAN or anything.

@eurunuela
Copy link

If adding R dependencies is too much work, another option would be to wait for the Python version we're currently working on, estimation of global fluctuations included.

@tsalo
Copy link
Member Author

tsalo commented Aug 12, 2021

😆 Yeah that sounds better! Any clue on a timeline?

@eurunuela
Copy link

Code is pretty much ready, working on the paper now. Should be there before the end of the year.

@tsalo tsalo changed the title Add R dependencies Use Python code for 3dMEPFM Aug 17, 2021
@tsalo
Copy link
Member Author

tsalo commented Dec 22, 2021

@eurunuela any update on this?

@eurunuela
Copy link

@eurunuela any update on this?

Working on improving one of the versions. Once I'm happy with it, I'll make the repo public and I'll add a Zenodo DOI.

@tsalo
Copy link
Member Author

tsalo commented Dec 29, 2021

Thanks @eurunuela!

@eurunuela
Copy link

eurunuela commented May 17, 2022

This is not the PFM version I referred to in my previous comments but should be good enough to use as an equivalent to 3dMEPFM: https://github.com/eurunuela/pySPFM

I'll work on adding some examples to the README.

@tsalo
Copy link
Member Author

tsalo commented Jun 8, 2022

@eurunuela the most recent release doesn't have all of the necessary dependencies listed, but I think you fixed that problem in a later commit. Can you make a new release?

@eurunuela
Copy link

I just made a new release. Have you tried running it?

I must warn you that I have only tested some parts of the code, but not everything. I am currently on the process of moving all the code I've written in the past 4 years into 3 proper Python packages. So some things may be broken atm.

@tsalo
Copy link
Member Author

tsalo commented Jun 8, 2022

It looks like the Action that deploys to PyPi didn't succeed.

@eurunuela
Copy link

I see. I'll have a look at it tonight or tomorrow and get back to you.

@tsalo
Copy link
Member Author

tsalo commented Jun 8, 2022

No rush. I just had a few minutes and decided to add the dependency. I can totally wait before circling back to this.

@eurunuela
Copy link

No rush. I just had a few minutes and decided to add the dependency. I can totally wait before circling back to this.

I just deployed to PyPi from my computer. I don't know why the Action failed.

@tsalo
Copy link
Member Author

tsalo commented Jun 20, 2022

It's now installing correctly, but the new problem is the AFNI dependency. I've opened an issue in the pyspfm repo about it.

@eurunuela
Copy link

It's now installing correctly, but the new problem is the AFNI dependency. I've opened an issue in the pyspfm repo about it.

If the AFNI dependency is not a problem, you can already use the package.

I have already dropped the dependency to generate the HRF matrix, but I still have to find a way to make nibabel write to the history section of the header of the output nifti files.

@tsalo
Copy link
Member Author

tsalo commented Jun 28, 2022

I could probably use the AFNI+miniconda Docker image you were using for pyspfm's CI, but I'd definitely prefer to use pure Python in the future, so I'm hoping there will be a good way to update BRIK/HEAD files in the near future. 🤞

@eurunuela
Copy link

I could probably use the AFNI+miniconda Docker image you were using for pyspfm's CI, but I'd definitely prefer to use pure Python in the future, so I'm hoping there will be a good way to update BRIK/HEAD files in the near future. 🤞

I agree it would be nice to have a pure Python version. But right now, adding this feature to nibabel is not the main priority for me. If someone develops it, I will happily include it to pySPFM.

@tsalo
Copy link
Member Author

tsalo commented Nov 19, 2022

Per @eurunuela in this week's tedana devs call, the pure Python version of pySPFM should be good to go! I will try using it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants