Skip to content

Commit de3a52a

Browse files
committed
add option to set ramp path in stitching.
1 parent 9025061 commit de3a52a

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

TPTBox/stitching/stitching.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ def main( # noqa: C901
324324
is_segmentation: bool = False,
325325
dtype: type | str = float,
326326
save=True,
327+
ramp_path=None,
327328
):
328329
np.set_printoptions(precision=2, floatmode="fixed")
329330
if is_segmentation:
@@ -529,7 +530,8 @@ def main( # noqa: C901
529530
occupancy_arr = occupancy_arr[ex_slice]
530531
assert output is not None
531532
nii_occ = set_array(nii_out, occupancy_arr)
532-
output = output.replace(".nii.gz", "_ramps.nii.gz")
533+
nii_occ.set_data_dtype(np.int8)
534+
output = output.replace(".nii.gz", "_ramps.nii.gz").replace("_msk_", "_") if ramp_path is None else ramp_path
533535
if save:
534536
nib.save(nii_occ, output) # type: ignore
535537
print("Saved ", output) if verbose else None

TPTBox/stitching/stitching_tools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def stitching(
2222
dtype: type = float,
2323
match_histogram=False,
2424
store_ramp=False,
25+
ramp_path=None,
2526
):
2627
out = str(out.file["nii.gz"]) if isinstance(out, BIDS_FILE) else str(out)
2728
files = [to_nii(bf).nii for bf in bids_files]
@@ -37,6 +38,7 @@ def stitching(
3738
kick_out_fully_integrated_images=kick_out_fully_integrated_images,
3839
is_segmentation=is_seg,
3940
dtype=dtype,
41+
ramp_path=ramp_path,
4042
)
4143

4244

0 commit comments

Comments
 (0)