User Tools

Site Tools


neuroimagen:fbb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
neuroimagen:fbb [2018/09/12 10:48]
osotolongo [Correccion de movimiento]
neuroimagen:fbb [2021/03/10 10:24] (current)
osotolongo [Correccion de movimiento]
Line 1: Line 1:
 ====== Problemas con el procesamiento de FBB y como no morir en el intento ====== ====== Problemas con el procesamiento de FBB y como no morir en el intento ======
  
-==== de DICOM a NiFTI ====+==== bulk conversion ==== 
 + 
 +Voy a escribir un procedimiento nuevo para la conversion de DCM a NIfTI aprovechando que tengo nuevos procedimientos y software para todo. 
 + 
 +Primero, 
 +<code> 
 +[osotolongo@detritus facehbi]$ ls /nas/clinic/facehbi 
 +FACEHBI-F001B  FACEHBI-F018B  FACEHBI-F036B  FACEHBI-F055B  FACEHBI-F072B  FACEHBI-F088B  FACEHBI-F105B  FACEHBI-F122B FACEHBI-F139B  FACEHBI-F155B  FACEHBI-F171B  FACEHBI-F191B  FACEHBI-F208B 
 +FACEHBI-F002B  FACEHBI-F019B  FACEHBI-F037B  FACEHBI-F056B  FACEHBI-F073B  FACEHBI-F089B  FACEHBI-F106B  FACEHBI-F123B FACEHBI-F140B  FACEHBI-F156B  FACEHBI-F173B  FACEHBI-F192B  FACEHBI-F209B 
 +FACEHBI-F003B  FACEHBI-F020B  FACEHBI-F038B  FACEHBI-F057B  FACEHBI-F074B  FACEHBI-F090B  FACEHBI-F107B  FACEHBI-F124B FACEHBI-F141B  FACEHBI-F157B  FACEHBI-F174B  FACEHBI-F193B  FACEHBI-F210B 
 +FACEHBI-F004B  FACEHBI-F021B  FACEHBI-F039B  FACEHBI-F058B  FACEHBI-F075B  FACEHBI-F091B  FACEHBI-F108B  FACEHBI-F125B FACEHBI-F142B  FACEHBI-F158B  FACEHBI-F175B  FACEHBI-F194B  FACEHBI-F211B 
 +FACEHBI-F005B  FACEHBI-F022B  FACEHBI-F040B  FACEHBI-F059B  FACEHBI-F076B  FACEHBI-F092B  FACEHBI-F109B  FACEHBI-F126B FACEHBI-F143B  FACEHBI-F159B  FACEHBI-F177B  FACEHBI-F195B  FACEHBI-F212B 
 +FACEHBI-F006B  FACEHBI-F023B  FACEHBI-F041B  FACEHBI-F060B  FACEHBI-F077B  FACEHBI-F093B  FACEHBI-F110B  FACEHBI-F127B FACEHBI-F144B  FACEHBI-F160B  FACEHBI-F178B  FACEHBI-F196B  FACEHBI-F213B 
 +FACEHBI-F007B  FACEHBI-F024B  FACEHBI-F042B  FACEHBI-F061B  FACEHBI-F078B  FACEHBI-F094B  FACEHBI-F111B  FACEHBI-F128B FACEHBI-F145B  FACEHBI-F161B  FACEHBI-F179B  FACEHBI-F197B  FACEHBI-F214B 
 +FACEHBI-F008B  FACEHBI-F025B  FACEHBI-F043B  FACEHBI-F062B  FACEHBI-F079B  FACEHBI-F095B  FACEHBI-F112B  FACEHBI-F129B FACEHBI-F146B  FACEHBI-F162B  FACEHBI-F181B  FACEHBI-F198B  FACEHBI-F215B 
 +FACEHBI-F009B  FACEHBI-F026B  FACEHBI-F044B  FACEHBI-F063B  FACEHBI-F080B  FACEHBI-F096B  FACEHBI-F113B  FACEHBI-F130B FACEHBI-F147B  FACEHBI-F163B  FACEHBI-F182B  FACEHBI-F199B 
 +FACEHBI-F010B  FACEHBI-F027B  FACEHBI-F047B  FACEHBI-F064B  FACEHBI-F081B  FACEHBI-F097B  FACEHBI-F115B  FACEHBI-F131B FACEHBI-F148B  FACEHBI-F164B  FACEHBI-F183B  FACEHBI-F200B 
 +FACEHBI-F011B  FACEHBI-F028B  FACEHBI-F048B  FACEHBI-F065B  FACEHBI-F082B  FACEHBI-F098B  FACEHBI-F116B  FACEHBI-F132B FACEHBI-F149B  FACEHBI-F165B  FACEHBI-F184B  FACEHBI-F201B 
 +FACEHBI-F012B  FACEHBI-F029B  FACEHBI-F049B  FACEHBI-F066B  FACEHBI-F083B  FACEHBI-F099B  FACEHBI-F117B  FACEHBI-F133B FACEHBI-F150B  FACEHBI-F166B  FACEHBI-F185B  FACEHBI-F202B 
 +FACEHBI-F013B  FACEHBI-F030B  FACEHBI-F050B  FACEHBI-F068B  FACEHBI-F084B  FACEHBI-F101B  FACEHBI-F118B  FACEHBI-F134B FACEHBI-F151B  FACEHBI-F167B  FACEHBI-F186B  FACEHBI-F203B 
 +FACEHBI-F014B  FACEHBI-F031B  FACEHBI-F052B  FACEHBI-F069B  FACEHBI-F085B  FACEHBI-F102B  FACEHBI-F119B  FACEHBI-F135B FACEHBI-F152B  FACEHBI-F168B  FACEHBI-F188B  FACEHBI-F204B 
 +FACEHBI-F015B  FACEHBI-F033B  FACEHBI-F053B  FACEHBI-F070B  FACEHBI-F086B  FACEHBI-F103B  FACEHBI-F120B  FACEHBI-F136B FACEHBI-F153B  FACEHBI-F169B  FACEHBI-F189B  FACEHBI-F205B 
 +FACEHBI-F017B  FACEHBI-F035B  FACEHBI-F054B  FACEHBI-F071B  FACEHBI-F087B  FACEHBI-F104B  FACEHBI-F121B  FACEHBI-F137B FACEHBI-F154B  FACEHBI-F170B  FACEHBI-F190B  FACEHBI-F207B 
 +[osotolongo@detritus facehbi]$ dcm2niix -o tmp -z y /nas/clinic/facehbi/FACEHBI-F001B/DICOM/ 
 +Chris Rorden's dcm2niiX version v1.0.20180622 (JP2:OpenJPEG) (JP-LS:CharLS) GCC5.5.0 (64-bit Linux) 
 +Found 620 DICOM file(s) 
 +Convert 109 DICOM as tmp/DICOM_FACEHBI_Florbetaben_20min_20141211120511_5 (400x400x109x1) 
 +compress: "/usr/local/mricron/pigz_mricron" -n -f -6 "tmp/DICOM_FACEHBI_Florbetaben_20min_20141211120511_5.nii" 
 +Convert 75 DICOM as tmp/DICOM_FACEHBI_20141211120511_3 (512x512x75x1) 
 +compress: "/usr/local/mricron/pigz_mricron" -n -f -6 "tmp/DICOM_FACEHBI_20141211120511_3.nii" 
 +Convert 436 DICOM as tmp/DICOM_FACEHBI_Florbetaben_4x5min_20141211120511_4 (400x400x109x4) 
 +compress: "/usr/local/mricron/pigz_mricron" -n -f -6 "tmp/DICOM_FACEHBI_Florbetaben_4x5min_20141211120511_4.nii" 
 +Conversion required 105.374635 seconds (6.340000 for core code). 
 +[osotolongo@detritus facehbi]$ ls tmp 
 +DICOM_FACEHBI_20141211120511_3.json    DICOM_FACEHBI_Florbetaben_20min_20141211120511_5.json DICOM_FACEHBI_Florbetaben_4x5min_20141211120511_4.json 
 +DICOM_FACEHBI_20141211120511_3.nii.gz  DICOM_FACEHBI_Florbetaben_20min_20141211120511_5.nii.gz DICOM_FACEHBI_Florbetaben_4x5min_20141211120511_4.nii.gz 
 +[osotolongo@detritus facehbi]$ for x in tmp/*.nii.gz; do fslinfo ${x}; done 
 +data_type      INT16 
 +dim1           512 
 +dim2           512 
 +dim3           75 
 +dim4           1 
 +datatype       4 
 +pixdim1        0.585938 
 +pixdim2        0.585938 
 +pixdim3        3.000000 
 +pixdim4        0.000000 
 +cal_max        0.0000 
 +cal_min        0.0000 
 +file_type      NIFTI-1+ 
 +filename       tmp/DICOM_FACEHBI_Florbetaben_20min_20141211120511_5.nii.gz 
 +data_type      FLOAT32 
 +dim1           400 
 +dim2           400 
 +dim3           109 
 +dim4           1 
 +datatype       16 
 +pixdim1        1.018210 
 +pixdim2        1.018210 
 +pixdim3        2.027008 
 +pixdim4        0.000000 
 +cal_max        0.0000 
 +cal_min        0.0000 
 +file_type      NIFTI-1+ 
 +filename       tmp/DICOM_FACEHBI_Florbetaben_4x5min_20141211120511_4.nii.gz 
 +data_type      FLOAT32 
 +dim1           400 
 +dim2           400 
 +dim3           109 
 +dim4           4 
 +datatype       16 
 +pixdim1        1.018210 
 +pixdim2        1.018210 
 +pixdim3        2.027008 
 +pixdim4        1.000000 
 +cal_max        0.0000 
 +cal_min        0.0000 
 +file_type      NIFTI-1+ 
 +</code> 
 + 
 +y me hago un scriptcillo para convertir los DCM, escoger el adecuado usando //fslinfo// y hacer un //fslsplit// en el directorio final, 
 + 
 +<code perl update_fbb.pl> 
 +#!/usr/bin/perl 
 + 
 +use strict; 
 +use warnings; 
 +use NEURO qw(load_study); 
 +use Data::Dump qw(dump); 
 +use File::Find::Rule; 
 + 
 +my $study = "facehbi"; 
 +my %std = load_study($study); 
 +my $src_dir = "/nas/clinic/facehbi"; 
 +my $output_dir = $std{'PET-FBB'}; 
 +my @other_exts = ("nii.gz","json"); 
 + 
 +opendir(my $dh, $src_dir) || die "Can't opendir $src_dir: $!"; 
 +my @adqs = grep {/^[A-Za-z]/} readdir($dh); 
 +closedir $dh; 
 + 
 +foreach my $adq (sort @adqs) { 
 + (my $subject = $adq) =~ s/.*-F(.*)B$/0$1/; 
 + my $order = 'dcm2niix -z y -o '.$std{'DATA'}.'/tmp/ '.$src_dir.'/'.$adq.'/DICOM'; 
 + print "$order\n"; 
 + system($order); 
 + my @conv_files = find(file => 'name' => "*.nii.gz", in => $std{'DATA'}.'/tmp/'); 
 + foreach my $nii_file (@conv_files){ 
 + $order = 'fslinfo '.$nii_file; 
 + my %xinfo; 
 + foreach (qx/$order/){ 
 + my ( $key, $value ) = /(\S+)\s+(\S+)\s*.*/; 
 + $xinfo{$key} =$value; 
 +
 + if($xinfo{"dim4"}>1){ 
 + print "Choosing and moving files\n"; 
 + $order = 'fslsplit '.$nii_file.' '.$output_dir.'/smc'.$subject.'s -t'; 
 + print "$order\n"; 
 + system($order); 
 +
 +
 + print "Cleaning house\n"; 
 + $order = "rm $std{'DATA'}/tmp/*"; 
 + system($order); 
 +
 +</code> 
 + 
 +Lo lanzo desde el directorio del proyecto, 
 +<code> 
 +[osotolongo@detritus facehbi]$ ./update_fbb.pl 
 +</code> 
 +y ya esta, los fbb me quedan ordenados correctamente. 
 +==== 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. 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.
  
Line 607: Line 741:
    287 Forceps major_MD_STD    287 Forceps major_MD_STD
 </code> </code>
 +
 +===== Correccion de movimiento =====
 +
 +{{ :neuroimagen:new_movement_correction_comparison.png?600 |}}
 +
 +
neuroimagen/fbb.1536749319.txt.gz · Last modified: 2020/08/04 10:46 (external edit)