Skip to content

Commit

Permalink
Update pipeline for pipr, generalize epi options
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Kastman committed Mar 28, 2011
1 parent 909c4bd commit cdb8c84
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion 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
18 changes: 13 additions & 5 deletions lib/default_methods/recon/raw_sequence.rb
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/generators/workflow_generator.rb
Expand Up @@ -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

Expand Down

0 comments on commit cdb8c84

Please sign in to comment.