Skip to content

Commit 78e810f

Browse files
authored
Merge pull request #237 from FCP-INDI/feature/acpc
Feature/acpc
2 parents ecfa2c5 + 28da338 commit 78e810f

File tree

14 files changed

+65
-44
lines changed

14 files changed

+65
-44
lines changed

.circleci/config.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ commands:
44
steps:
55
- run:
66
name: 🔧 Setting version
7-
command: if [ -f /build/build_version.txt ]; then echo "export BUILD_VERSION=$(cat /build/build_version.txt)" >> $BASH_ENV; else echo "export BUILD_VERSION=nightly" >> $BASH_ENV; fi
7+
command: if [[ $CIRCLE_TAG =~ v(.+)(-source) ]]; then echo "export BUILD_VERSION=v${BASH_REMATCH[1]}" >> $BASH_ENV; else echo "export BUILD_VERSION=nightly" >> $BASH_ENV; fi
88
install-build-dependencies:
99
parameters:
1010
version:
@@ -74,7 +74,6 @@ commands:
7474
git rm -fr docs/.doctrees || rm -fr docs/.doctrees || true
7575
git rm -fr docs/**/.doctrees || rm -fr docs/**/.doctrees || true
7676
git rm -fr bin || rm -fr bin || true
77-
git rm -fr build_version.txt || rm -fr build_version.txt || true
7877
git rm -fr C-PAC || rm -fr C-PAC || true
7978
git rm -fr cpac || rm -fr cpac || true
8079
git rm -fr scripts/__pycache__ || rm -fr scripts/__pycache__ || true
@@ -92,7 +91,6 @@ commands:
9291
root: /
9392
paths:
9493
- build/404.html
95-
- build/build_version.txt
9694
- build/docs
9795
- build/index.html
9896
- build/scripts
@@ -121,9 +119,6 @@ jobs:
121119
- image: python:3.7
122120
steps:
123121
- checkout
124-
- run:
125-
name: 🔬 Checking for tag file
126-
command: test -f ./build_version.txt
127122
- get-version
128123
- install-build-dependencies:
129124
version: ${BUILD_VERSION}
@@ -170,24 +165,24 @@ workflows:
170165
- build-nightly:
171166
filters:
172167
branches:
173-
only:
174-
- source
168+
only: source
175169
- build-version:
176170
filters:
171+
tags:
172+
only: /^v.*(-source)$/
177173
branches:
178-
only:
179-
- build-version
174+
ignore: /.*/
180175
- deploy-nightly:
181176
filters:
182177
branches:
183-
only:
184-
- source
178+
only: source
185179
requires:
186180
- build-nightly
187181
- deploy-version:
188182
filters:
183+
tags:
184+
only: /^v.*(-source)$/
189185
branches:
190-
only:
191-
- build-version
186+
ignore: /.*/
192187
requires:
193188
- build-version

CONTRIBUTING.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,16 @@ Please, always base changes on the `source` branch. `master` branch will be over
99
Pushes to `source` will rebuild docs at https://fcp-indi.github.io/docs/nightly
1010

1111
#### C-PAC release tags
12-
Pushes to `build-version` will look for a C-PAC version tag (e.g, `v1.7.0`) in a file called `build_version.txt` at the root of the repo.
12+
Tags in the format `v.*-source` will build docs for the given version.
1313

14-
If that file exists and includes only an existing tag, docs should build for the given version.
15-
16-
If `build_version.txt` does not exist or the included tag doesn't exist in https://github.com/FCP-INDI/C-PAC/tags, the build should fail.
14+
If a matching version tag doesn't exist in https://github.com/FCP-INDI/C-PAC/tags, the build should fail.
1715

1816
Steps to build a release:
1917
1. Checkout a commit from the `source` from a time appropriate for documentation for the branch being built/rebuilt.
20-
2. Name your branch (`git switch -c` or `git checkout -b`) either `build-version` or something more specific
21-
3. Add a text file `build_version.txt` at the root of the repository in your new branch. This text file should include the version tag for the version of C-PAC and nothing else.
22-
4. Make any changes you need for the specific version.
23-
5. (Force) push to the remote branch `build-version`.
18+
2. If you need to make changes, create a branch (`git switch -c` or `git checkout -b`).
19+
3. Make any changes you need for the specific version.
20+
4. Tag the commit that's ready to build (`git tag v`version`-source`)
21+
5. (Force) push to the remote tag (`git push origin v`version`-source`).
2422
6. CircleCI should deploy the versioned documentation. If the version tag is the newest, it should also overwrite `latest` with these documents.
2523

2624
## Guidelines

docs/_sources/_images/acpc_gui.png

123 KB
Loading
-24.5 KB
Loading

docs/_sources/_static/flowcharts/anatomical.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/_sources/_static/flowcharts/pipeline-individual.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/_sources/conf.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,9 @@ def _gh_rate_limit():
183183
gh_tags = []
184184
gh_tags.sort(reverse=True)
185185

186-
build_version_path = os.path.abspath(os.path.join(
187-
__file__, os.pardir, os.pardir, os.pardir, 'build_version.txt'
188-
))
189186
# don't build release notes for newer releases
190-
if os.path.exists(build_version_path):
191-
with open(build_version_path, 'r') as bvf:
192-
build_version = bvf.read().strip()
187+
build_version = os.environ.get('CIRCLE_TAG', '').rstrip('-source')
188+
if len(build_version):
193189
gh_tags = [gh_tag for gh_tag in gh_tags if compare_versions(
194190
build_version, gh_tag
195191
)]

docs/_sources/user/anat.rst

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33

44
.. raw:: html
55

6-
<div class="flowchart-container"><object data="../../_static/flowcharts/anatomical.svg" type="image/svg+xml"></object></div>
6+
<div class="flowchart-container"><object data="../_static/flowcharts/anatomical.svg" type="image/svg+xml"></object></div>
77

88
Initial Preprocessing
99
^^^^^^^^^^^^^^^^^^^^^
1010

11-
Initial preprocessing offers methods like `non-local means filtering <https://www.iro.umontreal.ca/~mignotte/IFT6150/Articles/Buades-NonLocal.pdf>`_ and `N4 bias field correction <https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3071855/>`_ to preprocess anatomical images.
11+
Initial preprocessing offers methods like `ACPC Alignment <https://doi.org/10.1016/j.neuroimage.2013.04.127>`_ , `non-local means filtering <https://www.iro.umontreal.ca/~mignotte/IFT6150/Articles/Buades-NonLocal.pdf>`_ and `N4 bias field correction <https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3071855/>`_ to preprocess anatomical images.
1212

1313
C-PAC provides options for configuring initial preprocessing - users can select:
1414

15+
* `ACPC Alignment <https://github.com/Washington-University/HCPpipelines/blob/master/PreFreeSurfer/scripts/ACPCAlignment.sh>`_
1516
* `ANT's DenoiseImage <https://manpages.debian.org/experimental/ants/DenoiseImage.1.en.html>`_
1617
* `ANT's N4BiasFieldCorrection <http://manpages.ubuntu.com/manpages/trusty/man1/N4BiasFieldCorrection.1.html>`_
1718

@@ -21,10 +22,22 @@ Configuring CPAC to run initial preprocessing:
2122

2223
.. figure:: /_images/anat_init_options.png
2324

25+
#. **ACPC Alignment - [On,Off]:** Anterior Commissure - Posterior Comissure (ACPC) alignment. Default is Off. If choose 'on', clicking on the setting icon will bring up a dialog where you can set ACPC alignment parameters.
26+
2427
#. **Non-Local Means Filtering - [On,Off]:** ANTs DenoiseImage. Default is Off.
2528

2629
#. **N4 Bias Field Correction - [On,Off]:** ANTs N4BiasFieldCorrection - a variant of the popular N3 (nonparametric nonuniform normalization) retrospective bias correction algorithm. Default is Off.
2730

31+
Configuring ACPC Alignment options:
32+
""""""""""""""""""""""""""""""""""""""
33+
**Note:** These options are pre-set for ACPC Alignment's default values. These do not need to be modified unless you are looking to optimize the results of ACPC alignment for your particular dataset.
34+
35+
.. figure:: /_images/acpc_gui.png
36+
37+
#. **ACPC Brain Size - [150]:** ACPC size of brain in z-dimension in mm. Default: 150mm for human data, 70mm for macaque data.
38+
#. **ACPC Aligned Skull Template - [path]:** Skull template to be used for ACPC alignment. It is not necessary to change this path unless you intend to use a non-standard template.
39+
#. **ACPC Aligned Brain Template - [path]:** Brain template to be used for ACPC alignment. For human data, it can be 'None'. It is not necessary to change this path unless you intend to use a non-standard template.
40+
2841

2942
Skull-Stripping
3043
^^^^^^^^^^^^^^^
@@ -256,7 +269,7 @@ Anatomical Tissue Segmentation
256269

257270
.. raw:: html
258271

259-
<div class="flowchart-container"><object data="../../_static/flowcharts/segmentation.svg" type="image/svg+xml"></object></div>
272+
<div class="flowchart-container"><object data="../_static/flowcharts/segmentation.svg" type="image/svg+xml"></object></div>
260273

261274
C-PAC uses `FSL/FAST <http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FAST>`_ to automatically segment brain images into white matter, gray matter, and CSF. This is done using probability maps that contain information about the likelihood that a given voxel will be of a particular tissue type. Users specify a probability threshold such that voxels meeting a minimum probability of being a particular tissue will be classified as such. This results in masks containing voxels of only a single tissue type.
262275

docs/_sources/user/design_a_pipeline.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Or you can provide it to the C-PAC Singularity container like so:
2828
-B /tmp:/tmp \
2929
-B /Users/You/Documents:/configs \
3030
fcpindi_c-pac_latest-{date}-{hash value}.img s3://fcp-indi/data/Projects/ADHD200/RawDataBIDS /outputs participant --pipeline_file /configs/pipeline_config.yml
31-
3231
**Reporting errors and getting help**
3332

3433
Please report errors on the `C-PAC github page issue tracker <https://github.com/FCP-INDI/C-PAC/issues>`_. Please use the `C-PAC google group <https://groups.google.com/forum/#!forum/cpax_forum>`_ for help using C-PAC and this application.

docs/_sources/user/help.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,28 @@ Crash files are generated by Nipype, and can be viewed from the terminal by typi
2626
Where :file:`crash-file.pklz` is the name of the crash file you wish to view.
2727

2828
Common Issues
29-
^^^^^^^^^^^^^^^^^^^^^^^^^^^
29+
^^^^^^^^^^^^^
3030

31-
#. My run is crashing with the crash files indicating a memory error. What is going on?
31+
#. I have a pipeline configuration that used to work, but now I'm getting errors that start with ``OSError: File /ndmg_atlases/label/Human/``. Why?
3232

33-
This issue often occurs when scans are resampled to a higher resolution. This is because functional images, the template that you are resampling to, and the resulting generated image are all loaded into memory at various points in the C-PAC pipeline. Typically these images are compressed, but they will be uncompressed when loaded. If the amount of memory required to load the images exceeds the amount of memory available, C-PAC will crash.
33+
.. include:: /user/ndmg_atlases.rst
3434

35-
For instance, suppose you are resampling a 50 MB (100 MB uncompressed) resting-state scan with 3 mm isotropic voxels to a 3 MB (15 MB uncompressed) 1 mm template. By dividing the voxel volume for the original resting state scan by the voxel volume for the template, you can determine that the voxel count of the resampled resting-state scan will be 27 times greater. Therefore, if you multiply the uncompressed file size by 27 you can estimate that the resampled scan alone will take up 2.7 GB of space. You will need at least this much RAM for C-PAC to load the scan. If you are running multiple subjects simultaneously, you would need to multiply this estimate by the number of subjects. Note that the template, original image, and any other open applications will also have their own memory requirements, so the estimate would be closer to 2.8 GB per subject plus however much RAM is used before C-PAC is started (assuming no new applications are started mid-run).
35+
#. My run is crashing with the crash files indicating a memory error. What is going on?
3636

37-
To avoid this error, you will need to either get more RAM, run fewer subjects at once, or consider downsampling your template to a lower resolution.
37+
This issue often occurs when scans are resampled to a higher resolution. This is because functional images, the template that you are resampling to, and the resulting generated image are all loaded into memory at various points in the C-PAC pipeline. Typically these images are compressed, but they will be uncompressed when loaded. If the amount of memory required to load the images exceeds the amount of memory available, C-PAC will crash.
38+
39+
For instance, suppose you are resampling a 50 MB (100 MB uncompressed) resting-state scan with 3 mm isotropic voxels to a 3 MB (15 MB uncompressed) 1 mm template. By dividing the voxel volume for the original resting state scan by the voxel volume for the template, you can determine that the voxel count of the resampled resting-state scan will be 27 times greater. Therefore, if you multiply the uncompressed file size by 27 you can estimate that the resampled scan alone will take up 2.7 GB of space. You will need at least this much RAM for C-PAC to load the scan. If you are running multiple subjects simultaneously, you would need to multiply this estimate by the number of subjects. Note that the template, original image, and any other open applications will also have their own memory requirements, so the estimate would be closer to 2.8 GB per subject plus however much RAM is used before C-PAC is started (assuming no new applications are started mid-run).
40+
41+
To avoid this error, you will need to either get more RAM, run fewer subjects at once, or consider downsampling your template to a lower resolution.
3842

3943

4044
.. _working_dir_crashes:
4145

4246
#. I'm re-running a pipeline, but I am receiving many crashes. Most of these crashes tell me that a file that has been moved or no longer exists is being used as an input for a step in the C-PAC pipeline. What is going on and how can I tell C-PAC to use the correct inputs?
4347

44-
One of the features of Nipype (which C-PAC is built upon) is that steps that have been run before are not re-run when you re-start a pipeline. Nipype accomplishes this by associating a value with a step based on the properties of that step (i.e., hashing). Nipype has two potential values that it can associate with a step: a value based on the size and date of the files created by the step, and a value based upon the data present within the files themselves. The first value is what C-PAC uses with its pipelines, since it is much more computationally practical. Since this value only looks at the size and date of files to determine whether or not a step has been run, it will not see that the file's path has changed, and it will assume that all paths are consistent with the path structure from when the pipeline was run before.
45-
46-
To work around this error, you will need to delete the working directory associated with the previous run and create a new directory to replace it for the new run.
48+
One of the features of Nipype (which C-PAC is built upon) is that steps that have been run before are not re-run when you re-start a pipeline. Nipype accomplishes this by associating a value with a step based on the properties of that step (i.e., hashing). Nipype has two potential values that it can associate with a step: a value based on the size and date of the files created by the step, and a value based upon the data present within the files themselves. The first value is what C-PAC uses with its pipelines, since it is much more computationally practical. Since this value only looks at the size and date of files to determine whether or not a step has been run, it will not see that the file's path has changed, and it will assume that all paths are consistent with the path structure from when the pipeline was run before.
49+
50+
To work around this error, you will need to delete the working directory associated with the previous run and create a new directory to replace it for the new run.
4751

4852
#. How should I cite C-PAC in my paper?
4953

0 commit comments

Comments
 (0)