Class: DefaultRecon::PfileRawSequence
- Inherits:
-
RawSequence
- Object
- RawSequence
- DefaultRecon::PfileRawSequence
- Defined in:
- lib/default_methods/recon/raw_sequence.rb
Overview
Reconstucts a PFile from Raw to Nifti File
Instance Method Summary collapse
-
#initialize(scan_spec, rawdir, volumes_to_skip) ⇒ PfileRawSequence
constructor
Create a local unzipped copy of the Pfile and prepare Scanner Reference Data for reconstruction.
-
#reconstruct_sequence(outfile) ⇒ Object
(also: #prepare)
Reconstructs a single pfile using epirecon Outfile may include a ‘.nii’ extension - a nifti file will be constructed directly in this case.
Methods inherited from RawSequence
Constructor Details
#initialize(scan_spec, rawdir, volumes_to_skip) ⇒ PfileRawSequence
Create a local unzipped copy of the Pfile and prepare Scanner Reference Data for reconstruction
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/default_methods/recon/raw_sequence.rb', line 89 def initialize(scan_spec, rawdir, volumes_to_skip) super(scan_spec, rawdir, volumes_to_skip) base_pfile_path = File.join(@rawdir, @scan_spec['pfile']) pfile_path = File.exist?(base_pfile_path) ? base_pfile_path : base_pfile_path + '.bz2' raise IOError, "#{pfile_path} does not exist." unless File.exist?(pfile_path) flash "Pfile Reconstruction: #{pfile_path}" @pfile_data = Pathname.new(pfile_path).local_copy @refdat_file = @scan_spec['refdat_stem'] ||= search_for_refdat_file setup_refdat(@refdat_file) end |
Instance Method Details
#reconstruct_sequence(outfile) ⇒ Object Also known as: prepare
Reconstructs a single pfile using epirecon Outfile may include a ‘.nii’ extension - a nifti file will be constructed directly in this case.
107 108 109 110 111 112 |
# File 'lib/default_methods/recon/raw_sequence.rb', line 107 def reconstruct_sequence(outfile) epirecon_cmd_format = "epirecon_ex -f %s -NAME %s -skip %d -scltype=0" = [@pfile_data, outfile, @volumes_to_skip] epirecon_cmd = epirecon_cmd_format % raise ScriptError, "Problem running #{epirecon_cmd}" unless run(epirecon_cmd) end |