Skip to content

Commit e41d3a7

Browse files
Prepare major release (#55)
* preparing doc with options noheadmask /noskullmask + derivatives * indiv and params are modified even if orig * padback
1 parent ffb93db commit e41d3a7

8 files changed

Lines changed: 522 additions & 239 deletions

File tree

.github/workflows/check_on_PR.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
108108
python workflows/segment_skull.py -data /home/runner/work/skullTo3d/skullTo3d/skullTo3d_CI_v2/cerimed_marmo -out /home/runner/work/skullTo3d/skullTo3d/skullTo3d_CI_v2/cerimed_marmo/results -soft SPM_native_test_skull -species marmo -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -pad
109109
110-
- name: Running all test pipelines (marmo SPM)
110+
- name: Running all test pipelines (marmo T2)
111111
run: |
112112
113113
python workflows/segment_skull.py -data /home/runner/work/skullTo3d/skullTo3d/skullTo3d_CI_v2/cerimed_marmo -out /home/runner/work/skullTo3d/skullTo3d/skullTo3d_CI_v2/cerimed_marmo/results -soft ANTS_test_skull -species marmoT2 -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -pad

docs/command.rst

Lines changed: 69 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -59,56 +59,91 @@ In particular:
5959
Command line parameters
6060
***********************
6161

62-
--------------------------------------
63-
The following parameters are mandatory
64-
--------------------------------------
62+
All parameters available for `macapype <https://macatools.github.io/macapype/index.html>`_ are also available in skullTo3d. These parameters are recalled here
6563

66-
* -data *like in macapype*
67-
the path to your data dataset (existing BIDS format directory)
6864

69-
* -out *like in macapype*
70-
the path to the output results (an existing path)
65+
--------------------
66+
mandatory parameters
67+
--------------------
7168

72-
* -soft *like in macapype*
73-
can be one of these : SPM or ANTS
74-
* with _skull after SPM or ANTS if you want to process skull or angio *specific to skullTo3d*; otherwise the main pipelines of macapype will be launched (only brain segmentation will be performed)
75-
* with _robustreg (at the end) to have a more robust registration (in two steps) *like in macapype*
76-
* with _test (at the end) to check if the full pipeline is coherent (will only generate the graph.dot and graph.png) *like in macapype*
77-
* with _prep (at the end) will perform data preparation (no brain extraction and segmentation) *like in macapype*
78-
* with _noseg (at the end) will perform data preparation and brain extraction (no segmentation) *like in macapype*
79-
* with _seq (at the end) to run in sequential mode (all iterables will be processed one after the other; equivalent to -nprocs 1) *like in macapype*
69+
* ``-data`` : path to your data dataset (existing BIDS format directory)
70+
* ``-out`` : path to the output results (an existing path)
71+
* ``-soft`` : can be one of these : SPM or ANTS ( **NB:** SPM requires a specific version of macapype/skullTo3d, not available by default)
8072

73+
For ``-soft`` value, it is possible to add some key words (e.g. ``-soft ANTS_robustreg_prep``) all these options are available (to place after SPM or ANTS, e.g) and will change the brain extraction:
8174

82-
**Note** : _skullnoisypetra instead of _skull available for macaque with issues on petra
75+
* ``_4animal`` : will use bet4animal (FSL) for brain extraction, for faster computation (by default atlas_brex is used)
76+
* ``_quick`` : will use hd-bet (Deep Learning) for brain extraction, for faster computation (by default atlas_brex is used)
77+
**NB: ** hd-bet requires a specific version of macapype/skullTo3d, not available by default
8378
84-
--------------------------------------
85-
The following parameters are exclusive
86-
--------------------------------------
79+
This option should be used if the coregistration to template in preparation is not performed correctly:
80+
81+
* ``_robustreg`` (at the end) to have a more robust registration (in two steps)
82+
83+
Finally, these option are available (to place after SPM or ANTS) and will modify the parameters but can be launched in sequence:
84+
85+
* ``_test`` : (at the end) to check if the full pipeline is coherent (will only generate the graph.dot and graph.png)
86+
* ``_prep`` (at the end) will perform data preparation (no brain extraction and segmentation)
87+
* ``_noseg`` (at the end) will perform data preparation and brain extraction (no segmentation)
88+
89+
**Some options are specific to skullTo3d:**
90+
* ``_skull`` after SPM or ANTS if you want to process skull or angio *specific to skullTo3d*; otherwise the main pipelines of macapype will be launched (only brain segmentation will be performed) **NB : ** ``_skullnoisypetra`` instead of ``_skull`` available for macaque with issues on petra
91+
* ``_noskullmask`` (at the end) will perform realignement to stereo and headmask (only realignement for CT)
92+
* ``_noheadmask`` (at the end) will perform only realignement to stereo
93+
94+
95+
--------------------
96+
exclusive parameters
97+
--------------------
8798
*(but one is mandatory)*
8899

89-
* -params *(mandatory if -species is omitted)*
90-
a json file specifiying the global parameters of the analysis. See :ref:`Parameters <params>` for more details
100+
* ``-params`` : *(mandatory if -species is omitted)* a json file specifiying the global parameters of the analysis. See :ref:`Parameters <params>` for more details
101+
* ``-species`` : *(mandatory if -params is omitted)* followed the NHP species corresponding to the image, e.g. {macaque | marmo | baboon | chimp}
91102

92-
* -species *(mandatory if -params is omitted)*
93-
followed the NHP species corresponding to the image, e.g. {macaque | marmo | baboon | chimp}
103+
**NB** marmoT2 can be used for segmenting from the T2w image (by default, T1w is used for marmo)
104+
**NB** macaque_0p5 is available to use downsampled template (faster results)
94105

95-
In extra, marmoT2 can be used for segmenting from the T2w image (by default, T1w is used)
96-
--------------------------------------
97-
The following parameters are optional
98-
--------------------------------------
106+
-------------------
107+
optional parameters
108+
-------------------
99109
*(but highly recommanded)*
100110

101-
* -brain_dt *equivalent to -dt in macapype*
111+
* ``-brain_dt`` *equivalent to -dt in macapype*
102112
specifies the datatype available to perform brain segmentation (can be "T1", or "T1 T2").
103-
**Note** : default is T1 if the attribute is omitted
104113

105-
* -skull_dt *specific to skullTo3d*
114+
**NB** : default is T1 if the attribute is omitted
115+
116+
* ``-skull_dt`` *specific to skullTo3d*
106117
specifies the datatype available for skull segmentation (can be, "T1", "petra", "CT", "angio" or a combination of the latter (with space(s) in between).
107-
**Note** : default is T1 if the attribute is omitted.
108118

109-
* -deriv creates a derivatives directory, with all important files, properly named following BIDS derivatives convertion
119+
**NB** : default is T1 if the attribute is omitted.
120+
121+
* ``-deriv`` : creates a derivatives directory, with all important files, properly named following BIDS derivatives convertion. See :ref:`Derivatives <derivatives>` for a descrition of the outputs
122+
123+
* ``-padback`` : exports most important files in native (original) space
124+
125+
------------------------
126+
more optional parameters
127+
------------------------
128+
129+
* ``-indiv`` or ``-indiv_params`` : a json file overwriting the default parameters (both macapype default and parameters specified in -params json file) for specific subjects/sessions. See :ref:`Individual Parameters <indiv_params>` for more details
130+
* ``-sub`` (-subjects), ``-ses`` (-sessions), ``-acq`` (-acquisions), ``-rec`` (-reconstructions) allows to specifiy a subset of the BIDS dataset respectively to a range of subjects, session, acquision types and reconstruction types. The arguments can be listed with space seperator. **Note** if not specified, the full BIDS dataset will be processed
131+
* ``-nprocs`` : an integer, to specifiy the number of processes that should be allocated by the parralel engine of macapype
132+
133+
* typically equals to the number of subjects*session (i.e. iterables).
134+
* can be multiplied by 2 if T1*T2 pipelines are run (the first steps at least will benefit from it)
135+
* default = 4 if unspecified ; if is put to 1, then the sequential processing is used
136+
137+
* ``-mask`` allows to specify a precomputed binary mask file (skipping brain extraction). The best usage of this option is: precomputing the pipeline till brain_extraction_pipe, modify by hand the mask and use the mask for segmentation. Better if only one subject*session is specified (one file is specified at a time...).
138+
139+
**Warning:** the mask should be in the same space as the data. And only works with -soft ANTS so far
140+
141+
142+
143+
144+
145+
110146

111-
* -pad exports (in derivatives) important files in native (original) space
112147

113148
--------------------------------------
114149
The following parameters are optional
@@ -143,4 +178,4 @@ Command line examples
143178
144179
.. code:: bash
145180
146-
$ python workflows/segment_skull.py -data ~/Data_maca -out ./local_test -soft ANTS_skull -params params.json -sub Apache Baron -ses 01 -rec mean -deriv -pad
181+
$ python workflows/segment_skull.py -data ~/Data_maca -out ./local_test -soft ANTS_skull -params params.json -sub Apache Baron -ses 01 -rec mean -deriv -padback

docs/derivatives.rst

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
:orphan:
2+
3+
.. _derivatives:
4+
5+
***********
6+
Derivatives
7+
***********
8+
9+
Introduction
10+
************
11+
12+
Depending on the options provided by command line and params.json, different files will ouput
13+
14+
Derivatives will be output if option ``-deriv`` is provided to the command line (See `Commands <command>`_):
15+
16+
All files are by default in stereo space; if option ``-padback`` is provided to the command line (See `Commands <command>`), files in native will also be output.
17+
18+
For all files provided by macapype, see `Derivatives <https://macatools.github.io/macapype/derivatives.html>`_ and see `Derivatives <https://macatools.github.io/macapype/derivatives.html>`_
19+
20+
21+
Data Preparation (Padded files)
22+
*******************************
23+
24+
|
25+
26+
**If pad_template is defined in params (normalily used to coregister stereo to petra, T1w and CT):**
27+
28+
*sub-Stevie_ses-01_space-stereo_desc-pad_T1w.nii.gz*
29+
30+
*sub-Stevie_ses-01_space-stereo_desc-pad_T2w.nii.gz*
31+
32+
|
33+
34+
**Some files computed with macapype are put in the same space after pad:**
35+
36+
*sub-Stevie_ses-01_space-stereo_desc-pad_desc-brain_mask.nii.gz*
37+
38+
*sub-Stevie_ses-01_space-stereo_desc-pad_desc-brain_dseg.nii.gz*
39+
40+
|
41+
42+
**If ``-pad`` is defined in command line (See `Commands <commands>`):**
43+
44+
*sub-Stevie_ses-01_space-native_desc-pad_T1w.nii.gz*
45+
46+
*sub-Stevie_ses-01_space-native_desc-pad_T2w.nii.gz*
47+
48+
|
49+
50+
Petra Skull extraction
51+
**********************
52+
53+
|
54+
55+
**Petra in stereo space:**
56+
57+
*sub-Stevie_ses-01_space-stereo_desc-petra_PDw.nii.gz*
58+
59+
|
60+
61+
**Headmask in stereo and native (normally corresponding to native T1w) spaces:**
62+
63+
*sub-Stevie_ses-01_space-stereo_desc-petra_headmask.nii.gz*
64+
65+
*sub-Stevie_ses-01_space-native_desc-petra_headmask.nii.gz*
66+
67+
|
68+
69+
**Skullmask in stereo and native (normally corresponding to native T1w) spaces:**
70+
71+
*sub-Stevie_ses-01_space-stereo_desc-petra_skullmask.nii.gz*
72+
73+
*sub-Stevie_ses-01_space-native_desc-petra_skullmask.nii.gz*
74+
75+
|
76+
77+
**Meshes of headmask and skullmask:**
78+
79+
*sub-Stevie_ses-01_desc-petra_skullmask.stl*
80+
81+
*sub-Stevie_ses-01_desc-petra_headmask.stl*
82+
83+
T1w Skull extraction
84+
********************
85+
86+
|
87+
88+
**Headmask in stereo and native spaces:**
89+
90+
*sub-Stevie_ses-01_space-stereo_desc-t1_headmask.nii.gz*
91+
92+
*sub-Stevie_ses-01_space-native_desc-t1_headmask.nii.gz*
93+
94+
|
95+
96+
**Skullmask in stereo and native spaces:**
97+
98+
*sub-Stevie_ses-01_space-stereo_desc-t1_skullmask.nii.gz*
99+
100+
*sub-Stevie_ses-01_space-native_desc-t1_skullmask.nii.gz*
101+
102+
|
103+
104+
**Meshes of headmask and skullmask:**
105+
106+
*sub-Stevie_ses-01_desc-t1_skullmask.stl*
107+
108+
*sub-Stevie_ses-01_desc-t1_headmask.stl* (is missing so far)
109+
110+
|
111+
112+
CT Skull extraction
113+
*******************
114+
115+
|
116+
117+
**CT file in stereo space:**
118+
119+
*sub-Stevie_ses-01_space-stereo_desc-ct_T2star.nii.gz*
120+
121+
|
122+
123+
**Skullmask in stereo and native spaces:**
124+
125+
*sub-Stevie_ses-01_space-stereo-ct_skullmask.nii.gz*
126+
127+
*sub-Stevie_ses-01_space-native_desc-ct_skullmask.nii.gz*
128+
129+
|
130+
131+
**Mesh of skullmask:**
132+
133+
*sub-Stevie_ses-01_desc-ct_skullmask.stl*
134+
135+
136+
|
137+
138+
**NB** if pad_template is defined (as normally is by default in all skullTo3d parameter files...) , stereo corresponds to desc-pad files for macapype processing.

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ SkullTo3D is fairly flexible, but requires to specify multiples parameters in co
4141

4242
See :ref:`Commands <command>` for a description on the avalaible command parameters
4343

44+
If ``-deriv``` is provided, see :ref:`Derivatives <derivatives>` for a descrition of the outputs
4445

4546

4647
Table of contents
@@ -53,6 +54,7 @@ Table of contents
5354
docker_install
5455
quick_test
5556
command
57+
derivatives
5658
params
5759
indiv_params
5860

docs/quick_test.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Testing from Singularity image
2525

2626
.. code:: bash
2727
28-
$ singularity run -B /path/to/data:/data /path/to/containers/skullto3d_v0.0.5.sif segment_skull -data /data/skullTo3d_CI_v2/cerimed_marmo -out /data/skullTo3d_CI_v2/cerimed_marmo/results -soft ANTS_skull_robustreg -species marmo -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -pad
28+
$ singularity run -B /path/to/data:/data /path/to/containers/skullto3d_v0.0.5.sif segment_skull -data /data/skullTo3d_CI_v2/cerimed_marmo -out /data/skullTo3d_CI_v2/cerimed_marmo/results -soft ANTS_skull_robustreg -species marmo -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -padback
2929
3030
3131
Testing from docker image
@@ -35,7 +35,7 @@ For testing the docker installation, the beginning of the commands should be rep
3535

3636
.. code:: bash
3737
38-
$ docker run -v /path/to/data:/data macatools/skullto3d:v0.0.5 segment_skull -data /data/skullTo3d_CI_v2/cerimed_marmo -out /data/skullTo3d_CI_v2/cerimed_marmo/results -soft ANTS_skull_robustreg -species marmo -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -pad
38+
$ docker run -v /path/to/data:/data macatools/skullto3d:v0.0.5 segment_skull -data /data/skullTo3d_CI_v2/cerimed_marmo -out /data/skullTo3d_CI_v2/cerimed_marmo/results -soft ANTS_skull_robustreg -species marmo -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -padback
3939
4040
Testing from python package install
4141
-----------------------------------
@@ -44,13 +44,13 @@ From pip install
4444
~~~~~~~~~~~~~~~~
4545
.. code:: bash
4646
47-
$ segment_skull -data /path/to/data/skullTo3d_CI_v2/cerimed_marmo -out /path/to/data/skullTo3d_CI_v2/cerimed_marmo/results -soft ANTS_skull_robustreg -species marmo -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -pad
47+
$ segment_skull -data /path/to/data/skullTo3d_CI_v2/cerimed_marmo -out /path/to/data/skullTo3d_CI_v2/cerimed_marmo/results -soft ANTS_skull_robustreg -species marmo -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -padback
4848
4949
From github install
5050
~~~~~~~~~~~~~~~~
5151
.. code:: bash
5252
53-
$ python workflows/segment_skull.py -data /path/to/data/skullTo3d_CI_v2/cerimed_marmo -out /path/to/data/skullTo3d_CI_v2/cerimed_marmo/results -soft ANTS_skull_robustreg -species marmo -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -pad
53+
$ python workflows/segment_skull.py -data /path/to/data/skullTo3d_CI_v2/cerimed_marmo -out /path/to/data/skullTo3d_CI_v2/cerimed_marmo/results -soft ANTS_skull_robustreg -species marmo -sub Tresor -ses 01 -brain_dt T1 T2 -skull_dt T1 petra CT -deriv -padback
5454
5555
**Note the /path/to/data instead of /data (as in the container install) in the arguments**
5656

@@ -68,6 +68,6 @@ Macaque CT petra
6868

6969
.. code:: bash
7070
71-
$ singularity run -B /path/to/data/:/data /path/to/containers/skullto3d_v0.0.5.sif segment_skull -data /data/skullTo3d_CI_v2/cerimed_macaque -out /data/skullTo3d_CI_v2/cerimed_macaque/results -soft ANTS_skull_robustreg -species macaque -sub Stevie -ses 01 -brain_dt T1 T2 -skull_dt CT petra t1 -deriv -pad
71+
$ singularity run -B /path/to/data/:/data /path/to/containers/skullto3d_v0.0.5.sif segment_skull -data /data/skullTo3d_CI_v2/cerimed_macaque -out /data/skullTo3d_CI_v2/cerimed_macaque/results -soft ANTS_skull_robustreg -species macaque -sub Stevie -ses 01 -brain_dt T1 T2 -skull_dt CT petra t1 -deriv -padback
7272
7373
See :ref:`Commands <command>` for more info on robustreg in soft

0 commit comments

Comments
 (0)