User Tools

Site Tools


neuroimagen:dcm2bids

Convertir DICOMs a BIDS

Dada la creciente aparicion de software de analisis que utiliza el formato BIDS necesitamos implementar un procedimiento para convertir las imagenes DICOM directamente. Ya hemos implementado un esquema para convertir los NIfTI deberiamos quitar el paso intermedio y asegurarnos que no haya perdida de datos por el camino. Voy a empezar mirando dmc2bids que parece prometedor.

Know your data ;-)

Lo mas complicado es que tenemos que escribir un archivo de configuracion para el proceso.

Primero corremos dcm2bids_scaffold que genera la estructura necesaria para ejecutar la conversion,

[osotolongo@detritus tmp]$ dcm2bids_scaffold
[osotolongo@detritus tmp]$ ls
CHANGES  code  dataset_description.json  derivatives  participants.json  participants.tsv  README  sourcedata

Ahora ejecutamos dcm2bids_helper sobre un sujeto de ejemplo,

[osotolongo@detritus tmp]$ dcm2bids_helper -d /nas/corachan/MOPEAD/24N223T4/
Example in:
/nas/data/mopead/tmp/tmp_dcm2bids/helper
[osotolongo@detritus tmp]$ ls tmp_dcm2bids/helper/
10001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008.json	    23001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.json
10001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008.nii.gz	    23001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.nii.gz
1001_24N223T4_AAhead_scout_20181205124008.json			    24001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.json
1001_24N223T4_AAhead_scout_20181205124008.nii.gz		    24001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.nii.gz
11001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008.json	    25001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.json
11001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008.nii.gz	    25001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.nii.gz
12001_24N223T4_ep2d_bold_p2_resting_state_20181205124008.json	    27001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.json
12001_24N223T4_ep2d_bold_p2_resting_state_20181205124008.nii.gz     27001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.nii.gz
14001_24N223T4_ep2d_fid_basic_bold_p2_AP_20181205124008.json	    28001_24N223T4_DTIep2d_diff_mddw_4b0_PA_20181205124008.json
14001_24N223T4_ep2d_fid_basic_bold_p2_AP_20181205124008.nii.gz	    28001_24N223T4_DTIep2d_diff_mddw_4b0_PA_20181205124008.nii.gz
15001_24N223T4_ep2d_fid_basic_bold_p2_PA_20181205124008.json	    5001_24N223T4_t1_mprage_sag_p2_iso_20181205124008.json
15001_24N223T4_ep2d_fid_basic_bold_p2_PA_20181205124008.nii.gz	    5001_24N223T4_t1_mprage_sag_p2_iso_20181205124008.nii.gz
16001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008.json	    6001_24N223T4_t2_space_dark-fluid_sag_p2_iso_20181205124008.json
16001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008.nii.gz     6001_24N223T4_t2_space_dark-fluid_sag_p2_iso_20181205124008.nii.gz
18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008_e1.json    7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1a.json
18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008_e1.nii.gz  7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1a.nii.gz
18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008.json	    7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1.json
18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008.nii.gz     7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1.nii.gz
20001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.json    8001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008.json
20001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.nii.gz  8001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008.nii.gz
22001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.json    9001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008_ph.json
22001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008.nii.gz  9001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008_ph.nii.gz

Esto genera los archivos NIfTI y .json con el contenido del DCM. De aqui debemos generar el archivo de configuracion.

Lo que nos interesa es T1, T2, DTI y fMRI. Vamos a empezar por el T1,

[osotolongo@detritus tmp]$ ls tmp_dcm2bids/helper/ | grep t1
5001_24N223T4_t1_mprage_sag_p2_iso_20181205124008.json
5001_24N223T4_t1_mprage_sag_p2_iso_20181205124008.nii.gz
[osotolongo@detritus tmp]$ cat tmp_dcm2bids/helper/5001_24N223T4_t1_mprage_sag_p2_iso_20181205124008.json
{
	"Modality": "MR",
	"MagneticFieldStrength": 3,
	"Manufacturer": "Siemens",
	"ManufacturersModelName": "MAGNETOM_Vida",
	"InstitutionName": "Clinica_Corachan",
	"InstitutionAddress": "Calle_Buigas_19_Barcelona_ES_08007",
	"DeviceSerialNumber": "175609",
	"StationName": "AWP175609",
	"BodyPartExamined": "BRAIN",
	"PatientPosition": "HFS",
	"ProcedureStepDescription": "RM_CRANEO_PROT_MOPEAD",
	"SoftwareVersions": "syngo_MR_XA10",
	"MRAcquisitionType": "3D",
	"SeriesDescription": "t1_mprage_sag_p2_iso",
	"ProtocolName": "t1_mprage_sag_p2_iso",
	"ScanningSequence": "GR",
	"SequenceVariant": "SK",
	"ScanOptions": "PFP_PER",
	"SequenceName": "_tfl3d1_16ns",
	"ImageType": ["ORIGINAL", "PRIMARY", "M", "NORM", "DIS2D", "MFSPLIT"],
	"SeriesNumber": 5001,
	"AcquisitionTime": "12:41:26.122500",
	"AcquisitionNumber": 1,
	"SliceThickness": 1.2,
	"SAR": 0.0822361,
	"EchoTime": 0.00223,
	"RepetitionTime": 2.2,
	"InversionTime": 0.968,
	"FlipAngle": 8,
	"PercentPhaseFOV": 93.75,
	"PhaseEncodingSteps": 240,
	"AcquisitionMatrixPE": 240,
	"ReconMatrixPE": 256,
	"PixelBandwidth": 199,
	"ImageOrientationPatientDICOM": [
		0,
		0.99916,
		-0.0409808,
		0,
		-0.0409808,
		-0.99916	],
	"InPlanePhaseEncodingDirectionDICOM": "ROW",
	"ConversionSoftware": "dcm2niix",
	"ConversionSoftwareVersion": "v1.0.20180622 (JP2:OpenJPEG) (JP-LS:CharLS) GCC5.5.0"
}

Tenemos que hacer un archivo que diga el criterio de busqueda para dcm2bids y como etiquetar la salida,

{
	"descriptions": [
		{
			"dataType": "anat",
			"modalityLabel": "T1w",
			"criteria": {
				"SeriesDescription": "t1_mprage_sag_p2_iso"
			}
		}
	]
}

Vamos a probarlo ahora, segun nuestra DB, este sujeto es el 0024, asi que,

[osotolongo@detritus tmp]$ dcm2bids -d /nas/corachan/MOPEAD/24N223T4/ -p 0024 -c conv_config.json 
INFO:dcm2bids.dcm2bids:--- dcm2bids start ---
INFO:dcm2bids.dcm2bids:OS:version: Linux-2.6.32-431.17.1.el6.centos.plus.x86_64-x86_64-with-centos-6.10-Final
INFO:dcm2bids.dcm2bids:python:version: 3.4.8 (default, Apr  9 2018, 11:43:18) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]
INFO:dcm2bids.dcm2bids:dcm2bids:version: 2.1.4
INFO:dcm2bids.dcm2bids:dcm2niix:version: v1.0.20180622
INFO:dcm2bids.dcm2bids:participant: sub-0024
INFO:dcm2bids.dcm2bids:session: 
INFO:dcm2bids.dcm2bids:config: /nas/data/mopead/tmp/conv_config.json
INFO:dcm2bids.dcm2bids:BIDS directory: /nas/data/mopead/tmp
INFO:dcm2bids.utils:Running dcm2niix -b y -ba y -z y -f '%3s_%f_%p_%t' -o /nas/data/mopead/tmp/tmp_dcm2bids/sub-0024 /nas/corachan/MOPEAD/24N223T4/
INFO:dcm2bids.dcm2niix:Check log file for dcm2niix output
INFO:dcm2bids.sidecar:Sidecars pairing:
INFO:dcm2bids.sidecar:No Pairing  <-  1001_24N223T4_AAhead_scout_20181205124008
INFO:dcm2bids.sidecar:_T1w  <-  5001_24N223T4_t1_mprage_sag_p2_iso_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  6001_24N223T4_t2_space_dark-fluid_sag_p2_iso_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1
INFO:dcm2bids.sidecar:No Pairing  <-  7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1a
INFO:dcm2bids.sidecar:No Pairing  <-  8001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  9001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008_ph
INFO:dcm2bids.sidecar:No Pairing  <-  10001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  11001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  12001_24N223T4_ep2d_bold_p2_resting_state_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  14001_24N223T4_ep2d_fid_basic_bold_p2_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  15001_24N223T4_ep2d_fid_basic_bold_p2_PA_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  16001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008_e1
INFO:dcm2bids.sidecar:No Pairing  <-  20001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  22001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  23001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  24001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  25001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  27001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  28001_24N223T4_DTIep2d_diff_mddw_4b0_PA_20181205124008
INFO:dcm2bids.dcm2bids:moving acquisitions into BIDS folder
WARNING:dcm2bids.version:Your using dcm2niix version v1.0.20180622
WARNING:dcm2bids.version:A new version exists : v1.0.20190410
WARNING:dcm2bids.version:Check https://github.com/rordenlab/dcm2niix

y nos deja el T1 en su sitio,

[osotolongo@detritus tmp]$ tree sub-0024
sub-0024
└── anat
    ├── sub-0024_T1w.json
    └── sub-0024_T1w.nii.gz

1 directory, 2 files

Vamos a intentar añadir ahora el fMRI que se ve menos complicado,

[osotolongo@detritus tmp]$ cat conv_config.json
{
	"descriptions": [
		{
			"dataType": "anat",
			"modalityLabel": "T1w",
			"criteria": {
				"SeriesDescription": "t1_mprage_sag_p2_iso"
			}
		},
		{
			"dataType": "func",
			"modalityLabel": "bold",
			"customLabels": "task-rest",
			"criteria": {
				"SeriesDescription": "*resting_state",
			}
		}
	]
}
[osotolongo@detritus tmp]$ dcm2bids -d /nas/corachan/MOPEAD/24N223T4/ -p 0024 -c conv_config.json 
INFO:dcm2bids.dcm2bids:--- dcm2bids start ---
INFO:dcm2bids.dcm2bids:OS:version: Linux-2.6.32-431.17.1.el6.centos.plus.x86_64-x86_64-with-centos-6.10-Final
INFO:dcm2bids.dcm2bids:python:version: 3.4.8 (default, Apr  9 2018, 11:43:18) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]
INFO:dcm2bids.dcm2bids:dcm2bids:version: 2.1.4
INFO:dcm2bids.dcm2bids:dcm2niix:version: v1.0.20180622
INFO:dcm2bids.dcm2bids:participant: sub-0024
INFO:dcm2bids.dcm2bids:session: 
INFO:dcm2bids.dcm2bids:config: /nas/data/mopead/tmp/conv_config.json
INFO:dcm2bids.dcm2bids:BIDS directory: /nas/data/mopead/tmp
WARNING:dcm2bids.dcm2niix:Previous dcm2niix directory output found:
WARNING:dcm2bids.dcm2niix:/nas/data/mopead/tmp/tmp_dcm2bids/sub-0024
WARNING:dcm2bids.dcm2niix:Use --forceDcm2niix to rerun dcm2niix
INFO:dcm2bids.sidecar:Sidecars pairing:
INFO:dcm2bids.sidecar:No Pairing  <-  1001_24N223T4_AAhead_scout_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  6001_24N223T4_t2_space_dark-fluid_sag_p2_iso_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1
INFO:dcm2bids.sidecar:No Pairing  <-  7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1a
INFO:dcm2bids.sidecar:No Pairing  <-  8001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  9001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008_ph
INFO:dcm2bids.sidecar:No Pairing  <-  10001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  11001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008
INFO:dcm2bids.sidecar:_task-rest_bold  <-  12001_24N223T4_ep2d_bold_p2_resting_state_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  14001_24N223T4_ep2d_fid_basic_bold_p2_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  15001_24N223T4_ep2d_fid_basic_bold_p2_PA_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  16001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008_e1
INFO:dcm2bids.sidecar:No Pairing  <-  20001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  22001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  23001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  24001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  25001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  27001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  28001_24N223T4_DTIep2d_diff_mddw_4b0_PA_20181205124008
INFO:dcm2bids.dcm2bids:moving acquisitions into BIDS folder
WARNING:dcm2bids.version:Your using dcm2niix version v1.0.20180622
WARNING:dcm2bids.version:A new version exists : v1.0.20190410
WARNING:dcm2bids.version:Check https://github.com/rordenlab/dcm2niix
[osotolongo@detritus tmp]$ tree sub-0024
sub-0024
├── anat
│   ├── sub-0024_T1w.json
│   └── sub-0024_T1w.nii.gz
└── func
    ├── sub-0024_task-rest_bold.json
    └── sub-0024_task-rest_bold.nii.gz

2 directories, 4 files

Voy a cambiar las reglas y asegurarme que se sobreescriba todo,

[osotolongo@detritus tmp]$ cat conv_config.json
{
	"descriptions": [
		{
			"dataType": "anat",
			"modalityLabel": "T1w",
			"criteria": {
				"SeriesDescription": "t1_mprage_sag_p2_iso"
			}
		},
		{
			"dataType": "func",
			"modalityLabel": "bold",
			"customLabels": "task-rest",
			"criteria": {
				"SeriesDescription": "*resting_state+"
			}
		},
		{
			"dataType": "func",
                        "modalityLabel": "bold",
                        "customLabels": "task-rest_dir-PA_sbref",
			"criteria": {
				"SeriesDescription": "ep2d_fid_basic_bold_p2_PA"
			}
		},
                {
                        "dataType": "func",
                        "modalityLabel": "bold",
                        "customLabels": "task-rest_dir-AP_sbref",
                        "criteria": {
                                "SeriesDescription": "ep2d_fid_basic_bold_p2_AP"
                        }
                }
	]
}

[osotolongo@detritus tmp]$ dcm2bids -d /nas/corachan/MOPEAD/24N223T4/ -p 0024 -c conv_config.json --clobber --forceDcm2niix
INFO:dcm2bids.dcm2bids:--- dcm2bids start ---
INFO:dcm2bids.dcm2bids:OS:version: Linux-2.6.32-431.17.1.el6.centos.plus.x86_64-x86_64-with-centos-6.10-Final
INFO:dcm2bids.dcm2bids:python:version: 3.4.8 (default, Apr  9 2018, 11:43:18) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]
INFO:dcm2bids.dcm2bids:dcm2bids:version: 2.1.4
INFO:dcm2bids.dcm2bids:dcm2niix:version: v1.0.20180622
INFO:dcm2bids.dcm2bids:participant: sub-0024
INFO:dcm2bids.dcm2bids:session: 
INFO:dcm2bids.dcm2bids:config: /nas/data/mopead/tmp/conv_config.json
INFO:dcm2bids.dcm2bids:BIDS directory: /nas/data/mopead/tmp
WARNING:dcm2bids.dcm2niix:Previous dcm2niix directory output found:
WARNING:dcm2bids.dcm2niix:/nas/data/mopead/tmp/tmp_dcm2bids/sub-0024
WARNING:dcm2bids.dcm2niix:'force' argument is set to True
WARNING:dcm2bids.dcm2niix:Cleaning the previous directory and running dcm2niix
INFO:dcm2bids.utils:Running dcm2niix -b y -ba y -z y -f '%3s_%f_%p_%t' -o /nas/data/mopead/tmp/tmp_dcm2bids/sub-0024 /nas/corachan/MOPEAD/24N223T4/
INFO:dcm2bids.dcm2niix:Check log file for dcm2niix output
INFO:dcm2bids.sidecar:Sidecars pairing:
INFO:dcm2bids.sidecar:No Pairing  <-  1001_24N223T4_AAhead_scout_20181205124008
INFO:dcm2bids.sidecar:_T1w  <-  5001_24N223T4_t1_mprage_sag_p2_iso_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  6001_24N223T4_t2_space_dark-fluid_sag_p2_iso_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1
INFO:dcm2bids.sidecar:No Pairing  <-  7001_24N223T4_pd+t2_tse_tra_p2_3mm_20181205124008_e1a
INFO:dcm2bids.sidecar:No Pairing  <-  8001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  9001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008_ph
INFO:dcm2bids.sidecar:No Pairing  <-  10001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  11001_24N223T4_t2_swi_tra_p2_384_2mm_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  12001_24N223T4_ep2d_bold_p2_resting_state_20181205124008
INFO:dcm2bids.sidecar:_task-rest_dir-AP_sbref_bold  <-  14001_24N223T4_ep2d_fid_basic_bold_p2_AP_20181205124008
INFO:dcm2bids.sidecar:_task-rest_dir-PA_sbref_bold  <-  15001_24N223T4_ep2d_fid_basic_bold_p2_PA_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  16001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  18001_24N223T4_asl_3d_tra_iso_3.0_highres_20181205124008_e1
INFO:dcm2bids.sidecar:No Pairing  <-  20001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  22001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  23001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  24001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  25001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  27001_24N223T4_DTIep2d_diff_mddw_48dir_p3_AP_20181205124008
INFO:dcm2bids.sidecar:No Pairing  <-  28001_24N223T4_DTIep2d_diff_mddw_4b0_PA_20181205124008
INFO:dcm2bids.dcm2bids:moving acquisitions into BIDS folder
INFO:dcm2bids.dcm2bids:'/nas/data/mopead/tmp/sub-0024/anat/sub-0024_T1w.json' already exists
INFO:dcm2bids.dcm2bids:Overwriting because of 'clobber' option
INFO:dcm2bids.dcm2bids:'/nas/data/mopead/tmp/sub-0024/anat/sub-0024_T1w.nii.gz' already exists
INFO:dcm2bids.dcm2bids:Overwriting because of 'clobber' option
WARNING:dcm2bids.version:Your using dcm2niix version v1.0.20180622
WARNING:dcm2bids.version:A new version exists : v1.0.20190410
WARNING:dcm2bids.version:Check https://github.com/rordenlab/dcm2niix
[osotolongo@detritus tmp]$ tree sub-0024
sub-0024
├── anat
│   ├── sub-0024_T1w.json
│   └── sub-0024_T1w.nii.gz
└── func
    ├── sub-0024_task-rest_bold.json
    ├── sub-0024_task-rest_bold.nii.gz
    ├── sub-0024_task-rest_dir-AP_sbref_bold.json
    ├── sub-0024_task-rest_dir-AP_sbref_bold.nii.gz
    ├── sub-0024_task-rest_dir-PA_sbref_bold.json
    └── sub-0024_task-rest_dir-PA_sbref_bold.nii.gz

2 directories, 8 files

y por ultimo el DTI,

[osotolongo@detritus tmp]$ cat conv_config.json 
{
	"descriptions": [
		{
			"dataType": "anat",
			"modalityLabel": "T1w",
			"criteria": {
				"SeriesDescription": "t1_mprage_sag_p2_iso"
			}
		},
		{
			"dataType": "func",
			"modalityLabel": "bold",
			"customLabels": "task-rest",
			"criteria": {
				"SeriesDescription": "*resting_state*"
			}
		},
		{
			"dataType": "func",
                        "modalityLabel": "bold",
                        "customLabels": "task-rest_dir-PA_sbref",
			"criteria": {
				"SeriesDescription": "ep2d_fid_basic_bold_p2_PA"
			}
		},
                {
                        "dataType": "func",
                        "modalityLabel": "bold",
                        "customLabels": "task-rest_dir-AP_sbref",
                        "criteria": {
                                "SeriesDescription": "ep2d_fid_basic_bold_p2_AP"
                        }
                },
		{
			"dataType": "dwi",
			"modalityLabel": "dwi",
			"criteria": {
				"SeriesDescription": "DTIep2d_diff_mddw_48dir_p3_AP"
			}
		},
		{
                        "dataType": "dwi",
                        "modalityLabel": "dwi",
			"customLabels": "dir-PA_sbref",
                        "criteria": {
                                "SeriesDescription": "DTIep2d_diff_mddw_4b0_PA"
                        }

		}
	]
}
[osotolongo@detritus tmp]$ tree sub-0024/
sub-0024/
├── anat
│   ├── sub-0024_T1w.json
│   └── sub-0024_T1w.nii.gz
├── dwi
│   ├── sub-0024_dir-PA_sbref_dwi.json
│   ├── sub-0024_dir-PA_sbref_dwi.nii.gz
│   ├── sub-0024_dwi.json
│   └── sub-0024_dwi.nii.gz
└── func
    ├── sub-0024_task-rest_bold.json
    ├── sub-0024_task-rest_bold.nii.gz
    ├── sub-0024_task-rest_dir-AP_sbref_bold.json
    ├── sub-0024_task-rest_dir-AP_sbref_bold.nii.gz
    ├── sub-0024_task-rest_dir-PA_sbref_bold.json
    └── sub-0024_task-rest_dir-PA_sbref_bold.nii.gz

3 directories, 12 files

Convirtiendo

Ya tengo la estructura de conversón hecha. Ahora debo intentar convertir los sujetos segun la base de datos del proyecto.

Tengo la estructura de nombres y directorio almacenados en ni_names.csv y la configuracion en tmpbids/conv_config.json.

Como siempre que se corre en un grupo grande empiezan a surgir problemas asi que he tenido que hacer algunos cambios en la configuracion.

[osotolongo@detritus tmpbids]$ cat conv_config.json
{
        "descriptions": [
                {
                        "dataType": "anat",
                        "modalityLabel": "T1w",
                        "criteria": {
                                "SeriesDescription": "t1_mprage_sag_p2_iso"
                        }
                },
                {
                        "dataType": "anat",
                        "modalityLabel": "T2w",
                        "criteria": {
                                "SeriesDescription": "t2_space_dark-fluid_sag_p2_iso"
                        }
                },
                {
                        "dataType": "func",
                        "modalityLabel": "bold",
                        "customLabels": "task-rest",
                        "criteria": {
                                "SeriesDescription": "*resting_state*",
                                "RepetitionTime": 2.13
                        }
                },
                {
                        "dataType": "func",
                        "modalityLabel": "bold",
                        "customLabels": "task-rest_dir-PA_sbref",
                        "criteria": {
                                "SeriesDescription": "ep2d_fid_basic_bold_p2_PA"
                        }
                },
                {
                        "dataType": "func",
                        "modalityLabel": "bold",
                        "customLabels": "task-rest_dir-AP_sbref",
                        "criteria": {
                                "SeriesDescription": "ep2d_fid_basic_bold_p2_AP"
                        }
                },
                {
                        "dataType": "dwi",
                        "modalityLabel": "dwi",
                        "criteria": {
                                "SeriesDescription": "DTIep2d_diff_mddw_48dir_p3_AP"
                        }
                },
                {
                        "dataType": "dwi",
                        "modalityLabel": "dwi",
                        "customLabels": "dir-PA_sbref",
                        "criteria": {
                                "SeriesDescription": "DTIep2d_diff_mddw_4b0_PA"
                        }
 
                }
        ]
}
[osotolongo@detritus tmpbids]$ for x in `cat ../ni_names.csv`; do pname=$(echo ${x} | awk -F"," '{print $1}'); id=$(echo ${x} | awk -F"," '{print $2}'); dcm2bids -d /nas/corachan/MOPEAD/${pname}
/ -p ${id} -c conv_config.json; done
INFO:dcm2bids.dcm2bids:--- dcm2bids start ---
INFO:dcm2bids.dcm2bids:OS:version: Linux-2.6.32-431.17.1.el6.centos.plus.x86_64-x86_64-with-centos-6.10-Final
INFO:dcm2bids.dcm2bids:python:version: 3.4.8 (default, Apr  9 2018, 11:43:18) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]
INFO:dcm2bids.dcm2bids:dcm2bids:version: 2.1.4
INFO:dcm2bids.dcm2bids:dcm2niix:version: v1.0.20191031
INFO:dcm2bids.dcm2bids:participant: sub-0001
INFO:dcm2bids.dcm2bids:session:
INFO:dcm2bids.dcm2bids:config: /nas/data/mopead/tmpbids/conv_config.json
INFO:dcm2bids.dcm2bids:BIDS directory: /nas/data/mopead/tmpbids
INFO:dcm2bids.utils:Running dcm2niix -b y -ba y -z y -f '%3s_%f_%p_%t' -o /nas/data/mopead/tmpbids/tmp_dcm2bids/sub-0001 /nas/corachan/MOPEAD/24A8DVSH/
INFO:dcm2bids.dcm2niix:Check log file for dcm2niix output
INFO:dcm2bids.sidecar:Sidecars pairing:
INFO:dcm2bids.sidecar:No Pairing  <-  013_24A8DVSH_ep2d_bold_p2_resting_state_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  017_24A8DVSH_asl_3d_tra_iso_3.0_highres_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  019_24A8DVSH_asl_3d_tra_iso_3.0_highres_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  021_24A8DVSH_DTIep2d_diff_mddw_48dir_p3_AP_20180714105659
INFO:dcm2bids.sidecar:_T1w  <-  5001_24A8DVSH_t1_mprage_sag_p2_iso_20180714105659
INFO:dcm2bids.sidecar:_T2w  <-  6001_24A8DVSH_t2_space_dark-fluid_sag_p2_iso_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  7001_24A8DVSH_pd+t2_tse_tra_p2_3mm_20180714105659_e1
INFO:dcm2bids.sidecar:No Pairing  <-  7001_24A8DVSH_pd+t2_tse_tra_p2_3mm_20180714105659_e1a
INFO:dcm2bids.sidecar:No Pairing  <-  8001_24A8DVSH_t2_swi_tra_p2_384_2mm_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  9001_24A8DVSH_t2_swi_tra_p2_384_2mm_20180714105659_ph
INFO:dcm2bids.sidecar:No Pairing  <-  10001_24A8DVSH_t2_swi_tra_p2_384_2mm_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  11001_24A8DVSH_t2_swi_tra_p2_384_2mm_20180714105659
INFO:dcm2bids.sidecar:_task-rest_bold  <-  12001_24A8DVSH_ep2d_bold_p2_resting_state_20180714105659
INFO:dcm2bids.sidecar:_task-rest_dir-AP_sbref_bold  <-  14001_24A8DVSH_ep2d_fid_basic_bold_p2_AP_20180714105659
INFO:dcm2bids.sidecar:_task-rest_dir-PA_sbref_bold  <-  15001_24A8DVSH_ep2d_fid_basic_bold_p2_PA_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  16001_24A8DVSH_asl_3d_tra_iso_3.0_highres_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  18001_24A8DVSH_asl_3d_tra_iso_3.0_highres_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  18001_24A8DVSH_asl_3d_tra_iso_3.0_highres_20180714105659a
INFO:dcm2bids.sidecar:_dwi  <-  20001_24A8DVSH_DTIep2d_diff_mddw_48dir_p3_AP_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  22001_24A8DVSH_DTIep2d_diff_mddw_48dir_p3_AP_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  23001_24A8DVSH_DTIep2d_diff_mddw_48dir_p3_AP_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  24001_24A8DVSH_DTIep2d_diff_mddw_48dir_p3_AP_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  25001_24A8DVSH_DTIep2d_diff_mddw_48dir_p3_AP_20180714105659
INFO:dcm2bids.sidecar:No Pairing  <-  27001_24A8DVSH_DTIep2d_diff_mddw_48dir_p3_AP_20180714105659
INFO:dcm2bids.sidecar:_dir-PA_sbref_dwi  <-  28001_24A8DVSH_DTIep2d_diff_mddw_4b0_PA_20180714105659
INFO:dcm2bids.dcm2bids:moving acquisitions into BIDS folder
[osotolongo@detritus tmpbids]$ tree sub-0001/
sub-0001/
├── anat
│   ├── sub-0001_T1w.json
│   ├── sub-0001_T1w.nii.gz
│   ├── sub-0001_T2w.json
│   └── sub-0001_T2w.nii.gz
├── dwi
│   ├── sub-0001_dir-PA_sbref_dwi.json
│   ├── sub-0001_dir-PA_sbref_dwi.nii.gz
│   ├── sub-0001_dwi.bval
│   ├── sub-0001_dwi.bvec
│   ├── sub-0001_dwi.json
│   └── sub-0001_dwi.nii.gz
└── func
    ├── sub-0001_task-rest_bold.json
    ├── sub-0001_task-rest_bold.nii.gz
    ├── sub-0001_task-rest_dir-AP_sbref_bold.json
    ├── sub-0001_task-rest_dir-AP_sbref_bold.nii.gz
    ├── sub-0001_task-rest_dir-PA_sbref_bold.json
    └── sub-0001_task-rest_dir-PA_sbref_bold.nii.gz
 
3 directories, 16 files
neuroimagen/dcm2bids.txt · Last modified: 2020/08/04 10:58 (external edit)