-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- only one atlas from CLI instead of multiples (was using atlas[0] some places) - remove final transforms (not used with nativesurf workflow) - giftis only for atlas (needs updated multihist7 files - workflow to generate these in resources/atlas-v2 for now) - use unfoldedreg when the atlas has the metrics - option for dentate-based unfoldreg too (unused right now) TODO: - update atlas files (use another location for testing) - check unfoldreg warps - make nativesurf the default
- Loading branch information
Showing
12 changed files
with
422 additions
and
575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# WIP - workflow for updating atlases to new v2 specs | ||
|
||
This example is run from the existing multihist atlas folder. | ||
|
||
Still needs updates for cifti structure labels etc (will add this in once we have an updated wb_command/wb_view in our deps) | ||
|
||
We currently have templates and atlases in hippunfold (selected by --template and --atlas), where the former selects the volume-based template used for volumetric registration, and the latter selects the unfolded-space subfields (and metrics for unfolded registration). I am proposing the latter become purely surface-based, so instead of providing labels and metrics in the volumetric unfolded space, we use giftis for everything, and this now becomes surface-templates instead of atlases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
|
||
hippunfold_dir='/localscratch/hippunfold_khanlab' | ||
hipp_dseg='sub-maxprob_label-hipp_desc-manualsubfieldsunfoldaligned_dseg.nii.gz' | ||
labellist='labellist_withdg.txt' | ||
|
||
hemis=['L','R'] | ||
metrics=['thickness','curvature','gyrification'] | ||
surftypes=['midthickness','inner','outer'] | ||
|
||
hemi_to_structure = {"L": "CORTEX_LEFT", "R": "CORTEX_RIGHT"} | ||
surf_to_secondary_type = { | ||
"midthickness": "MIDTHICKNESS", | ||
"inner": "PIAL", | ||
"outer": "GRAY_WHITE", | ||
} | ||
|
||
|
||
|
||
rule all: | ||
input: | ||
expand('hemi-{hemi}_label-{label}_dseg.label.gii',label=['hipp','dentate'],hemi=hemis), | ||
expand('hemi-{hemi}_label-{label}_{metric}.shape.gii',label=['hipp'],hemi=hemis,metric=metrics), | ||
expand('hemi-{hemi}_space-unfold_label-{label}_{surftype}.surf.gii',label=['hipp','dentate'],hemi=hemis,surftype=surftypes), | ||
|
||
|
||
|
||
rule hipp_dseg: | ||
input: | ||
hipp_dseg | ||
output: | ||
temp('hipp_dseg.nii.gz') | ||
shell: | ||
'cp {input} {output}' | ||
|
||
rule dentate_dseg: | ||
input: | ||
hipp_dseg | ||
params: | ||
dg_label=6 | ||
output: | ||
temp('dentate_dseg.nii.gz') | ||
shell: | ||
'c3d {input} -scale 0 -shift {params.dg_label} -o {output}' | ||
|
||
rule surf_gifti: | ||
input: | ||
surf_gii=Path(hippunfold_dir) / 'hippunfold' / 'resources' / 'unfold_template_{label}' / 'tpl-avg_space-unfold_den-unfoldiso_{surftype}.surf.gii' | ||
params: | ||
structure_type=lambda wildcards: hemi_to_structure[wildcards.hemi], | ||
secondary_type=lambda wildcards: surf_to_secondary_type[wildcards.surftype], | ||
surface_type="FLAT", | ||
output: | ||
surf_gii='hemi-{hemi}_space-unfold_label-{label}_{surftype}.surf.gii' | ||
shell: | ||
'cp {input} {output} && ' | ||
"wb_command -set-structure {output} {params.structure_type} -surface-type {params.surface_type}" | ||
" -surface-secondary-type {params.secondary_type}" | ||
|
||
|
||
rule label_gifti: | ||
input: | ||
dseg_nii='{label}_dseg.nii.gz', | ||
lut=labellist, | ||
surf_gii='hemi-{hemi}_space-unfold_label-{label}_midthickness.surf.gii' | ||
params: | ||
structure_type=lambda wildcards: hemi_to_structure[wildcards.hemi], | ||
output: | ||
label_gii='hemi-{hemi}_label-{label}_dseg.label.gii' | ||
shadow: 'minimal' | ||
shell: | ||
'wb_command -volume-label-import {input.dseg_nii} {input.lut} label_vol.nii && ' | ||
'wb_command -volume-label-to-surface-mapping label_vol.nii {input.surf_gii} {output.label_gii} && ' | ||
"wb_command -set-structure {output} {params.structure_type}" | ||
|
||
|
||
|
||
rule metric_gifti: | ||
input: | ||
metric_nii='{metric}.nii.gz', | ||
surf_gii='hemi-{hemi}_space-unfold_label-{label}_inner.surf.gii' #existing metric niftis are on inner space | ||
params: | ||
structure_type=lambda wildcards: hemi_to_structure[wildcards.hemi], | ||
output: | ||
metric_gii='hemi-{hemi}_label-{label}_{metric}.shape.gii' | ||
shadow: 'minimal' | ||
shell: | ||
'wb_command -volume-to-surface-mapping {input.metric_nii} {input.surf_gii} {output.metric_gii} -trilinear && ' | ||
"wb_command -set-structure {output} {params.structure_type}" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Subiculum | ||
1 0 0 255 255 | ||
CA1 | ||
2 133 222 255 255 | ||
CA2 | ||
3 0 255 170 255 | ||
CA3 | ||
4 255 162 0 255 | ||
CA4 | ||
5 255 0 0 255 | ||
DG | ||
6 255 255 0 255 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.