Sha256: 5ca57a152c1e44051257606ae335c52fef9ff64414b3a7797ea5a4bcc7850c85

Contents?: true

Size: 1.29 KB

Versions: 10

Compression:

Stored size: 1.29 KB

Contents

require 'matlab_helpers/matlab_queue'
module JohnsonTbiLongitudinalSnodPreproc
	
	# Runs the preprocessing job, including spm job customization, run spm job, and handling motion issues.
	# This function assumes a destination directory is set up; it will overwrite preexisting data.	Careful!
	def preproc_visit
		flash "Spatial Preprocessing Subject: #{@subid}"
		setup_directory(@procdir, "PREPROC")
		
		Dir.chdir(@procdir) do
			link_files_into_proc
      run_preproc_mfile
			deal_with_motion
		end
	end
	
	alias_method :perform, :preproc_visit
	
	private
	
	def run_preproc_mfile
	  images = @scan_labels ? @scan_labels.collect! { |label| Dir.glob("a*#{label}*.nii").to_s } : Dir.glob(File.join(@origdir, "a*#{@subid}*.nii"))
	  
	  raise ScriptError, "Can't find any slice-time corrected images in #{@origdir}" if images.empty?
	  queue = MatlabQueue.new
	  queue.paths << ['/Applications/spm/spm8/spm8_current', 
	    '/apps/spm/spm8_current',
      File.join(@libdir, 'custom_methods'), 
      File.join(@libdir, 'matlab_helpers')
    ]

	  queue << "JohnsonTbiLongitudinalSnodPreproc('#{@procdir}/', \
    { #{images.collect {|im| "'#{File.basename(im)}'"}.join(' ')} },  \
    { #{@bold_reps.join(' ') } }, \
    'JohnsonTbiLongitudinalSnodPreproc_job.m')"
    
    puts queue.to_s
    queue.run!
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rpipe-0.1.7 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb
rpipe-0.1.6 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb
rpipe-0.1.4 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb
rpipe-0.1.3 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb
rpipe-0.1.2 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb
rpipe-0.1.1 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb
rpipe-0.1.0 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb
rpipe-0.0.3 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb
rpipe-0.0.2 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb
rpipe-0.0.1 lib/custom_methods/JohnsonTbiLongitudinalSnodPreproc.rb