✨ Introduce mri_robust_template as option for longitudinal template generation - #2165
✨ Introduce mri_robust_template as option for longitudinal template generation#2165shnizzedy wants to merge 50 commits into
mri_robust_template as option for longitudinal template generation#2165Conversation
…nal (new default) [skip ci]
…longitudinal template space
I think yes and yes for "C-PAC legacy". Here I added some functionality to grab the outputs from the previousl-run graph C-PAC/CPAC/longitudinal/wf/utils.py Lines 157 to 197 in 1e2079f
This section was what I was unsure about, but I think it makes sense. In this refactor, we go from looping over the sessions 3× (once before template generation and twice after) to 2× (once before and once after).
I think the idea was for it to work seamlessly with C-PAC-generated or previously-generated longitudinal templates so long as they're named in the BIDS-ish way C-PAC expects, but that there's been slippage between what C-PAC expects generally and what this specific section of the codebase expects & generates. |
1e2079f to
397c533
Compare
397c533 to
6339798
Compare
|
At this point the outputs of a test run are looking like this: treethumbnailsanat
|
|
There's definitely some weirdness in the outputs. There are outputs with even though they have differentiating |
|
Looks like the empty BOLD files are from the bandpass not passing anything through, could be data-specific. I'm going to try rerunning without bandpass. |
pre-preprocone per subject-session C-PAC/CPAC/longitudinal/wf/anat.py Lines 355 to 373 in 6339798 template nodeone per subject C-PAC/CPAC/longitudinal/wf/anat.py Lines 398 to 499 in 6339798 post-template preprocone per subject-session C-PAC/CPAC/longitudinal/wf/anat.py Lines 508 to 657 in 6339798 main workflowone per subject-session C-PAC/CPAC/pipeline/cpac_pipeline.py Lines 471 to 602 in 6339798 |
352b044 to
1eacbe9
Compare
|
With this pipeline configFROM: default
pipeline_setup:
pipeline_name: longitudinal-test
desired_orientation: RPI
output_directory:
quality_control:
generate_quality_control_images: Off
longitudinal_template_generation:
run: On
# using: C-PAC legacy
registration_workflows:
anatomical_registration:
registration:
using:
- ANTS
# - FSL
# option parameters
ANTs:
# If a lesion mask is available for a T1w image, use it to improve the ANTs' registration
# ANTS registration only.
use_lesion_mask: Off
# ANTs parameters for T1-template-based registration
T1_registration:
- float: 1
- collapse-output-transforms: 0
- dimensionality: 3
- initial-moving-transform:
initializationFeature: 0
- transforms:
- Rigid:
gradientStep: 0.1
metric:
type: MI
metricWeight: 1
numberOfBins: 32
samplingStrategy: Regular
samplingPercentage: 0.25
convergence:
iteration: 1000x500x250x100
convergenceThreshold: 1e-08
convergenceWindowSize: 10
smoothing-sigmas: 3.0x2.0x1.0x0.0
shrink-factors: 8x4x2x1
use-histogram-matching: On
- Affine:
gradientStep: 0.1
metric:
type: MI
metricWeight: 1
numberOfBins: 32
samplingStrategy: Regular
samplingPercentage: 0.25
convergence:
iteration: 1000x500x250x100
convergenceThreshold: 1e-08
convergenceWindowSize: 10
smoothing-sigmas: 3.0x2.0x1.0x0.0
shrink-factors: 8x4x2x1
use-histogram-matching: On
- SyN:
gradientStep: 0.1
updateFieldVarianceInVoxelSpace: 3.0
totalFieldVarianceInVoxelSpace: 0.0
metric:
type: CC
metricWeight: 1
radius: 4
convergence:
iteration: 100x100x70x20
convergenceThreshold: 1e-09
convergenceWindowSize: 15
smoothing-sigmas: 3.0x2.0x1.0x0.0
shrink-factors: 6x4x2x1
use-histogram-matching: On
winsorize-image-intensities:
lowerQuantile: 0.01
upperQuantile: 0.99
nuisance_corrections:
2-nuisance_regression:
run: [Off]
create_regressors: Off
functional_preproc:
run: On
update_header:
run: On
slice_timing_correction:
run: [Off]
motion_estimates_and_correction:
run: Off
distortion_correction:
run: [Off]
func_masking:
run: On
generate_func_mean:
run: On
normalize_func:
run: Off
scaling:
run: Off
despiking:
run: [Off]
coreg_prep:
run: On
timeseries_extraction:
run: Off
amplitude_low_frequency_fluctuation:
run: Off
regional_homogeneity:
run: Off
voxel_mirrored_homotopic_connectivity:
run: On
network_centrality:
run: OffI think the only outputs that look wrong are because the raw functional and anatomical data are oriented so differently from each other, not from any problems in the code here. sub-70009_qc_report.pdf The output tree looks like
I'm not sure what's up with the "missing outputs" in the QC PDFs ― I'm pretty sure there's no erosion in the config and that we've got a brain mask in each of the expected spaces. There is a bug with the C-PAC |
d087351 to
00e441b
Compare
00e441b to
610c191
Compare
|
At this point in the code, I think it works? The output tree for two test subjects looks likewith this test config. Some of the template-space functional images look good (e.g.,
Here're the
(This should still definitely wait for the next release after 1.8.8) |
|||||||||||||||||||||||||||
Co-authored-by: Jon Cluce <jon.clucas@childmind.org>
for more information, see https://pre-commit.ci


































Fixes
Related to #2164 by @shnizzedy & @Shinwon Park
Fixes #2254 by @birajstha
Includes #2237 by @birajstha
Description
usingoption tolongitudinal_template_generationwith a choice ofmri_robust_template(default) orC-PAC legacyC-PAC/CPAC/resources/configs/pipeline_config_default.yml
Line 243 in e6d33f5
C-PAC/CPAC/resources/configs/pipeline_config_default.yml
Lines 253 to 255 in e6d33f5
flowchart LR anat_longitudinal_pre-preproc("<code>anat_longitudinal_pre-preproc</code><br>(one per subject session)") --> template_node_brain("<code>template_node_brain</code><br>(one per subject)") template_node_brain --> ses_wf("<code>ses_wf</code><br>(one per subject session)")anatdirectory that's a sibling to all the session directories, and that thatanatdirectory has all the subject-but-not-session-specific outputs in it.from-T1w_to-longitudinalandfrom-longitudinal_to-{template}andfrom-T1w_to-{template}or do we want to leave any out to be recalculated as needed?Technical details
Still to do
Tests
Screenshots
tree sub-70009Checklist
Update index.md).prep_for/mri_robust_templatebranch of the repository.Developer Certificate of Origin
Developer Certificate of Origin