brainmap/rpipe — Issue #1: Discarded Acquisitions at scan level different from Pfiles and DICOMs?
Author: kastman
Created: 2011-12-01 16:35:00+00:00
State: open

An email from Matthew:

I am helping Michelle do some preprocessing of resting data for her MOSAIC study. Each subject had two resting scans, one with 195 reps and one with 165 reps. I don't think rpipe currently can handle discarding different number of reps for each scan. At least when going from DICOMS. I think the utility is in place when going from pfiles though.

When reconstructing from DICOMS, the volumes are stripped with the method strip_leading_volumes(infile, outfile, volume_skip, bold_rep) in the DefaultRecon module (default_recon.rb). The variable @volume_skip is passed into this method when called. @volume_skip is defined in the Reconstructrion class found in rpipe.rb:
@volume_skip = recon_spec['volume_skip'] || VOLUME_SKIP

So, if I understand the hash correctly, @volume_skip is defined from recon_spec, which is a job level, not a scan level. Therefore, the number of volumes to skip is the same for every scan.

In the yaml files, there is a scan level hash called "volumes_to_skip" that is used when reconstructing from pfiles. This is found in the reconstruct_sequence method of the PfileRawSequence class (raw_sequence.rb):

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"
epirecon_cmd_options = [@pfile_data, outfile, volumes_to_skip]
epirecon_cmd = epirecon_cmd_format % epirecon_cmd_options
raise ScriptError, "Problem running #{epirecon_cmd}" unless run(epirecon_cmd)
end

I worked around this by reconstructing each scan individually before doing the preprocessing. But, it was a pain in the butt.

Whenever you get around to updating rpipe, it would be an easy fix to allow the number of volumes to skip to be a scan level hash instead of a job level hash. Unless, of course, there is a good reason for it not to be.

I hope that made a bit of sense. My ruby terminology may not be the best.

Thanks Erik!

Matthew