Skip to content

Commit b13d57b

Browse files
author
dPys
committed
omit prune_b0s helper function, save for later PR with signal prediction
1 parent 85a285a commit b13d57b

File tree

1 file changed

+5
-53
lines changed

1 file changed

+5
-53
lines changed

dmriprep/utils/images.py

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,11 @@ def get_list_data(file_list, dtype=np.float32):
180180
----------
181181
file_list : str
182182
A list of file paths to 3D NIFTI images.
183-
Returns
184-
--------
185-
Nibabel image object
183+
184+
Returns
185+
--------
186+
Nibabel image object
187+
186188
Examples
187189
--------
188190
>>> os.chdir(tmpdir)
@@ -290,56 +292,6 @@ def save_4d_to_3d(in_file):
290292
return out_files
291293

292294

293-
def prune_b0s_from_dwis(in_files, b0_ixs):
294-
"""
295-
Remove *b0* volume files from a complete list of DWI volume files.
296-
297-
Parameters
298-
----------
299-
in_files : list
300-
A list of NIfTI file paths corresponding to each 3D volume of a
301-
DWI image (i.e. including B0's).
302-
b0_ixs : list
303-
List of B0 indices.
304-
305-
Returns
306-
-------
307-
out_files : list
308-
A list of file paths to 3d NIFTI images.
309-
310-
Examples
311-
--------
312-
>>> os.chdir(tmpdir)
313-
>>> b0_ixs = np.where(np.loadtxt(str(dipy_datadir / "HARDI193.bval")) <= 50)[0].tolist()[:2]
314-
>>> in_file = str(dipy_datadir / "HARDI193.nii.gz")
315-
>>> threeD_files = save_4d_to_3d(in_file)
316-
>>> out_files = prune_b0s_from_dwis(threeD_files, b0_ixs)
317-
>>> assert sum([os.path.isfile(i) for i in out_files]) == len(out_files)
318-
>>> assert len(out_files) == len(threeD_files) - len(b0_ixs)
319-
"""
320-
if in_files[0].endswith("_warped.nii.gz"):
321-
out_files = [
322-
i
323-
for j, i in enumerate(
324-
sorted(
325-
in_files, key=lambda x: int(x.split("_")[-2].split(".nii.gz")[0])
326-
)
327-
)
328-
if j not in b0_ixs
329-
]
330-
else:
331-
out_files = [
332-
i
333-
for j, i in enumerate(
334-
sorted(
335-
in_files, key=lambda x: int(x.split("_")[-1].split(".nii.gz")[0])
336-
)
337-
)
338-
if j not in b0_ixs
339-
]
340-
return out_files
341-
342-
343295
def save_3d_to_4d(in_files):
344296
"""
345297
Concatenate a list of 3D volumes into a 4D output.

0 commit comments

Comments
 (0)