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 [2019/06/07 20:29]
osotolongo
neuroimagen:fbb [2021/03/10 10:24] (current)
osotolongo [Correccion de movimiento]
Line 81: Line 81:
 </code> </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 ====  ==== de DICOM a NiFTI ==== 
 DELETEME DELETEME
Line 689: 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.1559939357.txt.gz ยท Last modified: 2020/08/04 10:47 (external edit)