User Tools

Site Tools


neuroimagen:fbb

This is an old revision of the document!


Problemas con el procesamiento de FBB y como no morir en el intento

de DICOM a NiFTI

DELETEME Necesitamos convertir los DICOM de FBB a formato NiFTI-1 para trabajar con FSL. El servidor DICOM corta el numero de slices por directorio a 500 por lo que inicialmente hubo muchisimos problemas de conversion y procesamiento.

Luego hay que buscar por todas las subcarpetas del DICOM las imagenes 4x5min que estan desordenadas. Para convertir uno de los sujetos ha de hacerse algo asi,

$ for x in `find /nas/raw_images/facehbi/fbb/FACEHBI-F001B/DICOM/ -type f`; do if [[ `dckey -k "SeriesDescription" $x 2>&1 | grep  "4x5min"` ]]; then cp $x /nas/facehbi/tmp_2nifti/; fi; done; y=$(ls /nas/facehbi/tmp_2nifti/ | head -n 1); dcm2nii -o /nas/facehbi/tmp/ /nas/facehbi/tmp_2nifti/$y;

que da una salida muy ruidosa, pero funciona. Para hacerlos todos de una tacada habria que iterar esto por todos los sujetos.

for s in `ls -d /nas/clinic/* | grep FACEHBI | grep "B$"`; do sbj=$(echo $s |sed 's/.*-F\(.*\)B$/\1/');  for x in `find ${s}/DICOM/ -type f`; do if [[ `dckey -k "SeriesDescription" $x 2>&1 | grep  "4x5min"` ]]; then cp $x /nas/facehbi/tmp_2nifti/; fi; done; y=$(ls /nas/facehbi/tmp_2nifti/ | head -n 1); dcm2nii -o /nas/facehbi/tmp/ /nas/facehbi/tmp_2nifti/$y; conv=$(ls /nas/facehbi/tmp/ | head -n 1); fslsplit /nas/facehbi/tmp/${conv} /nas/facehbi/fbb_first/smc0${sbj}s -t; rm -rf /nas/facehbi/tmp/*; rm -rf /nas/facehbi/tmp_2nifti/*; done

si queremos aprovechar un archivo yet.txt (ver aqui)

$ for sbj in `awk -F";" '{print $1}' yet.txt | sed 's/0//;'`; do s="/nas/clinic/FACEHBI-F${sbj}B";  for x in `find ${s}/DICOM/ -type f`; do if [[ `dckey -k "SeriesDescription" $x 2>&1 | grep  "4x5min"` ]]; then cp $x /nas/facehbi/tmp_2nifti/; fi; done; y=$(ls /nas/facehbi/tmp_2nifti/ | head -n 1); dcm2nii -o /nas/facehbi/tmp/ /nas/facehbi/tmp_2nifti/$y; conv=$(ls /nas/facehbi/tmp/ | head -n 1); fslsplit /nas/facehbi/tmp/${conv} /nas/facehbi/fbb/smc0${sbj}s -t; rm -rf /nas/facehbi/tmp/*; rm -rf /nas/facehbi/tmp_2nifti/*; done

DELETEME

Correccion de movimiento

Ahora tenemos 4 archivos representando la integracion de 5 min y hay que corregistrarlos al espacio de usuario. Lo primero es traer el archivo de freesurfer y luego corregistrar cada uo de los fbb al user space. despues se ha de unirlos temporalmente y hacer un mcflirt.

lo primero seria traerse la mri del directorio de freesurfer

get_fs_subj

y luego corregistrar cada imagen al espacio del sujeto. Hay 4 variantes para esto.

1.- Intentando registrar cada imagen independientemente.

fbb_reg

2.- Usando la informacion de un registro para el resto (-useg)

fbb_regc

3.- Usando la informacion solo del cerebro extraido para hacer el corregistro (-useb)

fbb_regb

4.- el mas complicado, usando una mascara. Este metodo se probo con el corregistro de PiBs y usa un umbral de intensidad (-usem)

fbb_regm

Esto lo he intentado agrupar en el script fbb_correct.pl,

fbb_correct.pl (chunk)

Resumiendo

si todo va bien basta con hacer:

$ fbb_correct.pl -e facehbi 
$ parallel_fbb_rois_metrics.pl facehbi

Postprocessing (carrot)

$ cd /home/osotolongo/Documents/ACE/facehbi
$ R CMD BATCH selected_mri.r
$ sed 's/"//g' facehbi_mri_selected.csv | awk -F"," '{if($1!="Subject") printf("%04d;%s;%s;%s;%s;%s;%s\n",$1,$2,$3,$4,$5,$6,$7); else printf("%s;%s;%s;%s;%s;%s;%s\n",$1,$2,$3,$4,$5,$6,$7)}' > facehbi_mri_selected_reformatted.csv
$ join -t";" -j 1 facehbi_fbb_fs_suvr_predef.csv facehbi_mri_selected_reformatted.csv > facehbi_fbb_mri.csv
$ join -t";" -j 1 facehbi_fbb_mri.csv facehbi_dti.csv > facehbi_fbb_mri_dti.csv
$ awk 'NR<2{print $0;next}{print $0| "sort -k1"}' demographics.csv | sed 's/, /;/g' > facehbi_demographics.csv
$ join -t";" -j 1 facehbi_demographics.csv facehbi_fbb_mri_dti.csv > facehbi_data.csv
$ sed 's/;/ /g' facehbi_data.csv > facehbi_data.dat

Note this: extract_data | awk 'NR<3{print $0;next}{print $0| “sort -r”}' ;-)

$ head -n 1 facehbi_data.csv | sed 's/;/\n/g' | cat -n
     1	Subject
     2	Gender
     3	Education
     4	Age
     5	FBB
     6	HV
     7	aHV
     8	CMT
     9	aCMT
    10	WMH
    11	nWMH
    12	Unclassified_FA_Mean
    13	Unclassified_FA_STD
    14	Unclassified_MD_Mean
    15	Unclassified_MD_STD
    16	Middle cerebellar peduncle_FA_Mean
    17	Middle cerebellar peduncle_FA_STD
    18	Middle cerebellar peduncle_MD_Mean
    19	Middle cerebellar peduncle_MD_STD
    20	Medial lemniscus L_FA_Mean
    21	Medial lemniscus L_FA_STD
    22	Medial lemniscus L_MD_Mean
    23	Medial lemniscus L_MD_STD
    24	Inferior cerebellar peduncle R  _FA_Mean
    25	Inferior cerebellar peduncle R  _FA_STD
    26	Inferior cerebellar peduncle R  _MD_Mean
    27	Inferior cerebellar peduncle R  _MD_STD
    28	Inferior cerebellar peduncle L_FA_Mean
    29	Inferior cerebellar peduncle L_FA_STD
    30	Inferior cerebellar peduncle L_MD_Mean
    31	Inferior cerebellar peduncle L_MD_STD
    32	Superior cerebellar peduncle R_FA_Mean
    33	Superior cerebellar peduncle R_FA_STD
    34	Superior cerebellar peduncle R_MD_Mean
    35	Superior cerebellar peduncle R_MD_STD
    36	Superior cerebellar peduncle L_FA_Mean
    37	Superior cerebellar peduncle L_FA_STD
    38	Superior cerebellar peduncle L_MD_Mean
    39	Superior cerebellar peduncle L_MD_STD
    40	Cerebral peduncle R_FA_Mean
    41	Cerebral peduncle R_FA_STD
    42	Cerebral peduncle R_MD_Mean
    43	Cerebral peduncle R_MD_STD
    44	Cerebral peduncle L_FA_Mean
    45	Cerebral peduncle L_FA_STD
    46	Cerebral peduncle L_MD_Mean
    47	Cerebral peduncle L_MD_STD
    48	Anterior limb of internal capsule R_FA_Mean
    49	Anterior limb of internal capsule R_FA_STD
    50	Anterior limb of internal capsule R_MD_Mean
    51	Anterior limb of internal capsule R_MD_STD
    52	Anterior limb of internal capsule L_FA_Mean
    53	Anterior limb of internal capsule L_FA_STD
    54	Anterior limb of internal capsule L_MD_Mean
    55	Anterior limb of internal capsule L_MD_STD
    56	Posterior limb of internal capsule R_FA_Mean
    57	Posterior limb of internal capsule R_FA_STD
    58	Posterior limb of internal capsule R_MD_Mean
    59	Posterior limb of internal capsule R_MD_STD
    60	Pontine crossing tract (a part of MCP)_FA_Mean
    61	Pontine crossing tract (a part of MCP)_FA_STD
    62	Pontine crossing tract (a part of MCP)_MD_Mean
    63	Pontine crossing tract (a part of MCP)_MD_STD
    64	Posterior limb of internal capsule L_FA_Mean
    65	Posterior limb of internal capsule L_FA_STD
    66	Posterior limb of internal capsule L_MD_Mean
    67	Posterior limb of internal capsule L_MD_STD
    68	Retrolenticular part of internal capsule R_FA_Mean
    69	Retrolenticular part of internal capsule R_FA_STD
    70	Retrolenticular part of internal capsule R_MD_Mean
    71	Retrolenticular part of internal capsule R_MD_STD
    72	Retrolenticular part of internal capsule L_FA_Mean
    73	Retrolenticular part of internal capsule L_FA_STD
    74	Retrolenticular part of internal capsule L_MD_Mean
    75	Retrolenticular part of internal capsule L_MD_STD
    76	Anterior corona radiata R_FA_Mean
    77	Anterior corona radiata R_FA_STD
    78	Anterior corona radiata R_MD_Mean
    79	Anterior corona radiata R_MD_STD
    80	Anterior corona radiata L_FA_Mean
    81	Anterior corona radiata L_FA_STD
    82	Anterior corona radiata L_MD_Mean
    83	Anterior corona radiata L_MD_STD
    84	Superior corona radiata R_FA_Mean
    85	Superior corona radiata R_FA_STD
    86	Superior corona radiata R_MD_Mean
    87	Superior corona radiata R_MD_STD
    88	Superior corona radiata L_FA_Mean
    89	Superior corona radiata L_FA_STD
    90	Superior corona radiata L_MD_Mean
    91	Superior corona radiata L_MD_STD
    92	Posterior corona radiata R_FA_Mean
    93	Posterior corona radiata R_FA_STD
    94	Posterior corona radiata R_MD_Mean
    95	Posterior corona radiata R_MD_STD
    96	Posterior corona radiata L_FA_Mean
    97	Posterior corona radiata L_FA_STD
    98	Posterior corona radiata L_MD_Mean
    99	Posterior corona radiata L_MD_STD
   100	Posterior thalamic radiation (include optic radiation) R_FA_Mean
   101	Posterior thalamic radiation (include optic radiation) R_FA_STD
   102	Posterior thalamic radiation (include optic radiation) R_MD_Mean
   103	Posterior thalamic radiation (include optic radiation) R_MD_STD
   104	Genu of corpus callosum_FA_Mean
   105	Genu of corpus callosum_FA_STD
   106	Genu of corpus callosum_MD_Mean
   107	Genu of corpus callosum_MD_STD
   108	Posterior thalamic radiation (include optic radiation) L_FA_Mean
   109	Posterior thalamic radiation (include optic radiation) L_FA_STD
   110	Posterior thalamic radiation (include optic radiation) L_MD_Mean
   111	Posterior thalamic radiation (include optic radiation) L_MD_STD
   112	Sagittal stratum (include inferior longitidinal fasciculus and inferior fronto-occipital fasciculus) R_FA_Mean
   113	Sagittal stratum (include inferior longitidinal fasciculus and inferior fronto-occipital fasciculus) R_FA_STD
   114	Sagittal stratum (include inferior longitidinal fasciculus and inferior fronto-occipital fasciculus) R_MD_Mean
   115	Sagittal stratum (include inferior longitidinal fasciculus and inferior fronto-occipital fasciculus) R_MD_STD
   116	Sagittal stratum (include inferior longitidinal fasciculus and inferior fronto-occipital fasciculus) L_FA_Mean
   117	Sagittal stratum (include inferior longitidinal fasciculus and inferior fronto-occipital fasciculus) L_FA_STD
   118	Sagittal stratum (include inferior longitidinal fasciculus and inferior fronto-occipital fasciculus) L_MD_Mean
   119	Sagittal stratum (include inferior longitidinal fasciculus and inferior fronto-occipital fasciculus) L_MD_STD
   120	External capsule R_FA_Mean
   121	External capsule R_FA_STD
   122	External capsule R_MD_Mean
   123	External capsule R_MD_STD
   124	External capsule L_FA_Mean
   125	External capsule L_FA_STD
   126	External capsule L_MD_Mean
   127	External capsule L_MD_STD
   128	Cingulum (cingulate gyrus) R_FA_Mean
   129	Cingulum (cingulate gyrus) R_FA_STD
   130	Cingulum (cingulate gyrus) R_MD_Mean
   131	Cingulum (cingulate gyrus) R_MD_STD
   132	Cingulum (cingulate gyrus) L_FA_Mean
   133	Cingulum (cingulate gyrus) L_FA_STD
   134	Cingulum (cingulate gyrus) L_MD_Mean
   135	Cingulum (cingulate gyrus) L_MD_STD
   136	Cingulum (hippocampus) R_FA_Mean
   137	Cingulum (hippocampus) R_FA_STD
   138	Cingulum (hippocampus) R_MD_Mean
   139	Cingulum (hippocampus) R_MD_STD
   140	Cingulum (hippocampus) L_FA_Mean
   141	Cingulum (hippocampus) L_FA_STD
   142	Cingulum (hippocampus) L_MD_Mean
   143	Cingulum (hippocampus) L_MD_STD
   144	Fornix (cres) / Stria terminalis (can not be resolved with current resolution) R_FA_Mean
   145	Fornix (cres) / Stria terminalis (can not be resolved with current resolution) R_FA_STD
   146	Fornix (cres) / Stria terminalis (can not be resolved with current resolution) R_MD_Mean
   147	Fornix (cres) / Stria terminalis (can not be resolved with current resolution) R_MD_STD
   148	Body of corpus callosum_FA_Mean
   149	Body of corpus callosum_FA_STD
   150	Body of corpus callosum_MD_Mean
   151	Body of corpus callosum_MD_STD
   152	Fornix (cres) / Stria terminalis (can not be resolved with current resolution) L_FA_Mean
   153	Fornix (cres) / Stria terminalis (can not be resolved with current resolution) L_FA_STD
   154	Fornix (cres) / Stria terminalis (can not be resolved with current resolution) L_MD_Mean
   155	Fornix (cres) / Stria terminalis (can not be resolved with current resolution) L_MD_STD
   156	Superior longitudinal fasciculus R_FA_Mean
   157	Superior longitudinal fasciculus R_FA_STD
   158	Superior longitudinal fasciculus R_MD_Mean
   159	Superior longitudinal fasciculus R_MD_STD
   160	Superior longitudinal fasciculus L_FA_Mean
   161	Superior longitudinal fasciculus L_FA_STD
   162	Superior longitudinal fasciculus L_MD_Mean
   163	Superior longitudinal fasciculus L_MD_STD
   164	Superior fronto-occipital fasciculus (could be a part of anterior internal capsule) R_FA_Mean
   165	Superior fronto-occipital fasciculus (could be a part of anterior internal capsule) R_FA_STD
   166	Superior fronto-occipital fasciculus (could be a part of anterior internal capsule) R_MD_Mean
   167	Superior fronto-occipital fasciculus (could be a part of anterior internal capsule) R_MD_STD
   168	Superior fronto-occipital fasciculus (could be a part of anterior internal capsule) L_FA_Mean
   169	Superior fronto-occipital fasciculus (could be a part of anterior internal capsule) L_FA_STD
   170	Superior fronto-occipital fasciculus (could be a part of anterior internal capsule) L_MD_Mean
   171	Superior fronto-occipital fasciculus (could be a part of anterior internal capsule) L_MD_STD
   172	Uncinate fasciculus R_FA_Mean
   173	Uncinate fasciculus R_FA_STD
   174	Uncinate fasciculus R_MD_Mean
   175	Uncinate fasciculus R_MD_STD
   176	Uncinate fasciculus L_FA_Mean
   177	Uncinate fasciculus L_FA_STD
   178	Uncinate fasciculus L_MD_Mean
   179	Uncinate fasciculus L_MD_STD
   180	Tapetum R_FA_Mean
   181	Tapetum R_FA_STD
   182	Tapetum R_MD_Mean
   183	Tapetum R_MD_STD
   184	Tapetum L_FA_Mean
   185	Tapetum L_FA_STD
   186	Tapetum L_MD_Mean
   187	Tapetum L_MD_STD
   188	Splenium of corpus callosum_FA_Mean
   189	Splenium of corpus callosum_FA_STD
   190	Splenium of corpus callosum_MD_Mean
   191	Splenium of corpus callosum_MD_STD
   192	Fornix (column and body of fornix)_FA_Mean
   193	Fornix (column and body of fornix)_FA_STD
   194	Fornix (column and body of fornix)_MD_Mean
   195	Fornix (column and body of fornix)_MD_STD
   196	Corticospinal tract R_FA_Mean
   197	Corticospinal tract R_FA_STD
   198	Corticospinal tract R_MD_Mean
   199	Corticospinal tract R_MD_STD
   200	Corticospinal tract L_FA_Mean
   201	Corticospinal tract L_FA_STD
   202	Corticospinal tract L_MD_Mean
   203	Corticospinal tract L_MD_STD
   204	Medial lemniscus R_FA_Mean
   205	Medial lemniscus R_FA_STD
   206	Medial lemniscus R_MD_Mean
   207	Medial lemniscus R_MD_STD
   208	Anterior thalamic radiation L_FA_Mean
   209	Anterior thalamic radiation L_FA_STD
   210	Anterior thalamic radiation L_MD_Mean
   211	Anterior thalamic radiation L_MD_STD
   212	Forceps minor_FA_Mean
   213	Forceps minor_FA_STD
   214	Forceps minor_MD_Mean
   215	Forceps minor_MD_STD
   216	Inferior fronto-occipital fasciculus L_FA_Mean
   217	Inferior fronto-occipital fasciculus L_FA_STD
   218	Inferior fronto-occipital fasciculus L_MD_Mean
   219	Inferior fronto-occipital fasciculus L_MD_STD
   220	Inferior fronto-occipital fasciculus R_FA_Mean
   221	Inferior fronto-occipital fasciculus R_FA_STD
   222	Inferior fronto-occipital fasciculus R_MD_Mean
   223	Inferior fronto-occipital fasciculus R_MD_STD
   224	Inferior longitudinal fasciculus L_FA_Mean
   225	Inferior longitudinal fasciculus L_FA_STD
   226	Inferior longitudinal fasciculus L_MD_Mean
   227	Inferior longitudinal fasciculus L_MD_STD
   228	Inferior longitudinal fasciculus R_FA_Mean
   229	Inferior longitudinal fasciculus R_FA_STD
   230	Inferior longitudinal fasciculus R_MD_Mean
   231	Inferior longitudinal fasciculus R_MD_STD
   232	Superior longitudinal fasciculus L_FA_Mean
   233	Superior longitudinal fasciculus L_FA_STD
   234	Superior longitudinal fasciculus L_MD_Mean
   235	Superior longitudinal fasciculus L_MD_STD
   236	Superior longitudinal fasciculus R_FA_Mean
   237	Superior longitudinal fasciculus R_FA_STD
   238	Superior longitudinal fasciculus R_MD_Mean
   239	Superior longitudinal fasciculus R_MD_STD
   240	Uncinate fasciculus L_FA_Mean
   241	Uncinate fasciculus L_FA_STD
   242	Uncinate fasciculus L_MD_Mean
   243	Uncinate fasciculus L_MD_STD
   244	Uncinate fasciculus R_FA_Mean
   245	Uncinate fasciculus R_FA_STD
   246	Uncinate fasciculus R_MD_Mean
   247	Uncinate fasciculus R_MD_STD
   248	Superior longitudinal fasciculus (temporal part) L_FA_Mean
   249	Superior longitudinal fasciculus (temporal part) L_FA_STD
   250	Superior longitudinal fasciculus (temporal part) L_MD_Mean
   251	Superior longitudinal fasciculus (temporal part) L_MD_STD
   252	Anterior thalamic radiation R_FA_Mean
   253	Anterior thalamic radiation R_FA_STD
   254	Anterior thalamic radiation R_MD_Mean
   255	Anterior thalamic radiation R_MD_STD
   256	Superior longitudinal fasciculus (temporal part) R_FA_Mean
   257	Superior longitudinal fasciculus (temporal part) R_FA_STD
   258	Superior longitudinal fasciculus (temporal part) R_MD_Mean
   259	Superior longitudinal fasciculus (temporal part) R_MD_STD
   260	Corticospinal tract L_FA_Mean
   261	Corticospinal tract L_FA_STD
   262	Corticospinal tract L_MD_Mean
   263	Corticospinal tract L_MD_STD
   264	Corticospinal tract R_FA_Mean
   265	Corticospinal tract R_FA_STD
   266	Corticospinal tract R_MD_Mean
   267	Corticospinal tract R_MD_STD
   268	Cingulum (cingulate gyrus) L_FA_Mean
   269	Cingulum (cingulate gyrus) L_FA_STD
   270	Cingulum (cingulate gyrus) L_MD_Mean
   271	Cingulum (cingulate gyrus) L_MD_STD
   272	Cingulum (cingulate gyrus) R_FA_Mean
   273	Cingulum (cingulate gyrus) R_FA_STD
   274	Cingulum (cingulate gyrus) R_MD_Mean
   275	Cingulum (cingulate gyrus) R_MD_STD
   276	Cingulum (hippocampus) L_FA_Mean
   277	Cingulum (hippocampus) L_FA_STD
   278	Cingulum (hippocampus) L_MD_Mean
   279	Cingulum (hippocampus) L_MD_STD
   280	Cingulum (hippocampus) R_FA_Mean
   281	Cingulum (hippocampus) R_FA_STD
   282	Cingulum (hippocampus) R_MD_Mean
   283	Cingulum (hippocampus) R_MD_STD
   284	Forceps major_FA_Mean
   285	Forceps major_FA_STD
   286	Forceps major_MD_Mean
   287	Forceps major_MD_STD
neuroimagen/fbb.1559939187.txt.gz · Last modified: 2020/08/04 10:45 (external edit)