diff --git a/Gemfile b/Gemfile index 540bd2c..34c54bd 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source "http://rubygems.org" -# Specify your gem's dependencies in ruby-nifti.gemspec +# Specify your gem's dependencies in rpipe.gemspec gemspec diff --git a/lib/default_methods/recon/raw_sequence.rb b/lib/default_methods/recon/raw_sequence.rb index 08e4dca..1f862fe 100644 --- a/lib/default_methods/recon/raw_sequence.rb +++ b/lib/default_methods/recon/raw_sequence.rb @@ -14,9 +14,9 @@ def initialize(scan_spec, rawdir) class DicomRawSequence < RawSequence # Locally copy and unzip a folder of Raw Dicoms and call convert_sequence on them def prepare_and_convert_sequence(outfile) - scandir = File.join(@rawdir, @scan_spec['dir']) - $Log.info "Dicom Reconstruction: #{scandir}" - Pathname.new(scandir).all_dicoms do |dicoms| + @scandir = File.join(@rawdir, @scan_spec['dir']) + $Log.info "Dicom Reconstruction: #{@scandir}" + Pathname.new(@scandir).all_dicoms do |dicoms| convert_sequence(dicoms, outfile) end end @@ -29,14 +29,22 @@ def prepare_and_convert_sequence(outfile) def convert_sequence(dicoms, outfile) local_scandir = File.dirname(dicoms.first) second_file = Dir.glob( File.join(local_scandir, "*0002*") ) - wildcard = File.join(local_scandir, "*.[0-9]*") + glob = case second_file + when /.*\.\d*/ + "*.[0-9]*" + else + "*.dcm" + end + wildcard = File.join(local_scandir, glob) + + recon_cmd_format = 'to3d -skip_outliers %s -prefix tmp.nii "%s"' timing_opts = timing_options(@scan_spec, second_file) unless run(recon_cmd_format % [timing_opts, wildcard]) - raise(IOError,"Failed to reconstruct scan: #{scandir}") + raise(IOError,"Failed to reconstruct scan: #{@scandir}") end end diff --git a/lib/generators/workflow_generator.rb b/lib/generators/workflow_generator.rb index 4514534..8c198e9 100644 --- a/lib/generators/workflow_generator.rb +++ b/lib/generators/workflow_generator.rb @@ -44,7 +44,7 @@ def build jobs = [] # Recon - recon_options = {'rawdir' => @rawdir, 'epi_pattern' => /(Resting|Task)/i, } + recon_options = {'rawdir' => @rawdir, 'epi_pattern' => /(Rest|Task)/i, } config_step_method(recon_options, 'recon') if @config['custom_methods'] jobs << ReconJobGenerator.new(recon_options).build