Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QSIRecon: NameError: name 'has_qsiprep_t1w' is not defined #705

Open
smeisler opened this issue Feb 29, 2024 · 9 comments
Open

QSIRecon: NameError: name 'has_qsiprep_t1w' is not defined #705

smeisler opened this issue Feb 29, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@smeisler
Copy link
Collaborator

smeisler commented Feb 29, 2024

Summary

When starting a recon workflow (HSVS tractography --> pyafq and scaler production) I get an error when logging what anatomical inputs are available.

Additional details

  • QSIPrep 0.20.0
  • Apptainer 1.1.7

What actually happened?

    Running qsirecon version 0.20.1.dev0+geda84d5.d20240112:
      * BIDS dataset path: /om2/scratch/tmp/smeisler/fsub_proc/sub-01/data.
      * Participant list: ['01'].
      * Run identifier: 20240228-215923_25b787db-62e3-47fc-bb80-ffa9d166b8ac.
    
240228-21:59:29,67 nipype.workflow INFO:
	 found ['/om2/scratch/tmp/smeisler/fsub_proc/sub-01/data/derivatives/qsiprep/sub-01/dwi/sub-01_space-T1w_desc-preproc_dwi.nii.gz'] in /om2/scratch/tmp/smeisler/fsub_proc/sub-01/data/derivatives/qsiprep
240228-21:59:29,74 nipype.workflow WARNING:
	 A Non-gzipped input nifti file was found. Consider gzipping /om2/scratch/tmp/smeisler/fsub_proc/sub-01/data/derivatives/qsiprep/sub-01/anat/sub-01_desc-preproc_T1w.nii
240228-21:59:29,74 nipype.workflow INFO:
	 Found usable QSIPrep-preprocessed T1w image and mask.
240228-21:59:29,77 nipype.workflow INFO:
	 Found high-res anatomical data in preprocessed inputs for 01.
240228-21:59:29,78 nipype.workflow INFO:
	 Freesurfer directory /om2/scratch/tmp/smeisler/fsub_proc/sub-01/data/derivatives/freesurfer/sub-01 exists for 01
240228-21:59:29,82 nipype.workflow INFO:
	 FreeSurfer data will be used to create a HSVS 5tt image.
Process Process-36:
Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/local/miniconda/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/cli/run.py", line 1198, in build_recon_workflow
    retval['workflow'] = init_qsirecon_wf(
  File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/workflows/recon/base.py", line 99, in init_qsirecon_wf
    single_subject_wf = init_single_subject_wf(
  File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/workflows/recon/base.py", line 208, in init_single_subject_wf
    anat_ingress_node, available_anatomical_data = init_highres_recon_anatomical_wf(
  File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/workflows/recon/anatomical.py", line 162, in init_highres_recon_anatomical_wf
    if has_qsiprep_t1w:
NameError: name 'has_qsiprep_t1w' is not defined

Reproducing the bug

QSIPrep CMD

singularity run -e --containall -B $scratch,$templateflow $IMG \
$scratch/data/ $scratch/data/derivatives participant \
--participant_label $SUB \
-w $scratch \
--output_resolution 1.25 \
--unringing-method mrdegibbs \
--recon-spec $scratch/recon_spec.json \
--freesurfer-input $scratch/data/derivatives/freesurfer/ \
--fs-license-file $scratch/license.txt \
--skip-odf-reports \
--notrack \
--mem_mb 239000 \
--nthreads 32 \
--omp-nthreads 8 \

Recon spec

{
"name": "mrtrix_multishell_msmt_hsvs_pyafq_tractometry",
"space": "T1w",
"atlases": [],
"anatomical": [
	"mrtrix_5tt_hsvs"
],
"nodes": [{
		"name": "msmt_csd",
		"software": "MRTrix3",
		"action": "csd",
		"output_suffix": "msmtcsd",
		"input": "qsiprep",
		"parameters": {
			"mtnormalize": true,
			"response": {
				"algorithm": "dhollander"
			},
			"fod": {
				"algorithm": "msmt_csd",
				"max_sh": [8, 8, 8]
			}
		}
	},
	{
		"name": "track_ifod2",
		"software": "MRTrix3",
		"action": "tractography",
		"output_suffix": "ifod2",
		"input": "msmt_csd",
		"parameters": {
			"use_5tt": true,
			"method_5tt": "hsvs",
			"use_sift2": true,
			"tckgen": {
				"algorithm": "iFOD2",
				"select": 1e7,
				"max_length": 250,
				"min_length": 30,
				"power": 0.33,
				"crop_at_gmwmi": true,
				"backtrack": true,
				"quiet": true
			},
			"sift2": {}
		}
	},
	{
		"name": "pyafq_tractometry",
		"software": "pyAFQ",
		"action": "pyafq_tractometry",
		"input": "track_ifod2",
		"output_suffix": "PYAFQ_TRACTOMETRY_ET",
		"parameters": {
			"use_external_tracking": true,
			"export": "all",
			"directions": "prob",
			"max_angle": 30.0,
			"sphere": "",
			"seed_mask": "",
			"seed_threshold": 0,
			"n_seeds": 1,
			"random_seeds": false,
			"rng_seed": "",
			"stop_mask": "",
			"stop_threshold": 0,
			"step_size": 0.5,
			"min_length": 50,
			"max_length": 250,
			"odf_model": "CSD",
			"tracker": "local",
			"nb_points": false,
			"nb_streamlines": false,
			"seg_algo": "AFQ",
			"reg_algo": "",
			"clip_edges": false,
			"parallel_segmentation": "{'n_jobs': -1, 'engine': 'joblib', 'backend': 'loky'}",
			"progressive": true,
			"greater_than": 50,
			"rm_small_clusters": 50,
			"model_clust_thr": 1.25,
			"reduction_thr": 25,
			"refine": false,
			"pruning_thr": 12,
			"b0_threshold": 50,
			"prob_threshold": 0,
			"roi_dist_tie_break": false,
			"dist_to_waypoint": "",
			"rng": "",
			"return_idx": false,
			"presegment_bundle_dict": "",
			"presegment_kwargs": "{}",
			"filter_by_endpoints": true,
			"dist_to_atlas": 4,
			"save_intermediates": "",
			"n_points": 100,
			"clean_rounds": 5,
			"distance_threshold": 3,
			"length_threshold": 4,
			"min_sl": 20,
			"stat": "mean",
			"min_bval": "",
			"max_bval": "",
			"filter_b": true,
			"robust_tensor_fitting": false,
			"csd_response": "",
			"csd_sh_order": "",
			"csd_lambda_": 1,
			"csd_tau": 0.1,
			"gtol": 0.01,
			"brain_mask_definition": "",
			"bundle_info": "",
			"reg_template_spec": "mni_T1",
			"mapping_definition": "",
			"reg_subject_spec": "power_map",
			"profile_weights": "gauss",
			"scalars": "['dki_fa', 'dki_md']",
			"import_tract": "",
			"sbv_lims_bundles": "[None, None]",
			"volume_opacity_bundles": 0.3,
			"n_points_bundles": 40,
			"sbv_lims_indiv": "[None, None]",
			"volume_opacity_indiv": 0.3,
			"n_points_indiv": 40,
			"viz_backend_spec": "plotly_no_gif",
			"virtual_frame_buffer": false
		}
	},
	{
		"name": "fit_noddi",
		"action": "fit_noddi",
		"software": "AMICO",
		"input": "qsiprep",
		"output_suffix": "NODDI",
		"parameters": {
			"isExvivo": false,
			"dPar": 1.7E-3,
			"dIso": 3.0E-3
		}
	},
	{
		"name": "dki_recon",
		"software": "Dipy",
		"action": "DKI_reconstruction",
		"input": "qsiprep",
		"output_suffix": "DKI",
		"parameters": {
			"write_mif": false,
			"write_fibgz": false
		}
	},
	{
		"name": "dsistudio_gqi",
		"software": "DSI Studio",
		"action": "reconstruction",
		"input": "qsiprep",
		"output_suffix": "gqi",
		"parameters": {
			"method": "gqi"
		}
	},
	{
		"name": "scalar_export",
		"software": "DSI Studio",
		"action": "export",
		"input": "dsistudio_gqi",
		"output_suffix": "gqiscalar"
	},
	{
		"name": "autotrackgqi",
		"software": "DSI Studio",
		"action": "autotrack",
		"input": "dsistudio_gqi",
		"output_suffix": "AutoTrackGQI",
		"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
		}
	}
]
}

My diagnosis

I know that file has changed in recent commits but it looks like, at least at the release of 0.20.0, has_qsiprep_t1w was not defined in def init_highres_recon_anatomical_wf, and was only defined in the def gather_qsiprep_anatomical_data function. In earlier commits (e.g., 8ee6440), the input gathering was done in init_highres_recon_anatomical_wf, which might be why the error is popping up now.

Thanks,
Steven

@smeisler smeisler added the bug Something isn't working label Feb 29, 2024
@mattcieslak
Copy link
Collaborator

I just ran into this one too, thanks for opening the issue

@tsalo
Copy link
Member

tsalo commented Mar 4, 2024

Seems related to #675 as well.

@mattcieslak
Copy link
Collaborator

Does anyone on this thread know of a good open dataset that has dwi and freesurfer results? The reason this exists as a bug now is that I don't have any good testing data for the hsvs workflow

@smeisler
Copy link
Collaborator Author

smeisler commented Mar 4, 2024

I have bids-ified one subject of the Natural Scenes Dataset, found here: (edit to remove link) I also have qsiprep outputs for it already, so you can go right to qsirecon testing.

@mattcieslak
Copy link
Collaborator

this is perfect! Do you mind if I use this in the CI tests?

@smeisler
Copy link
Collaborator Author

smeisler commented Mar 4, 2024

Don't mind at all!

@smeisler
Copy link
Collaborator Author

smeisler commented Mar 4, 2024

You should sign the data access agreement, though: https://docs.google.com/forms/d/e/1FAIpQLSduTPeZo54uEMKD-ihXmRhx0hBDdLHNsVyeo_kCb8qbyAkXuQ/viewform

@mattcieslak
Copy link
Collaborator

You're allowed to host the data on openneuro even with point 3 I will not distribute this dataset or its components to any other individual or entity?

@arokem
Copy link
Contributor

arokem commented Mar 4, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants