Skip to content

Commit

Permalink
[ENH] Add recon workflow for hbcd beta (#735)
Browse files Browse the repository at this point in the history
add recon workflow for hbcd beta
  • Loading branch information
mattcieslak authored Apr 25, 2024
1 parent 715a8cc commit 8fd846e
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 3 deletions.
122 changes: 122 additions & 0 deletions qsiprep/data/pipelines/hbcd_scalar_maps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"name": "hbcd_postproc_beta",
"space" : "T1w",
"atlases": [ ],
"anatomical": [ ],
"nodes": [
{
"name": "dipy_dki",
"software": "Dipy",
"action": "DKI_reconstruction",
"input": "qsiprep",
"qsirecon_suffix": "DIPYDKI",
"parameters": {
"write_mif": false,
"write_fibgz": false
}
},
{
"name": "tortoise_dtmapmri",
"software": "TORTOISE",
"action": "estimate",
"qsirecon_suffix": "TORTOISE_model-MAPMRI",
"input": "qsiprep",
"parameters": {
"estimate_tensor_separately": true,
"big_delta": null,
"small_delta": null,
"estimate_tensor": {
"bval_cutoff": 1200,
"write_cs": true},
"estimate_mapmri": {
"map_order": 4}
}
},
{
"name": "tortoise_fullshell_tensor",
"software": "TORTOISE",
"action": "estimate",
"qsirecon_suffix": "TORTOISE_model-tensor",
"input": "qsiprep",
"parameters": {
"estimate_tensor_separately": true,
"big_delta": null,
"small_delta": null,
"estimate_tensor": {
"bval_cutoff": 4000,
"write_cs": true}
}
},
{
"name": "fit_noddi",
"action": "fit_noddi",
"software": "AMICO",
"input": "qsiprep",
"qsirecon_suffix": "NODDI",
"parameters": {
"isExvivo": false,
"dPar": 1.7E-3,
"dIso": 3.0E-3
}
},
{
"name": "dsistudio_gqi",
"software": "DSI Studio",
"action": "reconstruction",
"input": "qsiprep",
"qsirecon_suffix": "DSIStudio",
"parameters": {
"method": "gqi"
}
},
{
"name": "autotrackgqi",
"software": "DSI Studio",
"action": "autotrack",
"input": "dsistudio_gqi",
"qsirecon_suffix": "DSIStudio",
"parameters": {
"track_id": "Fasciculus,Cingulum,Aslant,Corticos,Thalamic_R,Reticular,Optic,Fornix,Corpus",
"tolerance": "22,26,30",
"track_voxel_ratio": 2.0,
"yield_rate": 0.000001
}
},
{
"name": "gqi_scalars",
"software": "DSI Studio",
"action": "export",
"input": "dsistudio_gqi",
"qsirecon_suffix": "DSIStudio"
},
{
"name": "bundle_means",
"software": "qsiprep",
"action": "bundle_map",
"input": "autotrackgqi",
"scalars_from": [
"gqi_scalars",
"dipy_dki",
"fit_noddi",
"tortoise_fullshell_tensor",
"tortoise_dtmapmri"
]
},
{
"name": "template_map",
"software": "qsiprep",
"action": "template_map",
"input": "qsiprep",
"scalars_from": [
"gqi_scalars",
"dipy_dki",
"fit_noddi",
"tortoise_fullshell_tensor",
"tortoise_dtmapmri"
],
"parameters": {
"interpolation": "NearestNeighbor"
}
}
]
}
14 changes: 11 additions & 3 deletions qsiprep/interfaces/scalar_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import logging
import os.path as op
import subprocess

Expand All @@ -22,6 +23,7 @@
)
from nipype.utils.filemanip import fname_presuffix

LOGGER = logging.getLogger("nipype.interface")
from .bids import get_bids_params


Expand Down Expand Up @@ -198,9 +200,15 @@ def calculate_mask_stats(
if weighting_vector is not None:
results["weighted_mean"] = np.sum(voxel_data * weighting_vector)
nz_weighting_vector = weighting_vector.copy()
nz_weighting_vector[np.isnan(nz_voxel_data)] = np.nan
nz_weighting_vector = nz_weighting_vector / np.nansum(nz_weighting_vector)
results["masked_weighted_mean"] = np.nansum(nz_voxel_data * nz_weighting_vector)
try:
nz_weighting_vector[np.isnan(nz_voxel_data)] = np.nan
nz_weighting_vector = nz_weighting_vector / np.nansum(nz_weighting_vector)
results["masked_weighted_mean"] = np.nansum(nz_voxel_data * nz_weighting_vector)
except Exception as exc:
LOGGER.warn(
f"Error calculating weighted mean of {variable_name} in {mask_name}\n{exc}"
)
results["masked_weighted_mean"] = np.nan

return results

Expand Down

0 comments on commit 8fd846e

Please sign in to comment.