Skip to content

Commit

Permalink
fixing syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
danielasay committed Jul 2, 2024
1 parent fbd9b3c commit 17c689c
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions dwiqc/tasks/qsiprep.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,22 +354,22 @@ def extract_vols(self, dwi_full_path, dwi_basename):
self.insert_json_value('IntendedFor', f'ses-{self._ses}/dwi/{dwi_basename}', fmap_json_file_path)


def execute_fmap_truncation(self)
def execute_fmap_truncation(self):
"""
If truncate fmaps is true, this method will go through all of the fmaps in the fmap BIDS dir and make sure they are only one volume in length
"""
if self._truncate_fmap:
fmap_files = self._layout.get(subject=self._sub, session=self._ses, suffix='epi', extension='.nii.gz', return_type='filename')

for fmap in fmap_files:
shape = nib.load(fmap).get_fdata().shape
if len(shape) == 4:
num_vols = shape[3]
if num_vols == 1:
continue
middle_vol = num_vols // 2

self.run_fslroi(fmap, middle_vol)
if self._truncate_fmap:
fmap_files = self._layout.get(subject=self._sub, session=self._ses, suffix='epi', extension='.nii.gz', return_type='filename')

for fmap in fmap_files:
shape = nib.load(fmap).get_fdata().shape
if len(shape) == 4:
num_vols = shape[3]
if num_vols == 1:
continue
middle_vol = num_vols // 2
self.run_fslroi(fmap, middle_vol)

def run_fslroi(self, fmap, volume):
vol_index = int(volume) - 1
Expand Down

0 comments on commit 17c689c

Please sign in to comment.