You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 72c00d7
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: TPTBox/stitching/README.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,8 @@ You can verify alignment by opening the images in ITKSnap with "open additional
8
8
9
9
| Function | Description |
10
10
|---|---|
11
-
|`stitching(nii_list, out, ...)`|Stitch a list of `NII` objects; returns `(result_nii, ramp_nii)`|
12
-
|`stitching_raw(paths, out, ...)`|Stitch from file paths directly|
11
+
|`stitching(inputs, out, ...)`|High-level wrapper. `inputs` accepts any mix of `BIDS_FILE`, `NII`, `str`, or `Path`. Resolves the output path from a `BIDS_FILE` when one is passed. Returns `(result_nii, ramp_nii)` as `NII` objects.|
|`NAKO_stitch_T2w(HWS, BWS, LWS, n4_after_stitch=False)`| Stitch the three NAKO sagittal T2w spine stations (HWS cervical, BWS thoracic, LWS lumbar) into one volume |
14
14
15
15

@@ -24,7 +24,7 @@ stitching.py
24
24
[-i IMAGES [IMAGES ...]] a list of input image paths
25
25
[-o OUTPUT] The output image path
26
26
[-v] verbose - if set, there will be more printouts.
27
-
[-min_value MIN_VALUE] New pixels not present will get this value. Recommended 0 for MRI and for CT -1024 or the known min-value.
27
+
[-min_value MIN_VALUE] Background fill used when resampling each chunk, and — when set explicitly — a hard floor applied to the stitched output. Pass 0 for MRI magnitude, -1024 for CT. Omitting it (the Python-API default `None`) uses 0 as the internal background and only applies a hard floor when the output dtype cannot represent negatives (unsigned integer types) — signed / float outputs then keep legitimate negatives (Philips-scaled fat-fraction, phase, B0 offsets).
28
28
[-seg] This flag is required if you merge segmentation Niftis.
29
29
Switches:
30
30
[-no_bias] If set: Do not use n4_bias_field_correction. It speeds up the process, but n4_bias_field_correction helps in roughly aligning the histogram.
@@ -67,14 +67,15 @@ list_of_files = [
67
67
# Call the stitching function
68
68
# This will combine your images into a single NIfTI file
69
69
stitching(
70
-
list_of_files, #List of input files
71
-
out="out_path_stitched_image.nii.gz", # Path to save stitched output
72
-
is_seg=False, # Set True if these are segmentation masks
73
-
is_ct=False, #True for CT, min_value will by -1024 instead of 0
70
+
list_of_files, #BIDS_FILE / NII / str / Path (any mix)
71
+
out="out_path_stitched_image.nii.gz", # Path or BIDS_FILE for the stitched output
72
+
is_seg=False, # Set True for segmentation masks (forces integer dtype, nearest-neighbour resample)
73
+
is_ct=False, #Sets min_value to -1024 (CT air) when min_value is not passed explicitly
74
74
kick_out_fully_integrated_images=True,
75
-
dtype=float, #Data type of the output image
75
+
dtype=float, #Output dtype; "auto" picks the smallest lossless type from the inputs (float32 when any input has a non-trivial scl_slope/inter)
76
76
match_histogram=False, # Match intensity histograms across images
77
77
store_ramp=False, # Store blending ramp (optional)
78
+
min_value=None, # Explicit background/floor. None (default) = clip only when the output dtype is unsigned integer (protects against negative-to-huge wraparound) and let signed / float outputs keep legitimate negatives. Pass 0 to floor magnitude MR at 0 so cubic-spline resample ringing doesn't leak small negatives into what should be a non-negative volume; pass -1024 for CT.
0 commit comments