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) ⇒ 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.
Constructor Details
#initialize(scan_spec, rawdir) ⇒ PfileRawSequence
Create a local unzipped copy of the Pfile and prepare Scanner Reference Data for reconstruction
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/default_methods/recon/raw_sequence.rb', line 70 def initialize(scan_spec, rawdir) super(scan_spec, rawdir) 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.
88 89 90 91 92 93 94 |
# File 'lib/default_methods/recon/raw_sequence.rb', line 88 def reconstruct_sequence(outfile) volumes_to_skip = @scan_spec['volumes_to_skip'] ||= 3 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 |