|
a |
|
b/docs/outputs/output_files.md |
|
|
1 |
# Output Files |
|
|
2 |
|
|
|
3 |
The `PATH_TO_OUTPUT_DIR` folder contains a `logs` and `work` folder for troubleshooting, but for most purposes all the outputs of interest will be in a subfolder called `hippunfold` with the following structure: |
|
|
4 |
|
|
|
5 |
hippunfold/ |
|
|
6 |
└── sub-{subject} |
|
|
7 |
├── anat |
|
|
8 |
├── coords |
|
|
9 |
├── qc |
|
|
10 |
├── surf |
|
|
11 |
└── warps |
|
|
12 |
|
|
|
13 |
Briefly, `anat` contains preprocessed volumetric input images and output segmentations in nifti format, `surf` contains surface data in gifti format, `coords` contain Laplace fields spanning the hippocampus, `warps` contains transformations between unfolded and native or 'unfolded' space, and `qc` contains snapshots and useful diagnostic information for quality control. |
|
|
14 |
|
|
|
15 |
## anat |
|
|
16 |
|
|
|
17 |
This folder contains input anatomical images that have been non-uniformity corrected, |
|
|
18 |
motion-corrected, and, where appropriate, averaged and registered. |
|
|
19 |
In this example, a `T1w` image was used as a standard reference image, but a `T2w` was also registered and used in tissue segemntation: |
|
|
20 |
|
|
|
21 |
sub-001 |
|
|
22 |
└── anat |
|
|
23 |
├── sub-001_desc-preproc_T1w.nii.gz |
|
|
24 |
├── sub-001_space-T1w_desc-preproc_T2w.nii.gz |
|
|
25 |
├── sub-001_hemi-R_space-T1w_desc-subfields_atlas-bigbrain_dseg.nii.gz |
|
|
26 |
├── sub-001_hemi-R_space-cropT1w_desc-preproc_T2w.nii.gz |
|
|
27 |
└── sub-001_hemi-R_space-cropT1w_desc-subfields_atlas-bigbrain_dseg.nii.gz |
|
|
28 |
|
|
|
29 |
As per BIDS guidelines, `desc-preproc` refers to preprocessed input images, `space-T1w` refers to the volume to which the image is registered, `hemi` refers to the left or right hemisphere (only shown for the right in this example), and `dseg` (discrete-segmentation) images with `desc-subfields` contains subfield labels (coded as integers as described in the included `volumes.tsv` file). The subfield atlas used will also be included, by default as `atlas-bigbrain`. Note that HippUnfold does most intermediate processing in an unshown (available in the `work/` folder) `space-corobl` which is cropped, upsampled, and rotated. Downsampling to the original `T1w` space can thus degrade the results and so they are also provided in a higher resolution `space-cropT1w` space which is ideal for conducting volumetry or morphometry measures with high precision and detail. |
|
|
30 |
|
|
|
31 |
For example, the following image shows a whole-brain `T1w` image, a |
|
|
32 |
`space-cropT1w` overlay of the upsampled T2w image (centre square), and a similarly upsampled output |
|
|
33 |
subfield segmentation (colour). |
|
|
34 |
|
|
|
35 |
 |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
## surf |
|
|
39 |
|
|
|
40 |
### surface meshes |
|
|
41 |
|
|
|
42 |
Surface meshes (geometry files) are in `.surf.gii` format, and are |
|
|
43 |
provided in both the native space (`space-T1w`) and the unfolded space |
|
|
44 |
(`space-unfolded`). In each space, there are `inner`, `midthickness`, |
|
|
45 |
and `outer` surfaces, which correspond to `white`, `midthickness`, and |
|
|
46 |
`pial` for cortical surfaces: |
|
|
47 |
|
|
|
48 |
sub-{subject} |
|
|
49 |
└── surf |
|
|
50 |
└── sub-001_hemi-R_space-{T1w,unfolded}_den-0p5mm_{inner,midthickness,outer}.surf.gii |
|
|
51 |
|
|
|
52 |
The following shows surfaces `inner`, `midthickness`, and `outer` in |
|
|
53 |
yellow, orange, and red, respectively. |
|
|
54 |
|
|
|
55 |
 |
|
|
56 |
|
|
|
57 |
### surface densities |
|
|
58 |
|
|
|
59 |
Surfaces are provided in different density configurations, and are |
|
|
60 |
labelled based on the approximate vertex spacing in each. The default |
|
|
61 |
density is `0p5mm`, which has an approximate vertex spacing of 0.5mm. There are also |
|
|
62 |
`1mm` and `2mm` surfaces which have 1mm or 2mm spacing, respectively (suitable for |
|
|
63 |
lower-resolution BOLD data). Previous versions of hippunfold exclusively |
|
|
64 |
used a `unfoldiso` template surface, formed by a 254x126 grid in |
|
|
65 |
the unfolded space, however a downside of this template is that it |
|
|
66 |
results in very non-uniform vertex spacing when transformed to the |
|
|
67 |
native space. The newer `0p5mm`, |
|
|
68 |
`1mm` and `2mm` surfaces are designed to have |
|
|
69 |
closer to uniform vertex spacing in native space, though vertex spacing will not remain uniform when unfolded. |
|
|
70 |
This is illustrated in the the following `den-1mm` mesh in folded and |
|
|
71 |
unfolded space. |
|
|
72 |
|
|
|
73 |
 |
|
|
74 |
|
|
|
75 |
All surfaces of the same density (e.g. `1mm`), in both |
|
|
76 |
`space-T1w` and `space-unfolded`, share the same mesh topology and have |
|
|
77 |
corresponding vertices with each other. The vertex locations for |
|
|
78 |
unfolded surfaces are identical for all subjects as well (note that this |
|
|
79 |
of course is not the case for the `space-T1w` surfaces). |
|
|
80 |
|
|
|
81 |
### surface metrics |
|
|
82 |
|
|
|
83 |
In addition to the geometry files, surface-based shape metrics are |
|
|
84 |
provided in `.shape.gii` format. The thickness, curvature and surface |
|
|
85 |
area are computed using the same methods as cortical surfaces, based on |
|
|
86 |
the surface geometry files, and are provided in the `T1w` space. The |
|
|
87 |
gyrification metric is the ratio of native to unfolded surface area, or |
|
|
88 |
equivalently, the scaling or distortion factor when unfolding: |
|
|
89 |
|
|
|
90 |
sub-{subject} |
|
|
91 |
└── surf |
|
|
92 |
└── sub-001_hemi-{L,R}_space-T1w_den-0p5mm_label-hipp_{thickness,curvature,gyrification}.shape.gii |
|
|
93 |
└── sub-001_hemi-{L,R}_space-T1w_den-0p5mm_label-dentate_{curvature,gyrification}.shape.gii |
|
|
94 |
|
|
|
95 |
These metrics are shown in both folded and unfolded space in the images |
|
|
96 |
below. Note that these results are from group-averaged data and so |
|
|
97 |
individual subject maps may show considerably more variability. |
|
|
98 |
|
|
|
99 |
 |
|
|
100 |
|
|
|
101 |
|
|
|
102 |
### surface labels |
|
|
103 |
|
|
|
104 |
The subfield labels from unfolded atlases are also provided for each |
|
|
105 |
subject, in `.label.gii` format. Analogous to the volume-based labels, |
|
|
106 |
the name of the atlas (default: `bigbrain`) is in the file name. |
|
|
107 |
|
|
|
108 |
sub-{subject} |
|
|
109 |
└── surf |
|
|
110 |
└── sub-001_hemi-{L,R}_space-T1w_den-0p5mm_label-hipp_atlas-bigbrain_subfields.label.gii |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
### cifti files |
|
|
114 |
|
|
|
115 |
In addition to lateralized `.shape.gii` and `.label.gii` metrics and labels, |
|
|
116 |
we also provide data mapped to hippocampi from hemispheres in a single |
|
|
117 |
file using the corresponding CIFTI formats, `.dscalar.nii` and `.dlabel.nii`. |
|
|
118 |
Note: since CIFTI does not support hippocampus |
|
|
119 |
surfaces (yet), we make use of the `CORTEX_LEFT` and `CORTEX_RIGHT` labels for |
|
|
120 |
the hippocampal surfaces. |
|
|
121 |
|
|
|
122 |
sub-{subject} |
|
|
123 |
└── surf |
|
|
124 |
├── sub-001_space-T1w_den-0p5mm_label-{hipp,dentate}_{thickness,curvature,gyrification}.dscalar.nii |
|
|
125 |
└── sub-001_space-T1w_den-0p5mm_label-hipp_atlas-bigbrain_subfields.dlabel.nii |
|
|
126 |
|
|
|
127 |
|
|
|
128 |
### spec files |
|
|
129 |
|
|
|
130 |
Finally, these files are packaged together for easy viewing in |
|
|
131 |
Connectome Workbench, `wb_view`, in the following `.spec` files, for |
|
|
132 |
each hemisphere and structure separately, and combined: |
|
|
133 |
|
|
|
134 |
sub-{subject} |
|
|
135 |
└── surf |
|
|
136 |
├── sub-001_hemi-{L,R}_space-T1w_den-0p5mm_label-{hipp,dentate}_surfaces.spec |
|
|
137 |
└── sub-001_space-T1w_den-0p5mm_label-{hipp,dentate}_surfaces.spec |
|
|
138 |
|
|
|
139 |
|
|
|
140 |
### New: label-dentate |
|
|
141 |
|
|
|
142 |
HippUnfold v1.0.0 introduces `label-dentate` files which represent a distinct surface making up the dentate gyrus (reflecting its distinct topology from the rest of the cortex). The rest of the surfaces are given the name `label-hipp` to differentiate them from these new files. |
|
|
143 |
|
|
|
144 |
These are illustrated in the following image (orange represents the usual hippocampal midthickness surface, while violet shows the new `dentate` surface): |
|
|
145 |
|
|
|
146 |
 |
|
|
147 |
|
|
|
148 |
Note that the dentate uses the same unfolding methods as the rest of the hippocampus, but with several caveats. Given its small size, its boundaries are not easily deliminated and so `inner`, `outer`, and `thickness` gifti surfaces are omitted. Furthermore, Laplace coordinates and therefore vertex spacing are not guaranteed to be topologically equivalent as they are obtained through volumetric registration with the template shape injection step of this workflow. |
|
|
149 |
|
|
|
150 |
Corresponding `coords` and `warp` files are also generated. |
|
|
151 |
|
|
|
152 |
### New: myelin maps |
|
|
153 |
|
|
|
154 |
|
|
|
155 |
If your dataset has T1w and T2w images (and you are using `--modality=T1w` or `--modality=T2w`), then you can enable the generation of myelin maps as the ratio of T1w over T2w images. This division is done in the `corobl` space, and provides `myelin.shape.gii` surface metrics, and also includes these in the CIFTI and spec files. |
|
|
156 |
|
|
|
157 |
This option is enabled with the `--generate-myelin-maps` command-line option. |
|
|
158 |
|
|
|
159 |
## coords |
|
|
160 |
|
|
|
161 |
Hippunfold also provides images that represent anatomical gradients |
|
|
162 |
along the 3 principal axes of the hippocampus, longitudinal from |
|
|
163 |
anterior to posterior, lamellar from proximal (dentate gyrus) to distal |
|
|
164 |
(subiculum), and laminar from inner (SRLM) to outer. These are provided |
|
|
165 |
in the images suffixed with `coords.nii.gz` with the direction indicated |
|
|
166 |
by `dir-{direction}` as `AP`, `PD` or `IO`, and intensities from 0 to 1, |
|
|
167 |
e.g. 0 representing the Anterior end and 1 the Posterior end. |
|
|
168 |
|
|
|
169 |
Here is an example showing coronal slices of the hippocampus with the |
|
|
170 |
PD, IO, and AP (sagittal slice) overlaid. |
|
|
171 |
|
|
|
172 |
 |
|
|
173 |
|
|
|
174 |
Note that these images have been resampled to `space-corobl` which is |
|
|
175 |
the space in which most processing is done internally. These can be seen |
|
|
176 |
in the `work/` output directory or specified as a possible output space. |
|
|
177 |
|
|
|
178 |
## warps |
|
|
179 |
|
|
|
180 |
ITK transforms to warp images between the `T1w` space to the `unfolded` |
|
|
181 |
space, are provided for each hippocampus: |
|
|
182 |
|
|
|
183 |
sub-{subject} |
|
|
184 |
└── seg |
|
|
185 |
└── sub-001_hemi-R_from-T1w_to-unfold_mode-image_xfm.nii.gz |
|
|
186 |
└── sub-001_hemi-R_from-unfold_to-T1w_mode-image_xfm.nii.gz |
|
|
187 |
|
|
|
188 |
These are ITK transforms that can transform any image that is in `T1w` |
|
|
189 |
space (can be any resolution and FOV, as long as aligned to `T1w`), to |
|
|
190 |
the `unfolded` hippocampal volume space, and vice-versa. You can use the |
|
|
191 |
warp itself as a reference image, e.g.: |
|
|
192 |
|
|
|
193 |
antsApplyTransforms -d 3 \ |
|
|
194 |
-i sub-001_space-T1w_FA.nii.gz \ |
|
|
195 |
-o sub-001_hemi-L_space-unfolded_FA.nii.gz \ |
|
|
196 |
-t sub-001_hemi-L_from-T1w_to-unfold_mode-image_xfm.nii.gz \ |
|
|
197 |
-r sub-001_space-unfolded_refvol.nii.gz |
|
|
198 |
|
|
|
199 |
## Additional Files |
|
|
200 |
|
|
|
201 |
The top-level `PATH_TO_OUTPUT_DIR` contains additional folders: |
|
|
202 |
|
|
|
203 |
├── hippunfold |
|
|
204 |
├── logs |
|
|
205 |
├── work |
|
|
206 |
└── .snakemake |
|
|
207 |
|
|
|
208 |
The hidden `.snakemake` folder contains a record of the code and parameters used, |
|
|
209 |
and paths to the inputs. |
|
|
210 |
|
|
|
211 |
Workflow steps that write logs to file are stored in the `logs` |
|
|
212 |
subfolder, with file names based on the rule wildcards (e.g. subject, |
|
|
213 |
hemi, etc..). |
|
|
214 |
|
|
|
215 |
Intermediate files are stored in the `work` folder. These files and |
|
|
216 |
folders, similar to results, are generally named according to BIDS. This |
|
|
217 |
folder will have `tar.gz` files for each subject, unless the |
|
|
218 |
`--keep_work` option is used. |
|
|
219 |
|
|
|
220 |
If the app is run in workflow mode |
|
|
221 |
(`--workflow-mode`/`-W`) which enables direct |
|
|
222 |
use of the `snakemake` CLI to run hippunfold, the |
|
|
223 |
`hippunfold` and `work` folders will be placed |
|
|
224 |
in a `results` folder. |