This shows you the differences between two versions of the page.
neuroimagen:cpac [2019/05/30 09:01] osotolongo [Integrando en el cluster] |
neuroimagen:cpac [2020/08/04 10:58] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== CPAC ====== | ||
- | Una opcion para preprocesar las imagenes fMRI es utilizar [[http:// | ||
- | |||
- | Se instala bajando una imagen [[https:// | ||
- | |||
- | ===== Sujetos individuales ===== | ||
- | Siguiendo [[http:// | ||
- | |||
- | <code bash> | ||
- | [osotolongo@brick01 mopead]$ singularity run --cleanenv -B / | ||
- | </ | ||
- | |||
- | **Nota:** el tag // | ||
- | |||
- | y por supuesto, la primera vez no funciona, | ||
- | |||
- | < | ||
- | | ||
- | 190516-08: | ||
- | could not run node: resting_preproc_sub-0001_ses-1.anat_preproc_afni_0.anat_skullstrip | ||
- | 190516-08: | ||
- | | ||
- | 190516-08: | ||
- | | ||
- | </ | ||
- | |||
- | Puedo cambiar el // | ||
- | |||
- | < | ||
- | # Choice of using AFNI or FSL-BET to perform SkullStripping | ||
- | skullstrip_option: | ||
- | </ | ||
- | |||
- | La orden ahora es ligeramente diferente pues he de especificar el archivo de configuracion del pipeline, | ||
- | |||
- | < | ||
- | [osotolongo@brick01 mopead]$ singularity run --cleanenv -B / | ||
- | |||
- | </ | ||
- | |||
- | 183 minutos después, | ||
- | < | ||
- | End of subject workflow resting_preproc_sub-0002_ses-1 | ||
- | |||
- | CPAC run complete: | ||
- | |||
- | Pipeline configuration: | ||
- | Subject workflow: resting_preproc_sub-0002_ses-1 | ||
- | Elapsed run time (minutes): 184.085074282 | ||
- | Timing information saved in / | ||
- | System time of start: | ||
- | System time of completion: 2019-05-16 12:21:49 | ||
- | </ | ||
- | |||
- | El output es enorme, | ||
- | < | ||
- | [osotolongo@brick01 mopead]$ ls cpac_out/ | ||
- | alff_to_standard_smooth_zstd | ||
- | anatomical_brain | ||
- | anatomical_csf_mask | ||
- | anatomical_gm_mask | ||
- | anatomical_reorient | ||
- | anatomical_to_mni_nonlinear_xfm | ||
- | anatomical_to_standard | ||
- | anatomical_to_symmetric_mni_nonlinear_xfm | ||
- | anatomical_wm_mask | ||
- | ants_affine_xfm | ||
- | ants_initial_xfm | ||
- | ants_rigid_xfm | ||
- | ants_symmetric_affine_xfm | ||
- | ants_symmetric_initial_xfm | ||
- | ants_symmetric_rigid_xfm | ||
- | centrality_smooth_zstd | ||
- | dr_tempreg_maps_files_to_standard_smooth | ||
- | dr_tempreg_maps_zstat_files_to_standard_smooth | ||
- | falff_to_standard_smooth_zstd | ||
- | frame_wise_displacement_jenkinson | ||
- | </ | ||
- | |||
- | Afortunadamente, | ||
- | |||
- | ==== Integrando en el cluster ==== | ||
- | El esquema para correr en el cluster es el de lanzar las imagenes de singularity en paralelo. Hay que hacer varias | ||
- | |||
- | ++++ Aqui el codigo | | ||
- | |||
- | <code perl cpac.pl> | ||
- | # | ||
- | # Copyright 2019 O. Sotolongo < | ||
- | use strict; use warnings; | ||
- | |||
- | use File:: | ||
- | use NEURO qw(print_help get_pair load_study achtung shit_done get_lut check_or_make centiloid_fbb); | ||
- | use Data::Dump qw(dump); | ||
- | use File:: | ||
- | use File:: | ||
- | |||
- | my $cpac_img = '/ | ||
- | my $pipe_conf = ' | ||
- | my $lib_conf = $ENV{' | ||
- | my $cfile; | ||
- | |||
- | @ARGV = (" | ||
- | |||
- | while (@ARGV and $ARGV[0] =~ /^-/) { | ||
- | $_ = shift; | ||
- | last if /^--$/; | ||
- | if (/^-cut/) { $cfile = shift; chomp($cfile); | ||
- | if (/^-h$/) { print_help $ENV{' | ||
- | } | ||
- | my $study = shift; | ||
- | unless ($study) { print_help $ENV{' | ||
- | my %std = load_study($study); | ||
- | my $w_dir = $std{' | ||
- | my $data_dir = $std{' | ||
- | my $bids_dir = $data_dir.'/ | ||
- | my $fmriout_dir = $data_dir.'/ | ||
- | check_or_make($fmriout_dir); | ||
- | my $outdir = " | ||
- | check_or_make($outdir); | ||
- | my $tmpdir = " | ||
- | check_or_make($tmpdir); | ||
- | my $proj_conf = $data_dir.'/' | ||
- | system(" | ||
- | my @subjects; | ||
- | if($cfile){ | ||
- | open DBF, $cfile or die "No such file\n"; | ||
- | while(< | ||
- | chomp; | ||
- | push @subjects, $_; | ||
- | } | ||
- | close DBF; | ||
- | }else{ | ||
- | opendir DBD, $bids_dir or die "Cold not open dir\n"; | ||
- | while (my $thing = readdir DBD){ | ||
- | if ($thing eq ' | ||
- | next; | ||
- | } | ||
- | if ($thing =~ /sub-*/) { | ||
- | push @subjects, $thing; | ||
- | } | ||
- | } | ||
- | closedir DBD; | ||
- | } | ||
- | foreach my $subject (@subjects) { | ||
- | my $orderfile = $outdir.'/' | ||
- | open ORD, "> | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD 'srun singularity run --cleanenv -B ' | ||
- | close ORD; | ||
- | system(" | ||
- | sleep(20); | ||
- | } | ||
- | my $orderfile = $outdir.'/ | ||
- | open ORD, "> | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD '# | ||
- | print ORD ": | ||
- | close ORD; | ||
- | my $order = ' | ||
- | exec($order); | ||
- | </ | ||
- | ++++ | ||
- | **Nota**: Al correr //c-pac// en el cluster dan errores de I/O. Esto puede ser debido a un intenso uso de la red o de disco. He de reducir el nuemro de lanzamientos concurrentes y probar de nuevo. | ||
- | |||
- | === Output === | ||
- | |||
- | //C-PAC// genera un directorio de output por cada sujeto analizado | ||
- | < | ||
- | [osotolongo@detritus mopead]$ ls cpac_out/ | ||
- | sub-0001_ses-1 | ||
- | sub-0002_ses-1 | ||
- | </ | ||
- | |||
- | [[http:// | ||
- | |||
- | === Errores === | ||
- | |||
- | < | ||
- | 190529-07: | ||
- | | ||
- | 190529-07: | ||
- | | ||
- | 190529-07: | ||
- | | ||
- | srun: error: brick01: task 0: Exited with exit code 1 | ||
- | </ | ||
- | |||
- | |||
- | ===== Grupos ===== | ||
- | |||
- | Hay diferentes niveles de analisis grupal, explicados en http:// |