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

WIP: Add Freesurfer 7 #67

Merged
merged 35 commits into from
Aug 30, 2023
Merged

WIP: Add Freesurfer 7 #67

merged 35 commits into from
Aug 30, 2023

Conversation

Shotgunosine
Copy link
Contributor

I added Freesurfer 7 and some additional jobs on circleci to test and deploy it. Circlci config will likely need to be fixed before this is complete.

@Shotgunosine
Copy link
Contributor Author

@PeerHerholz and @AndysWorth this resolves #57 with the potential exception of the replacement recon-all script. I'd be happy to get your feedback on it.

@PeerHerholz
Copy link
Collaborator

Ahoi hoi @Shotgunosine,

thx for the fantastic work and effort. The same to you @AndysWorth.
I checked the code and tests, LGTM. The plan re the recon-all script would be include it once we have it, eh?

@Shotgunosine
Copy link
Contributor Author

Yeah, That's what I'm thinking.

@PeerHerholz
Copy link
Collaborator

Awesome! @AndysWorth, do you want to have a look as well? After that or otherwise, we could go ahead and merge!?

@AndysWorth
Copy link

Sorry for the slow response. This looks good to me. I just noticed that I got a response on the Freesurfer mailing list from Doug Greve:

Hi Andy, this is a bug introduced in 7.1.1, some kind of race condition.
You can fix it by commenting out this line in recon-all
if($OMP_NUM_THREADS > 1 && ! $LHonly && ! $RHonly) set cmd = ($cmd --parallel) # just hemis
doug

Thanks for your strong work @Shotgunosine!

@PeerHerholz
Copy link
Collaborator

Cool, thanks @AndysWorth! @Shotgunosine should we go ahead and merge? WDYT re the recon-all script adaptation above?

@Shotgunosine
Copy link
Contributor Author

Shotgunosine commented Nov 17, 2020 via email

@AndysWorth
Copy link

Will do!

@PeerHerholz
Copy link
Collaborator

Hi folks,

just checking: we can merge this, right? @Shotgunosine @AndysWorth

@AndysWorth
Copy link

Sorry, I was looking forward to making that contribution but it seems that I'm slowing this down. It looks like I won't have time until I'm off work for the holidays. @Shotgunosine if you want to go ahead with your suggestion in the meanwhile, that would be great. I know it's a small change but I don't feel confident to just do it without taking the time to make sure I fully understand what's going on.

@Shotgunosine
Copy link
Contributor Author

I might not be able to get to it until around the same time period. Maybe @llevitis would be able to take a look

@AndysWorth
Copy link

I've installed the fix here at Flywheel -- once I have had a chance to run it a few times I'll submit it to neurodocker.

@Shotgunosine
Copy link
Contributor Author

@AndysWorth have you had a chance to send the fix over to neurodocker?

@AndysWorth
Copy link

@Shotgunosine Sorry, no 😞 . There are two places that need patching in recon-all and the fixes have worked well at Flywheel so it's about time! I'll work on making the time. Thanks for the reminder.

@Shotgunosine
Copy link
Contributor Author

@AndysWorth, sounds good. It'd be great if you're able to make the changes this week, I've got a bunch of sessions I need to run and I'd love to be able to use this.

@AndysWorth
Copy link

Okay @Shotgunosine, I will!

@AndysWorth
Copy link

Hey @Shotgunosine , I (finally) managed to patch Freesurfer 7.7.1 in neurodocker. See neurodocker PR#384. I did this exact same change to the official Freesurfer docker image version of 7.1.1 and it has been run successfully many times on various Flywheel instances. I have not tested this new neurodocker version, which is for a slightly different version of centos (6 vs. 7). Is this PR sufficient for you to give it a try? All it should do is prevent crashing.

@AndysWorth
Copy link

@Shotgunosine I've created a repository recon-all-v7.1.1-parallel-patch. Right now it just has the patch file that can be installed with
patch /usr/local/freesurfer/bin/recon-all parallel.patch
Is this enough? If not, what else should I do?

@Shotgunosine
Copy link
Contributor Author

Shotgunosine commented Apr 1, 2021

@AndysWorth, can you update the neurodocker PR to pull that repo run the bash script?

@AndysWorth
Copy link

@Shotgunosine I'm not familiar enough with neurodocker. Where would I do that?

@AndysWorth
Copy link

@Shotgunosine It sounds like they don't want the patch in neurodocker so the following should go somewhere around here?

curl -LJO https://github.com/AndysWorth/recon-all-v7.1.1-parallel-patch/tarball/master
tar zxf AndysWorth-recon-all-v7.1.1-parallel-patch-e5ff2fe.tar.gz
cd AndysWorth-recon-all-v7.1.1-parallel-patch-e5ff2fe
patch $FREESURFER_HOME/bin/recon-all parallel.patch 
patch $FREESURFER_HOME/bin/quantifyThalamicNuclei.sh quantifyThalamicNuclei.patch
cd ..
rm -rf AndysWorth-recon-all-v7.1.1-parallel-patch-e5ff2fe

@Shotgunosine
Copy link
Contributor Author

Shotgunosine commented Apr 1, 2021 via email

@Shotgunosine
Copy link
Contributor Author

Shotgunosine commented Apr 1, 2021 via email

@Remi-Gau
Copy link
Contributor

will make a dummy change to retrigger circle ci

@Remi-Gau
Copy link
Contributor

getting somse validator error: will bump its version

@Remi-Gau
Copy link
Contributor

getting somse validator error: will bump its version

totally missed that you had done that and completely refactored the bash script: you've been busy

@Shotgunosine
Copy link
Contributor Author

I had to bump the node version to get one that was available for ubuntu-jammy, so I went ahead and bumped the bids validator version to the latest. I had only bumped node to 16.x and the validator says it needs at least 18.x so I've bumped node to 18.x and we'll try again.

@Shotgunosine
Copy link
Contributor Author

Bah, looks like circleci webhooks are broken at the moment. Is there anyone who can trigger a manual build?

@Remi-Gau
Copy link
Contributor

Is there anyone who can trigger a manual build?

just did: let's see how this one goes

@Remi-Gau
Copy link
Contributor

see if we can create specific dependencies between the steps of the circle ci so that test for fs6 starts when the build for fs6 is done.

Currently the tests can only start when both builds are done.

image

@Shotgunosine
Copy link
Contributor Author

Shotgunosine commented Aug 30, 2023

see if we can create specific dependencies between the steps of the circle ci so that test for fs6 starts when the build for fs6 is done.

Currently the tests can only start when both builds are done.

image

Yep, found the docs on matrix and they explain how to set it up. The circleci graph makes it looks like the dependencies are correct now.

Dockerfile Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we just delete the Dockerfile?

@Remi-Gau
Copy link
Contributor

Yep, found the docs on matrix and they explain how to set it up. The circleci graph makes it looks like the dependencies are correct now.

nice!!!

thanks for looking into this

@Shotgunosine
Copy link
Contributor Author

@Remi-Gau, the tests are failing because they can't find anything at /home/circleci/data/ds114_test1_freesurfer_precomp_v6.0.0/00_group*. That part of the circleconfig predates this PR. Do you know what's going on with that?

@Remi-Gau
Copy link
Contributor

get the same bug locally:

# get download script
wget https://raw.githubusercontent.com/bids-apps/maintenance-tools/main/utils/get_data_from_osf.sh

# get gata into home dir from https://osf.io/9q7dv/
bash get_data_from_osf.sh ds114_test1_freesurfer_precomp_v6.0.0 

# create target dir
mkdir -p ${HOME}/outputs1 ${HOME}/outputs2

# try to copy
sudo mv ${HOME}/data/ds114_test1_freesurfer_precomp_v6.0.0/00_group* ${HOME}/outputs1/

no group folder

$ ls ${HOME}/data/ds114_test1_freesurfer_precomp_v6.0.0/       
  
fsaverage  lh.EC_average  rh.EC_average  sub-01  sub-02

let me dig into the history of the repo to see what was happening in the good old days

@Remi-Gau
Copy link
Contributor

here is the circle ci "step" that was used before I started working in the circle-ci:

https://github.com/bids-apps/freesurfer/blob/8c364a62ffbdef3b3e4f81a1c6bf4de5e9c2b5cd/.circleci/config.yml#L66C67-L66C67

more readable

docker run -ti --rm --read-only \
  -v ~/license/license.txt:/license.txt \
  --tmpfs /tmp --tmpfs /var/tmp \
  -v ${HOME}/data/ds114_test1:/bids_dataset \
  -v ${HOME}/data/ds114_test1_freesurfer_precomp_v6.0.0:/outputs \
    bids/${CIRCLE_PROJECT_REPONAME} /bids_dataset /outputs group2 \
      --license_file=/license.txt && \
mkdir -p ${HOME}/outputs1/ && \
sudo mv ${HOME}/data/ds114_test1_freesurfer_precomp_v6.0.0/00_group* ${HOME}/outputs1/ && \
cat ${HOME}/outputs1/00_group2_stats_tables/lh.aparc.thickness.tsv && \
cat ${HOME}/outputs1/00_group2_stats_tables/euler.tsv

@Remi-Gau
Copy link
Contributor

I think I it is "just" a path issue: trying to fix in 765a747

@Shotgunosine
Copy link
Contributor Author

@Remi-Gau, it passed! Is there anything else we should fix for this PR?

@Remi-Gau
Copy link
Contributor

woohoo!!!

I will merge and make a new release: this should trigger a push to docherhub.

@Remi-Gau Remi-Gau merged commit 4663559 into bids-apps:master Aug 30, 2023
2 checks passed
@Remi-Gau Remi-Gau mentioned this pull request Aug 30, 2023
@bpinsard
Copy link

Wow, glad my ping triggered a new release! Thanks for all the hard work! Waiting on the dockerhub push and will make a PR to repronim, can't wait to try it out!

@Remi-Gau
Copy link
Contributor

Wow, glad my ping triggered a new release! Thanks for all the hard work! Waiting on the dockerhub push and will make a PR to repronim, can't wait to try it out!

FYI it is already on dockerhub but it is a bit of a mess at the moment:

see here
#75 (comment)

any thoughts on what would make most sense for users?

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

Successfully merging this pull request may close these issues.

None yet

5 participants