User Tools

Site Tools


neuroimagen:facehbi

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
Next revision Both sides next revision
neuroimagen:facehbi [2019/06/05 08:31]
osotolongo [Reprocesamiento]
neuroimagen:facehbi [2019/06/07 09:06]
osotolongo [Integrar fechas con datos]
Line 439: Line 439:
  
 </code> </code>
 +
 +
 +
 +==== Integrar fechas con datos ====
 +<code perl join_conv.pl>
 +#!/usr/bin/perl
 +
 +use strict;
 +use warnings;
 +use Data::Dump qw(dump);
 +
 +my %fdates = ( FBBv0 => "conv_dicom_fbb_v0_date.csv",
 +        FBBv2 => "conv_dicom_fbb_v2_date.csv",
 +        MRIv0 => "conv_dicom_mri_v0_date.csv",
 +        MRIv2 => "conv_dicom_mri_v2_date.csv",
 +);
 +
 +my %ofiles = ( FBBv0 => "facehbi_fbb_v0_date_a.csv",
 +        FBBv2 => "facehbi_fbb_v2_date_a.csv",
 +        MRIv0 => "facehbi_mri_v0_date_a.csv",
 +        MRIv2 => "facehbi_mri_v2_date_a.csv",
 +);
 +
 +my $info_file = "internos.csv";
 +my %internos;
 +
 +open IIF, "<$info_file";
 +while(<IIF>){
 +        if(/(F.*);(.*)/){
 +                (my $fnumber, my $inumber) = /(F.*);(.*)/;
 +                $internos{$fnumber} = $inumber;
 +        }
 +}
 +close IIF;
 +
 +my %dates;
 +foreach my $fdate (sort keys %fdates){
 +        open IDF, "<$fdates{$fdate}" or die "NO such file!";
 +        while(<IDF>){
 +                if(/(F.*);(.*)/){
 +                        (my $fnumber, my $date) = /(F.*);(.*)/;
 +                        (my $cdate = $date) =~ s/(\d{4})(\d{2})(\d{2})/$3.$2.$1/;
 +                        $dates{$fnumber}{$fdate} = $cdate;
 +                }
 +        }
 +        close IDF;
 +        open ODF, ">$ofiles{$fdate}";
 +        print ODF "FACEHBI; Interno; Fecha\n";
 +        foreach my $fnumber (sort keys %internos){
 +                print ODF "$fnumber; ";
 +                if (exists $internos{$fnumber}){
 +                        print ODF "$internos{$fnumber}; ";
 +                        if (exists($dates{$fnumber}) && exists($dates{$fnumber}{$fdate})){
 +                                print ODF "$dates{$fnumber}{$fdate}\n";
 +                        }else{
 +                                print ODF "NA\n";
 +                        }
 +                }
 +        }
 +        close ODF;
 +}
 +              
 +</code>
 +<code>
 +osotolongo@daisy:~/Cloud/NI_ACE/facehbi> scp -P 20022 detritus.fundacioace.com:/nas/data/facehbi/facehbi_mri.csv ./
 +facehbi_mri.csv                                                                                                                                                 100%  764KB   1.5MB/  00:00    
 +osotolongo@daisy:~/Cloud/NI_ACE/facehbi> sed 's/0/F/; s/Subject/FACEHBI/' facehbi_mri.csv > facehbi_mri_v0.csv
 +osotolongo@daisy:~/Cloud/NI_ACE/facehbi> join -t";" facehbi_mri_v0_date_a.csv facehbi_mri_v0.csv > facehbi_mri_v0_data.csv
 +</code>
 +
 +jodidos problemas de permisos m(
 +<code>
 +[root@detritus ~]# chmod g+rwx /nas/data/subjects/facehbi_smc0003 -R
 +.....
 +[osotolongo@detritus facehbi]$ ls /nas/data/subjects/facehbi_smc0003/
 +bem  label  labels  morph  mpg mri
 +[osotolongo@detritus facehbi]$ cat soloeste.csv 
 +0003;smc
 +[osotolongo@detritus facehbi]$ precon.pl -cut soloeste.csv facehbi
 +</code>
 +
 ===== Reprocesamiento ===== ===== Reprocesamiento =====
  
neuroimagen/facehbi.txt · Last modified: 2020/08/04 10:58 (external edit)